diff --git a/src/sage/algebras/rational_cherednik_algebra.py b/src/sage/algebras/rational_cherednik_algebra.py index 597954c7249..3b85c1e13a3 100644 --- a/src/sage/algebras/rational_cherednik_algebra.py +++ b/src/sage/algebras/rational_cherednik_algebra.py @@ -237,7 +237,7 @@ def algebra_generators(self): sage: list(R.algebra_generators()) [a1, a2, s1, s2, ac1, ac2] """ - keys = ['a'+str(i) for i in self._cartan_type.index_set()] + keys = ['a'+str(i) for i in self._cartan_type.index_set()] keys += ['s'+str(i) for i in self._cartan_type.index_set()] keys += ['ac'+str(i) for i in self._cartan_type.index_set()] diff --git a/src/sage/algebras/splitting_algebra.py b/src/sage/algebras/splitting_algebra.py index 2ca3881bbcf..94b3fbc5c24 100644 --- a/src/sage/algebras/splitting_algebra.py +++ b/src/sage/algebras/splitting_algebra.py @@ -217,7 +217,7 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True): deg = monic_polynomial.degree() from sage.structure.category_object import normalize_names - self._root_names = normalize_names(deg-1, names) + self._root_names = normalize_names(deg-1, names) root_names = list(self._root_names) verbose("Create splitting algebra to base ring %s and polynomial %s (%s %s)" % (base_ring, monic_polynomial, iterate, warning)) @@ -238,8 +238,8 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True): if deg < 1: raise ValueError("the degree of the polynomial must positive") - self._splitting_roots = [] - self._coefficients_list = [] + self._splitting_roots = [] + self._coefficients_list = [] self._invertible_elements = {} if isinstance(base_ring, SplittingAlgebra): @@ -289,12 +289,12 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True): SplittingAlgebra.__init__(self, q, root_names_reduces, warning=False) - splitting_roots = base_ring_step._splitting_roots + self._splitting_roots + splitting_roots = base_ring_step._splitting_roots + self._splitting_roots coefficients_list = base_ring_step._coefficients_list + self._coefficients_list verbose("Adding roots: %s" % (splitting_roots)) - self._splitting_roots = splitting_roots + self._splitting_roots = splitting_roots self._coefficients_list = coefficients_list else: PolynomialQuotientRing_domain.__init__(self, P, p, root_name) @@ -343,7 +343,7 @@ def __init__(self, monic_polynomial, names='X', iterate=True, warning=True): # ------------------------------------------------------------------ if cf0_inv is not None: deg_cf = len(cf)-1 - pf = P(cf) + pf = P(cf) for root in self._splitting_roots: check = self(pf) if not check.is_zero(): diff --git a/src/sage/categories/algebra_functor.py b/src/sage/categories/algebra_functor.py index d9b4872b129..d2c64474d8e 100644 --- a/src/sage/categories/algebra_functor.py +++ b/src/sage/categories/algebra_functor.py @@ -631,7 +631,7 @@ def _apply_functor_to_morphism(self, f): 2*() + 2*(2,3) + (1,2,3) + 4*(1,3,2) """ from sage.categories.rings import Rings - domain = self(f.domain()) + domain = self(f.domain()) codomain = self(f.codomain()) # we would want to use something like: # domain.module_morphism(on_coefficients=h, codomain=codomain, category=Rings()) diff --git a/src/sage/categories/cartesian_product.py b/src/sage/categories/cartesian_product.py index f61cca89629..39e9a316b9a 100644 --- a/src/sage/categories/cartesian_product.py +++ b/src/sage/categories/cartesian_product.py @@ -16,7 +16,7 @@ from sage.categories.covariant_functorial_construction import CovariantFunctorialConstruction, CovariantConstructionCategory from sage.categories.pushout import MultivariateConstructionFunctor -native_python_containers = set([tuple, list, set, frozenset, range]) +native_python_containers = set([tuple, list, set, frozenset, range]) class CartesianProductFunctor(CovariantFunctorialConstruction, MultivariateConstructionFunctor): """ diff --git a/src/sage/categories/category_with_axiom.py b/src/sage/categories/category_with_axiom.py index 9850f4d4c85..1c92e587456 100644 --- a/src/sage/categories/category_with_axiom.py +++ b/src/sage/categories/category_with_axiom.py @@ -2609,11 +2609,11 @@ def super_categories(self): class SubcategoryMethods: FiniteDimensional = axiom("FiniteDimensional") - Commutative = axiom("Commutative") - Unital = axiom("Unital") - Connected = axiom("Connected") - Flying = axiom("Flying") - Blue = axiom("Blue") + Commutative = axiom("Commutative") + Unital = axiom("Unital") + Connected = axiom("Connected") + Flying = axiom("Flying") + Blue = axiom("Blue") class FiniteDimensional(CategoryWithAxiom): pass diff --git a/src/sage/categories/covariant_functorial_construction.py b/src/sage/categories/covariant_functorial_construction.py index 40d661945e8..ad402bfe09d 100644 --- a/src/sage/categories/covariant_functorial_construction.py +++ b/src/sage/categories/covariant_functorial_construction.py @@ -286,7 +286,7 @@ def _base_category_class(cls): """ module_name = cls.__module__.replace(cls._functor_category.lower() + "_","") import sys - name = cls.__name__.replace(cls._functor_category, "") + name = cls.__name__.replace(cls._functor_category, "") __import__(module_name) module = sys.modules[module_name] return (module.__dict__[name],) diff --git a/src/sage/categories/distributive_magmas_and_additive_magmas.py b/src/sage/categories/distributive_magmas_and_additive_magmas.py index 233f0ce12ac..3518893c907 100644 --- a/src/sage/categories/distributive_magmas_and_additive_magmas.py +++ b/src/sage/categories/distributive_magmas_and_additive_magmas.py @@ -43,7 +43,7 @@ class AdditiveCommutative(CategoryWithAxiom): class AdditiveUnital(CategoryWithAxiom): class Associative(CategoryWithAxiom): AdditiveInverse = LazyImport('sage.categories.rngs', 'Rngs', at_startup=True) - Unital = LazyImport('sage.categories.semirings', 'Semirings', at_startup=True) + Unital = LazyImport('sage.categories.semirings', 'Semirings', at_startup=True) class ParentMethods: diff --git a/src/sage/categories/enumerated_sets.py b/src/sage/categories/enumerated_sets.py index 695f4982bd8..1097a04412a 100644 --- a/src/sage/categories/enumerated_sets.py +++ b/src/sage/categories/enumerated_sets.py @@ -230,7 +230,7 @@ def __iter__(self): """ # Check if .first() and .next(x) are overridden in the subclass if ( self.first != self._first_from_iterator and - self.next != self._next_from_iterator ): + self.next != self._next_from_iterator ): return self._iterator_from_next() #Check to see if .unrank() is overridden in the subclass elif self.unrank != self._unrank_from_iterator: @@ -592,7 +592,7 @@ def list(self): [1, 2, 3] """ return list(self.tuple()) - _list_default = list # needed by the check system. + _list_default = list # needed by the check system. def _list_from_iterator(self): r""" @@ -1108,7 +1108,7 @@ def rank(self): """ return self.parent().rank(self) - Finite = LazyImport('sage.categories.finite_enumerated_sets', 'FiniteEnumeratedSets', at_startup=True) + Finite = LazyImport('sage.categories.finite_enumerated_sets', 'FiniteEnumeratedSets', at_startup=True) Infinite = LazyImport('sage.categories.infinite_enumerated_sets', 'InfiniteEnumeratedSets', at_startup=True) class CartesianProducts(CartesianProductsCategory): diff --git a/src/sage/categories/infinite_enumerated_sets.py b/src/sage/categories/infinite_enumerated_sets.py index 581faab5ff4..3c7a861a4b6 100644 --- a/src/sage/categories/infinite_enumerated_sets.py +++ b/src/sage/categories/infinite_enumerated_sets.py @@ -88,7 +88,7 @@ def list(self): NotImplementedError: cannot list an infinite set """ raise NotImplementedError("cannot list an infinite set") - _list_default = list # needed by the check system. + _list_default = list # needed by the check system. def _test_enumerated_set_iter_cardinality(self, **options): """ diff --git a/src/sage/categories/quotient_fields.py b/src/sage/categories/quotient_fields.py index 5e4cf0c7edc..02780268c8f 100644 --- a/src/sage/categories/quotient_fields.py +++ b/src/sage/categories/quotient_fields.py @@ -315,7 +315,7 @@ def xgcd(self, other): return (P(g)/P(lcmD), P(s*selfD)/P(lcmD),P(t*otherD)/P(lcmD)) except (AttributeError, NotImplementedError, TypeError, ValueError): zero = self.parent().zero() - one = self.parent().one() + one = self.parent().one() if self != zero: return (one, ~self, zero) elif other != zero: @@ -681,11 +681,11 @@ def _derivative(self, var=None): try: numder = num._derivative(var) dender = den._derivative(var) - d = den.gcd(dender) - den = den // d + d = den.gcd(dender) + den = den // d dender = dender // d - tnum = numder * den - num * dender - tden = self.denominator() * den + tnum = numder * den - num * dender + tden = self.denominator() * den if not tden.is_one() and tden.is_unit(): try: tnum = tnum * tden.inverse_of_unit() diff --git a/src/sage/categories/semigroups.py b/src/sage/categories/semigroups.py index 8e60690e631..10e2617e1ab 100644 --- a/src/sage/categories/semigroups.py +++ b/src/sage/categories/semigroups.py @@ -327,7 +327,7 @@ def cayley_graph(self, side="right", simple=False, elements=None, generators = self.semigroup_generators() if isinstance(generators, (list, tuple)): generators = dict((self(g), self(g)) for g in generators) - left = (side == "left" or side == "twosided") + left = (side == "left" or side == "twosided") right = (side == "right" or side == "twosided") def add_edge(source, target, label, side_label): diff --git a/src/sage/coding/channel.py b/src/sage/coding/channel.py index 915982850c9..ba59d756d1a 100644 --- a/src/sage/coding/channel.py +++ b/src/sage/coding/channel.py @@ -603,7 +603,7 @@ def transmit_unsafe(self, message): zero = V.base_ring().zero() errors = sample(range(n), number_errors + number_erasures) - error_positions = errors[:number_errors] + error_positions = errors[:number_errors] erasure_positions = errors[number_errors:] error_vector = random_error_vector(n, V.base_ring(), error_positions) diff --git a/src/sage/coding/code_bounds.py b/src/sage/coding/code_bounds.py index 766a8f266cf..8e1ce61cedb 100644 --- a/src/sage/coding/code_bounds.py +++ b/src/sage/coding/code_bounds.py @@ -656,7 +656,7 @@ def entropy_inverse(x, q=2): if q < 2: # Here we check that q is actually at least 2 raise ValueError("The value q must be an integer greater than 1") - eps = 4.5e-16 # find_root has about this as the default xtol + eps = 4.5e-16 # find_root has about this as the default xtol ymax = 1 - 1/q if x <= eps: return 0 diff --git a/src/sage/coding/grs_code.py b/src/sage/coding/grs_code.py index efbc1d32c5b..d86c61c254e 100644 --- a/src/sage/coding/grs_code.py +++ b/src/sage/coding/grs_code.py @@ -1009,7 +1009,7 @@ def encode(self, p): C = self.code() if p.degree() >= C.dimension(): raise ValueError("The polynomial to encode must have degree at most %s" % (C.dimension() - 1)) - alphas = C.evaluation_points() + alphas = C.evaluation_points() col_mults = C.column_multipliers() c = vector(C.base_ring(), [col_mults[i]*p(alphas[i]) for i in range(C.length())]) return c @@ -1057,7 +1057,7 @@ def unencode_nocheck(self, c): """ C = self.code() - alphas = C.evaluation_points() + alphas = C.evaluation_points() col_mults = C.column_multipliers() c = [c[i]/col_mults[i] for i in range(C.length())] @@ -1229,14 +1229,14 @@ def _decode_to_code_and_message(self, r): r_list = copy(r) r_list = [r[i]/col_mults[i] for i in range(0, C.length())] - t = (C.minimum_distance()-1) // 2 + t = (C.minimum_distance()-1) // 2 l0 = n-1-t l1 = n-1-t-(k-1) - S = matrix(C.base_field(), n, l0+l1+2, + S = matrix(C.base_field(), n, l0+l1+2, lambda i, j: (C.evaluation_points()[i])**j if j<(l0+1) else r_list[i]*(C.evaluation_points()[i])**(j-(l0+1))) - S = S.right_kernel() - S = S.basis_matrix().row(0) + S = S.right_kernel() + S = S.basis_matrix().row(0) R = C.base_field()['x'] Q0 = R(S.list_from_positions(range(l0 + 1))) diff --git a/src/sage/combinat/cluster_algebra_quiver/mutation_type.py b/src/sage/combinat/cluster_algebra_quiver/mutation_type.py index b5eddce4393..da766a9c108 100644 --- a/src/sage/combinat/cluster_algebra_quiver/mutation_type.py +++ b/src/sage/combinat/cluster_algebra_quiver/mutation_type.py @@ -763,7 +763,7 @@ def _connected_mutation_type(dg): elif len( exc_labels ) == 1: label = exc_labels[0] v_out = label[0] - v_in = label[1] + v_in = label[1] label = label[2] if label == (1,-2): if dict_in_out[ v_in ][0] == 1 and dict_in_out[ v_in ][1] == 0: diff --git a/src/sage/combinat/crystals/generalized_young_walls.py b/src/sage/combinat/crystals/generalized_young_walls.py index 9503199c28c..2d8114eeda2 100644 --- a/src/sage/combinat/crystals/generalized_young_walls.py +++ b/src/sage/combinat/crystals/generalized_young_walls.py @@ -452,7 +452,7 @@ def e(self, i): """ signature = self.generate_signature(i) raw_signature = signature[0] - lastminus = signature[1].rfind('-') + lastminus = signature[1].rfind('-') newdata = [] if lastminus > -1: deletionrow = raw_signature[lastminus][1] @@ -725,7 +725,7 @@ def in_highest_weight_crystal(self,La): else: p_not_found = True for p in index_set: - if (j+k) % (n+1) == (p+1) % (n+1) and self.a(j,k) - self.a( (j-1) % (n+1) ,k) <= La.scalar(ac[p]): + if (j+k) % (n+1) == (p+1) % (n+1) and self.a(j,k) - self.a( (j-1) % (n+1) ,k) <= La.scalar(ac[p]): p_not_found = False continue else: diff --git a/src/sage/combinat/designs/bibd.py b/src/sage/combinat/designs/bibd.py index d850d6eeb8d..8e0a2df99de 100644 --- a/src/sage/combinat/designs/bibd.py +++ b/src/sage/combinat/designs/bibd.py @@ -1372,15 +1372,15 @@ def BIBD_from_arc_in_desarguesian_projective_plane(n,k,existence=False): from sage.libs.gap.libgap import libgap from sage.matrix.constructor import Matrix - K = GF(q,'a') + K = GF(q,'a') one = K.one() # An irreducible quadratic form over K[X,Y] GO = libgap.GeneralOrthogonalGroup(-1,2,q) - M = libgap.InvariantQuadraticForm(GO)['matrix'] - M = Matrix(M) - M = M.change_ring(K) - Q = lambda xx,yy : M[0,0]*xx**2+(M[0,1]+M[1,0])*xx*yy+M[1,1]*yy**2 + M = libgap.InvariantQuadraticForm(GO)['matrix'] + M = Matrix(M) + M = M.change_ring(K) + Q = lambda xx,yy : M[0,0]*xx**2+(M[0,1]+M[1,0])*xx*yy+M[1,1]*yy**2 # Here, the additive subgroup H (of order n) of K mentioned in # [Denniston69] is the set of all elements of K of degree < log_n diff --git a/src/sage/combinat/designs/block_design.py b/src/sage/combinat/designs/block_design.py index 6e1c58f0224..608a06581e1 100644 --- a/src/sage/combinat/designs/block_design.py +++ b/src/sage/combinat/designs/block_design.py @@ -343,11 +343,11 @@ def DesarguesianProjectivePlaneDesign(n, point_coordinates=True, check=True): # we relabel the points with the integers from 0 to n^2 + n as follows: # - the affine plane is the set of points [x:y:1] (i.e. the third coordinate # is non-zero) and gets relabeled from 0 to n^2-1 - affine_plane = lambda x,y: relabel[x] + n * relabel[y] + affine_plane = lambda x,y: relabel[x] + n * relabel[y] # - the affine line is the set of points [x:1:0] (i.e. the third coordinate is # zero but not the second one) and gets relabeled from n^2 to n^2 + n - 1 - line_infinity = lambda x: n2 + relabel[x] + line_infinity = lambda x: n2 + relabel[x] # - the point is [1:0:0] and gets relabeled n^2 + n point_infinity = n2 + n @@ -380,7 +380,7 @@ def DesarguesianProjectivePlaneDesign(n, point_coordinates=True, check=True): if point_coordinates: zero = K.zero() - one = K.one() + one = K.one() d = {affine_plane(x,y): (x,y,one) for x in Kiter for y in Kiter} diff --git a/src/sage/combinat/designs/database.py b/src/sage/combinat/designs/database.py index d13823082ec..54528b14b9b 100644 --- a/src/sage/combinat/designs/database.py +++ b/src/sage/combinat/designs/database.py @@ -514,7 +514,7 @@ def OA_8_69(): PBD = [[x for x in B if x not in oval] for B in BIBD] sets_of_size_seven = [R for R in PBD if len(R) == 7] - others = [R for R in PBD if len(R) != 7] + others = [R for R in PBD if len(R) != 7] # 68, 27, and 52 are the only elements appearing twice in the rows of # sets_of_size_seven, and each row contains exactly one of them. @@ -628,7 +628,7 @@ def OA_8_76(): PBD.remove([]) sets_of_size_seven = [R for R in PBD if len(R) == 7] - others = [R for R in PBD if len(R) != 7] + others = [R for R in PBD if len(R) != 7] # critical_points are the 10 elements appearing twice in the rows of the 10 # sets_of_size_seven, and each row contains exactly two of them @@ -1477,11 +1477,11 @@ def OA_17_560(): """ from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF alpha = 5 - beta = 4 - p = 2 - k = 17 - m = 16 - n = p**alpha + beta = 4 + p = 2 + k = 17 + m = 16 + n = p**alpha G = GF((p, alpha), prefix='x') G_set = sorted(G) # sorted by lexicographic order, G[1] = 1 @@ -3694,7 +3694,7 @@ def DM_52_6_1(): sage: _ = designs.difference_matrix(52,6) """ from sage.rings.finite_rings.finite_field_constructor import FiniteField - F4 = FiniteField(4,'z') + F4 = FiniteField(4,'z') G13 = FiniteField(13) G = F4.cartesian_product(G13) z = F4('z') @@ -3805,9 +3805,9 @@ def DM_56_8_1(): sage: _ = designs.difference_matrix(56,8) """ from sage.rings.finite_rings.finite_field_constructor import FiniteField - F8 = FiniteField(8,'z') - F7 = FiniteField(7) - G = F8.cartesian_product(F7) + F8 = FiniteField(8,'z') + F7 = FiniteField(7) + G = F8.cartesian_product(F7) w = F8.primitive_element() assert w**3 == w+1 @@ -3936,7 +3936,7 @@ def DM_75_8_1(): F3 = FiniteField(3) F5 = FiniteField(5) - G = cartesian_product((F3,F5,F5)) + G = cartesian_product((F3,F5,F5)) M = [ [(2,0,0), (0,0,0), (0,0,0), (1,0,0), (0,0,0), (1,0,0), (1,0,0), (0,0,0)], @@ -4121,7 +4121,7 @@ def RBIBD_120_8_1(): BIBD = new_BIBD r = {v:i for i,v in enumerate(x for x in range(n) if x not in hyperoval)} - BIBD = [[r[x] for x in B] for B in BIBD ] + BIBD = [[r[x] for x in B] for B in BIBD ] equiv = [[r[x] for x in B] for B in equiv] BIBD = IncidenceStructure(range(255),BIBD) @@ -5008,13 +5008,13 @@ def BIBD_56_11_2(): for k in sorted(EDS)) __doc__ = __doc__.format( - LIST_OF_OA_CONSTRUCTIONS = LIST_OF_OA_CONSTRUCTIONS, + LIST_OF_OA_CONSTRUCTIONS = LIST_OF_OA_CONSTRUCTIONS, LIST_OF_MOLS_CONSTRUCTIONS = LIST_OF_MOLS_CONSTRUCTIONS, - LIST_OF_VMT_VECTORS = LIST_OF_VMT_VECTORS, - LIST_OF_BIBD = LIST_OF_BIBD, - LIST_OF_DF = LIST_OF_DF, - LIST_OF_DM = LIST_OF_DM, - LIST_OF_QDM = LIST_OF_QDM, - LIST_OF_EDS = LIST_OF_EDS) + LIST_OF_VMT_VECTORS = LIST_OF_VMT_VECTORS, + LIST_OF_BIBD = LIST_OF_BIBD, + LIST_OF_DF = LIST_OF_DF, + LIST_OF_DM = LIST_OF_DM, + LIST_OF_QDM = LIST_OF_QDM, + LIST_OF_EDS = LIST_OF_EDS) del LIST_OF_OA_CONSTRUCTIONS, LIST_OF_MOLS_CONSTRUCTIONS, LIST_OF_VMT_VECTORS,LIST_OF_DF, LIST_OF_DM, LIST_OF_QDM, LIST_OF_EDS, LIST_OF_BIBD del PolynomialRing, ZZ, a, diff --git a/src/sage/combinat/designs/difference_family.py b/src/sage/combinat/designs/difference_family.py index b486183cf6c..18dfcbf9fd4 100644 --- a/src/sage/combinat/designs/difference_family.py +++ b/src/sage/combinat/designs/difference_family.py @@ -270,7 +270,7 @@ def is_difference_family(G, D, v=None, k=None, l=None, verbose=False): # Check that every x \in G-{0},occurs exactly l times as a difference counter = {g: 0 for g in Glist} - where = {g: set() for g in Glist} + where = {g: set() for g in Glist} del counter[identity] for i,d in enumerate(D): @@ -296,7 +296,7 @@ def is_difference_family(G, D, v=None, k=None, l=None, verbose=False): counter[gg] += tmp_counter[gg]//stabi # Check the counter and report any error - too_few = [] + too_few = [] too_much = [] for g in Glist: if g == identity: diff --git a/src/sage/combinat/designs/difference_matrices.py b/src/sage/combinat/designs/difference_matrices.py index 9e27b4688c4..6d609fc94f4 100644 --- a/src/sage/combinat/designs/difference_matrices.py +++ b/src/sage/combinat/designs/difference_matrices.py @@ -232,8 +232,8 @@ def difference_matrix(g,k,lmbda=1,existence=False,check=True): k = g elif existence: return True - F = FiniteField(g,'x') - F_set = list(F) + F = FiniteField(g,'x') + F_set = list(F) F_k_set = F_set[:k] G = F diff --git a/src/sage/combinat/designs/ext_rep.py b/src/sage/combinat/designs/ext_rep.py index 6b02f95f2ac..cc2f13687a0 100644 --- a/src/sage/combinat/designs/ext_rep.py +++ b/src/sage/combinat/designs/ext_rep.py @@ -45,8 +45,8 @@ from sage.misc.temporary_file import tmp_filename -XML_NAMESPACE = 'http://designtheory.org/xml-namespace' -DTRS_PROTOCOL = '2.0' +XML_NAMESPACE = 'http://designtheory.org/xml-namespace' +DTRS_PROTOCOL = '2.0' # The following string is the file # http://designtheory.org/database/v-b-k/v2-b2-k2.icgsa.txt.bz2 diff --git a/src/sage/combinat/designs/group_divisible_designs.py b/src/sage/combinat/designs/group_divisible_designs.py index b6898358c45..74425c5516f 100644 --- a/src/sage/combinat/designs/group_divisible_designs.py +++ b/src/sage/combinat/designs/group_divisible_designs.py @@ -114,8 +114,8 @@ def group_divisible_design(v,K,G,existence=False,check=False): return GDD_4_2(v//2,check=check) # From a TD(k,g) - elif (len(G) == 1 and - len(K) == 1 and + elif (len(G) == 1 and + len(K) == 1 and K[0]*G[0] == v): from .orthogonal_arrays import transversal_design return transversal_design(k=K[0],n=G[0],existence=existence) @@ -127,7 +127,7 @@ def group_divisible_design(v,K,G,existence=False,check=False): G = G, K = K, check = check, - copy = True) + copy = True) if existence: return Unknown @@ -195,10 +195,10 @@ def GDD_4_2(q,existence=False,check=True): return GroupDivisibleDesign(2*q, groups = [[i,i+1] for i in range(0,2*q,2)], blocks = sum(classes,[]), - K = [4], - G = [2], - check = check, - copy = False) + K = [4], + G = [2], + check = check, + copy = False) class GroupDivisibleDesign(IncidenceStructure): r""" diff --git a/src/sage/combinat/designs/latin_squares.py b/src/sage/combinat/designs/latin_squares.py index 9daa508e07d..4dea7cd63d7 100644 --- a/src/sage/combinat/designs/latin_squares.py +++ b/src/sage/combinat/designs/latin_squares.py @@ -513,8 +513,8 @@ def MOLS_table(start,stop=None,compare=False,width=None): start,stop = 0,start # make start and stop be congruent to 0 mod 20 start = start - (start%20) - stop = stop-1 - stop = stop + (20-(stop%20)) + stop = stop-1 + stop = stop + (20-(stop%20)) assert start%20 == 0 and stop%20 == 0 if stop <= start: return diff --git a/src/sage/combinat/designs/orthogonal_arrays.py b/src/sage/combinat/designs/orthogonal_arrays.py index 388a3a777cc..f561491df7e 100644 --- a/src/sage/combinat/designs/orthogonal_arrays.py +++ b/src/sage/combinat/designs/orthogonal_arrays.py @@ -1227,10 +1227,10 @@ def incomplete_orthogonal_array(k,n,holes,resolvable=False, existence=False): if not holes: return orthogonal_array(k,n,existence=existence,resolvable=resolvable) - sum_of_holes = sum(holes) + sum_of_holes = sum(holes) number_of_holes = len(holes) - max_hole = max(holes) - min_hole = min(holes) + max_hole = max(holes) + min_hole = min(holes) if sum_of_holes > n: if existence: @@ -1362,7 +1362,7 @@ def incomplete_orthogonal_array(k,n,holes,resolvable=False, existence=False): if uu == sum_of_holes and mu <= 1 and lmbda == 1 and k <= kk + 1: break G,M = f() - OA = OA_from_quasi_difference_matrix(M,G,fill_hole=False) + OA = OA_from_quasi_difference_matrix(M,G,fill_hole=False) return [B[:k] for B in OA] # Equal holes [h,h,...] with h>1 through OA product construction @@ -1375,7 +1375,7 @@ def incomplete_orthogonal_array(k,n,holes,resolvable=False, existence=False): incomplete_orthogonal_array(k,n//min_hole,[1]*number_of_holes,existence=True)): # OA(k,n/h)-x.OA(k,1) if existence: return True - h = min_hole + h = min_hole iOA1 = incomplete_orthogonal_array(k,n//holes[0],[1]*number_of_holes) iOA2 = orthogonal_array(k,h) @@ -2088,7 +2088,7 @@ def __init__(self,*args,**kwds): """ raise RuntimeError("This is not a function but a class. You want to call the designs.orthogonal_arrays.* functions") - largest_available_k = staticmethod(largest_available_k) + largest_available_k = staticmethod(largest_available_k) @staticmethod def explain_construction(k,n,t=2): diff --git a/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py b/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py index fad25aff6da..c2f2bca5209 100644 --- a/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py +++ b/src/sage/combinat/designs/orthogonal_arrays_build_recursive.py @@ -724,11 +724,11 @@ def thwart_lemma_3_5(k,n,m,a,b,c,d=0,complement=False,explain_construction=False assert n - len(third_complement) >= c # The keepers - first_set = list(range(a)) + first_set = list(range(a)) second_set = list(range(b)) - third_set = [x for x in range(n) if x not in third_complement][:c] + third_set = [x for x in range(n) if x not in third_complement][:c] - last_sets = [first_set, second_set, third_set] + last_sets = [first_set, second_set, third_set] if complement: last_sets = [set(range(n)).difference(s) for s in last_sets] @@ -1109,7 +1109,7 @@ def product_with_parallel_classes(OA1,k,g1,g2,g1_parall,parall,check=True): # Leftover blocks become parallel classes. We must split them into slices of # length n3 - OA3_parall = [OA3[i:i+n3] for i in range(len(OA3_n1_parall)*n1*n3, len(OA3), n3)] + OA3_parall = [OA3[i:i+n3] for i in range(len(OA3_n1_parall)*n1*n3, len(OA3), n3)] # First product: OA1 and OA3 n1_parall, parall = product_with_parallel_classes(OA1,k,n1,n3,OA3_n1_parall,OA3_parall,check=check) @@ -1470,7 +1470,7 @@ def brouwer_separable_design(k,t,q,x,check=False,verbose=False,explain_construct e2 = int(x != 1) e3 = int(x != q**2) e4 = int(x != t+q+1) - N = t*N1+x + N = t*N1+x # i) if x == 0: diff --git a/src/sage/combinat/designs/resolvable_bibd.py b/src/sage/combinat/designs/resolvable_bibd.py index 944a1b6d4a7..e9de2d9a7cf 100644 --- a/src/sage/combinat/designs/resolvable_bibd.py +++ b/src/sage/combinat/designs/resolvable_bibd.py @@ -257,9 +257,9 @@ def kirkman_triple_system(v,existence=False): a = K.primitive_element() t = (q - 1) // 6 A0 = [(0,0),(0,1),(0,2)] - B = [[(a**i,j),(a**(i+2*t),j),(a**(i+4*t),j)] for j in range(3) + B = [[(a**i,j),(a**(i+2*t),j),(a**(i+4*t),j)] for j in range(3) for i in range(t)] - A = [[(a**i,0),(a**(i+2*t),1),(a**(i+4*t),2)] for i in range(6*t)] + A = [[(a**i,0),(a**(i+2*t),1),(a**(i+4*t),2)] for i in range(6*t)] # Action of K on the points action = lambda v,x: (v+x[0],x[1]) @@ -269,7 +269,7 @@ def kirkman_triple_system(v,existence=False): for i,p in enumerate(K) for j in range(3)} - B0 = [A0] + B + A[t:2*t] + A[3*t:4*t] + A[5*t:6*t] + B0 = [A0] + B + A[t:2*t] + A[3*t:4*t] + A[5*t:6*t] # Classes classes = [[[relabel[action(p,x)] for x in tr] for tr in B0] @@ -559,7 +559,7 @@ def PBD_4_7(v,check=True, existence=False): from .group_divisible_designs import group_divisible_design from .orthogonal_arrays import transversal_design GDD = group_divisible_design(3*5,K=[4],G=[3],check=False) - TD = transversal_design(5,5) + TD = transversal_design(5,5) # A (75,{4},{15})-GDD GDD2 = [[3*B[x//3]+x%3 for x in BB] for B in TD for BB in GDD] diff --git a/src/sage/combinat/designs/steiner_quadruple_systems.py b/src/sage/combinat/designs/steiner_quadruple_systems.py index ee8d8102f28..a4be443cc04 100644 --- a/src/sage/combinat/designs/steiner_quadruple_systems.py +++ b/src/sage/combinat/designs/steiner_quadruple_systems.py @@ -511,7 +511,7 @@ def P(alpha, m): return [(2*a, (2*a - 2*b - 1)%(2*m)) for a in range(m)] else: y = alpha - m - pairs = [(b,(2*y-b)%(2*m)) for b in range(y)] + pairs = [(b,(2*y-b)%(2*m)) for b in range(y)] pairs += [(c,(2*m+2*y-c-2)%(2*m)) for c in range(2*y+1,m+y-1)] pairs += [(2*m+int(-1.5-.5*(-1)**y),y),(2*m+int(-1.5+.5*(-1)**y),m+y-1)] return pairs @@ -525,7 +525,7 @@ def P(alpha, m): return [(2*a,(2*a-2*b-1)%(2*m)) for a in range(m)] else: y = alpha-m+1 - pairs = [(b,2*y-b) for b in range(y)] + pairs = [(b,2*y-b) for b in range(y)] pairs += [(c,2*m+2*y-c) for c in range(2*y+1,m+y)] pairs += [(y,m+y)] return pairs diff --git a/src/sage/combinat/ncsf_qsym/qsym.py b/src/sage/combinat/ncsf_qsym/qsym.py index 8bdef2fa7dd..9169e38e1d1 100644 --- a/src/sage/combinat/ncsf_qsym/qsym.py +++ b/src/sage/combinat/ncsf_qsym/qsym.py @@ -564,10 +564,10 @@ def __init__(self, R): Parent.__init__(self, category = category.WithRealizations()) # Bases - Monomial = self.Monomial() + Monomial = self.Monomial() Fundamental = self.Fundamental() dualImmaculate = self.dualImmaculate() - QS = self.Quasisymmetric_Schur() + QS = self.Quasisymmetric_Schur() # Change of bases Fundamental.module_morphism(Monomial.sum_of_finer_compositions, diff --git a/src/sage/combinat/root_system/cartan_type.py b/src/sage/combinat/root_system/cartan_type.py index 825fc95ee16..6c89e131c9d 100644 --- a/src/sage/combinat/root_system/cartan_type.py +++ b/src/sage/combinat/root_system/cartan_type.py @@ -1736,7 +1736,7 @@ def symmetrizer(self): n = m.nrows() M = matrix(ZZ, n, n*n, sparse = True) for (i,j) in m.nonzero_positions(): - M[i, n * i + j] = m[i,j] + M[i, n * i + j] = m[i,j] M[j, n * i + j] -= m[j,i] kern = M.integer_kernel() c = len(self.dynkin_diagram().connected_components()) diff --git a/src/sage/combinat/root_system/extended_affine_weyl_group.py b/src/sage/combinat/root_system/extended_affine_weyl_group.py index f4a2e54a88e..87fe3399169 100644 --- a/src/sage/combinat/root_system/extended_affine_weyl_group.py +++ b/src/sage/combinat/root_system/extended_affine_weyl_group.py @@ -485,7 +485,7 @@ def __init__(self, cartan_type, general_linear, **print_options): self._prefixcl = "s" self._ct0 = cartan_type.classical() - self._R0 = self._ct0.root_system() + self._R0 = self._ct0.root_system() self._I0 = self._ct0.index_set() self._ct0v = self._ct0.dual() self._R0v = self._ct0v.root_system() diff --git a/src/sage/combinat/root_system/pieri_factors.py b/src/sage/combinat/root_system/pieri_factors.py index 106b5e0efd8..14d78e3b3f4 100644 --- a/src/sage/combinat/root_system/pieri_factors.py +++ b/src/sage/combinat/root_system/pieri_factors.py @@ -731,7 +731,7 @@ def __getitem__(self, support): """ index_set = sorted(self.W.index_set()) - support = sorted(support) + support = sorted(support) if not set(support).issubset(set(index_set)) or support == index_set: raise ValueError("the support must be a proper subset of the index set") if not support: diff --git a/src/sage/combinat/root_system/plot.py b/src/sage/combinat/root_system/plot.py index ce3cce65ef4..ee23f9fe836 100644 --- a/src/sage/combinat/root_system/plot.py +++ b/src/sage/combinat/root_system/plot.py @@ -1393,8 +1393,8 @@ def cone(self, rays=[], lines=[], color="black", thickness=1, alpha=1, wireframe if self.level: old_rays = rays vertices = [self.intersection_at_level_1(ray) for ray in old_rays if ray.level() > 0] - rays = [ray for ray in old_rays if ray.level() == 0] - rays += [vertex - self.intersection_at_level_1(ray) for ray in old_rays if ray.level() < 0 for vertex in vertices] + rays = [ray for ray in old_rays if ray.level() == 0] + rays += [vertex - self.intersection_at_level_1(ray) for ray in old_rays if ray.level() < 0 for vertex in vertices] else: vertices = [] diff --git a/src/sage/combinat/root_system/reflection_group_real.py b/src/sage/combinat/root_system/reflection_group_real.py index 9d7c9a92bbf..7591f283adf 100644 --- a/src/sage/combinat/root_system/reflection_group_real.py +++ b/src/sage/combinat/root_system/reflection_group_real.py @@ -271,7 +271,7 @@ def __init__(self, W_types, index_set=None, hyperplane_index_set=None, reflectio cls = IrreducibleComplexReflectionGroup else: cls = ComplexReflectionGroup - cls.__init__(self, W_types, index_set = index_set, + cls.__init__(self, W_types, index_set = index_set, hyperplane_index_set = hyperplane_index_set, reflection_index_set = reflection_index_set) diff --git a/src/sage/combinat/root_system/root_lattice_realizations.py b/src/sage/combinat/root_system/root_lattice_realizations.py index fb63471ffb0..d1f24de2d90 100644 --- a/src/sage/combinat/root_system/root_lattice_realizations.py +++ b/src/sage/combinat/root_system/root_lattice_realizations.py @@ -1900,7 +1900,7 @@ def _classical_alpha_0(self): sage: L.classical().highest_root() 2*alpha[1] + 2*alpha[2] + alpha[3] """ - cartan_type = self.cartan_type() + cartan_type = self.cartan_type() special_node = cartan_type.special_node() a = self.cartan_type().col_annihilator() classical = self.classical() diff --git a/src/sage/combinat/root_system/type_A.py b/src/sage/combinat/root_system/type_A.py index e48524ffbcc..c1134668507 100644 --- a/src/sage/combinat/root_system/type_A.py +++ b/src/sage/combinat/root_system/type_A.py @@ -335,7 +335,7 @@ def ascii_art(self, label=lambda i: i, node=None): return "" if node is None: node = self._ascii_art_node - ret = "---".join(node(label(i)) for i in range(1,n+1)) + "\n" + ret = "---".join(node(label(i)) for i in range(1,n+1)) + "\n" ret += "".join("{!s:4}".format(label(i)) for i in range(1,n+1)) return ret diff --git a/src/sage/combinat/root_system/type_A_affine.py b/src/sage/combinat/root_system/type_A_affine.py index e5fc4d00935..c287ae98f7e 100644 --- a/src/sage/combinat/root_system/type_A_affine.py +++ b/src/sage/combinat/root_system/type_A_affine.py @@ -187,7 +187,7 @@ def ascii_art(self, label=lambda i: i, node=None): l0 = label(0) l1 = label(1) return "{}<=>{}\n{!s:4}{}".format(node(l0), node(l1), l0, l1) - ret = "{}\n{}".format(label(0), node(label(0))) + ret = "{}\n{}".format(label(0), node(label(0))) ret += "----"*(n-2) + "---+\n|" + " "*(n-2) + " |\n|" + " "*(n-2) + " |\n" ret += "---".join(node(label(i)) for i in range(1,n+1)) + "\n" ret += "".join("{!s:4}".format(label(i)) for i in range(1,n+1)) diff --git a/src/sage/combinat/root_system/type_B_affine.py b/src/sage/combinat/root_system/type_B_affine.py index fd709894a6e..ecf30bc226d 100644 --- a/src/sage/combinat/root_system/type_B_affine.py +++ b/src/sage/combinat/root_system/type_B_affine.py @@ -192,7 +192,7 @@ def ascii_art(self, label=lambda i: i, node=None): return CartanType(["A",1,1]).ascii_art(label, node) if n == 2: return CartanType(["C",2,1]).relabel({0:0, 1:2, 2:1}).ascii_art(label, node) - ret = " {} {}\n |\n |\n".format(node(label(0)), label(0)) + ret = " {} {}\n |\n |\n".format(node(label(0)), label(0)) ret += "---".join(node(label(i)) for i in range(1,n)) + "=>={}\n".format(node(label(n))) ret += "".join("{!s:4}".format(label(i)) for i in range(1,n+1)) return ret diff --git a/src/sage/combinat/root_system/type_D.py b/src/sage/combinat/root_system/type_D.py index d250a3643b6..94880f6e2c8 100644 --- a/src/sage/combinat/root_system/type_D.py +++ b/src/sage/combinat/root_system/type_D.py @@ -341,8 +341,8 @@ def ascii_art(self, label=lambda i: i, node=None): if n == 2: ret = "{} {}\n".format(node(label(1)), node(label(2))) return ret + "{!s:4}{!s:4}".format(label(1), label(2)) - ret = (4*(n-3))*" "+"{} {}\n".format(node(label(n)), label(n)) - ret += ((4*(n-3))*" " +"|\n")*2 + ret = (4*(n-3))*" "+"{} {}\n".format(node(label(n)), label(n)) + ret += ((4*(n-3))*" " +"|\n")*2 ret += "---".join(node(label(i)) for i in range(1, n)) +"\n" ret += "".join("{!s:4}".format(label(i)) for i in range(1,n)) return ret diff --git a/src/sage/combinat/root_system/type_affine.py b/src/sage/combinat/root_system/type_affine.py index 5ce62dfb7be..b24f2d2afa5 100644 --- a/src/sage/combinat/root_system/type_affine.py +++ b/src/sage/combinat/root_system/type_affine.py @@ -347,7 +347,7 @@ def simple_root(self, i): - :meth:`CartanType.col_annihilator` - :meth:`null_root` """ - cartan_type = self.cartan_type() + cartan_type = self.cartan_type() special_node = cartan_type.special_node() if i == special_node: return self(self._classical_alpha_0()) + self.monomial("delta") diff --git a/src/sage/combinat/root_system/type_super_A.py b/src/sage/combinat/root_system/type_super_A.py index c014dfa7ee5..9eda2eeeee5 100644 --- a/src/sage/combinat/root_system/type_super_A.py +++ b/src/sage/combinat/root_system/type_super_A.py @@ -815,7 +815,7 @@ def ascii_art(self, label=lambda i: i, node=None): """ if node is None: node = lambda i: 'O' - ret = "---".join(node(label(i)) for i in range(1,self.m+1)) + ret = "---".join(node(label(i)) for i in range(1,self.m+1)) if self.m == 0: if self.n == 0: ret = "X" diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index a833b1f5d81..9082586c453 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -2245,12 +2245,12 @@ def _invert_morphism(self, n, base_ring, self_to_other_cache, other_to_self_cach #Decide whether we know how to go from self to other or #from other to self if to_other_function is not None: - known_cache = self_to_other_cache #the known direction - unknown_cache = other_to_self_cache #the unknown direction + known_cache = self_to_other_cache #the known direction + unknown_cache = other_to_self_cache #the unknown direction known_function = to_other_function else: - unknown_cache = self_to_other_cache #the known direction - known_cache = other_to_self_cache #the unknown direction + unknown_cache = self_to_other_cache #the known direction + known_cache = other_to_self_cache #the unknown direction known_function = to_self_function #Do nothing if we've already computed the inverse @@ -2264,7 +2264,7 @@ def _invert_morphism(self, n, base_ring, self_to_other_cache, other_to_self_cach #should use that. #Zt = ZZ['t'] #t = Zt.gen() - one = base_ring.one() + one = base_ring.one() zero = base_ring.zero() #Get and store the list of partitions we'll need diff --git a/src/sage/combinat/species/empty_species.py b/src/sage/combinat/species/empty_species.py index a6eb69597bc..e66019360ac 100644 --- a/src/sage/combinat/species/empty_species.py +++ b/src/sage/combinat/species/empty_species.py @@ -113,7 +113,7 @@ def _gs(self, series_ring, base_ring): return series_ring.zero() _itgs = _gs - _cis = _gs + _cis = _gs def _structures(self, structure_class, labels): """ diff --git a/src/sage/finance/easter.py b/src/sage/finance/easter.py index 6c69f1d34ec..3e73b60bf09 100644 --- a/src/sage/finance/easter.py +++ b/src/sage/finance/easter.py @@ -11,9 +11,9 @@ __all__ = ["easter", "EASTER_JULIAN", "EASTER_ORTHODOX", "EASTER_WESTERN"] -EASTER_JULIAN = 1 +EASTER_JULIAN = 1 EASTER_ORTHODOX = 2 -EASTER_WESTERN = 3 +EASTER_WESTERN = 3 def easter(year, algorithm=EASTER_WESTERN): diff --git a/src/sage/finance/markov_multifractal.py b/src/sage/finance/markov_multifractal.py index 6206f56b304..36d386b8d86 100644 --- a/src/sage/finance/markov_multifractal.py +++ b/src/sage/finance/markov_multifractal.py @@ -200,15 +200,15 @@ def gamma(self): except AttributeError: pass - b = self.__b + b = self.__b gamma_kbar = self.__gamma_kbar - kbar = self.__kbar + kbar = self.__kbar # We compute gamma1 from gamma_kbar by inverting the relation # that defines the gamma_k given on page 54 of Calvet-Fisher: gamma1 = 1 - math.exp(math.log(1-gamma_kbar)/(b**(kbar-1))) - gamma = tuple([1 - (1 - gamma1)**(b**k) for k in range(kbar)]) + gamma = tuple([1 - (1 - gamma1)**(b**k) for k in range(kbar)]) self.__gamma = gamma return gamma diff --git a/src/sage/functions/transcendental.py b/src/sage/functions/transcendental.py index b76e3a1bbbe..2511d47f13e 100644 --- a/src/sage/functions/transcendental.py +++ b/src/sage/functions/transcendental.py @@ -444,7 +444,7 @@ def zeta_symmetric(s): if s == 1: # deal with poles, hopefully return R(0.5) - return (s/2 + 1).gamma() * (s-1) * (R.pi()**(-s/2)) * s.zeta() + return (s/2 + 1).gamma() * (s-1) * (R.pi()**(-s/2)) * s.zeta() import math from sage.rings.polynomial.polynomial_real_mpfr_dense import PolynomialRealDense diff --git a/src/sage/games/sudoku.py b/src/sage/games/sudoku.py index 4731b9bc517..e732fc66026 100644 --- a/src/sage/games/sudoku.py +++ b/src/sage/games/sudoku.py @@ -829,16 +829,16 @@ def dlx(self, count_only=False): # Boxes of the grid are numbered in row-major order # ``rcbox`` simply maps a row-column index pair to the box number it lives in - rcbox = [ [i//n + n*(j//n) for i in range(nsquare)] for j in range(nsquare)] + rcbox = [ [i//n + n*(j//n) for i in range(nsquare)] for j in range(nsquare)] # Every entry in a Sudoku puzzle satisfies four constraints # Every location has a single entry, and each row, column and box has each symbol once # These arrays can be thought of as assigning ID numbers to these constraints, # and correspond to column numbers of the `0-1` matrix describing the exact cover - rows = [[i+j for i in range(nsquare)] for j in range(0, nfour, nsquare)] - cols = [[i+j for i in range(nsquare)] for j in range(nfour, 2*nfour, nsquare)] - boxes = [[i+j for i in range(nsquare)] for j in range(2*nfour, 3*nfour, nsquare)] - rowcol = [[i+j for i in range(nsquare)] for j in range(3*nfour, 4*nfour, nsquare)] + rows = [[i+j for i in range(nsquare)] for j in range(0, nfour, nsquare)] + cols = [[i+j for i in range(nsquare)] for j in range(nfour, 2*nfour, nsquare)] + boxes = [[i+j for i in range(nsquare)] for j in range(2*nfour, 3*nfour, nsquare)] + rowcol = [[i+j for i in range(nsquare)] for j in range(3*nfour, 4*nfour, nsquare)] def make_row(row, col, entry): r""" diff --git a/src/sage/geometry/cone.py b/src/sage/geometry/cone.py index 1b0a74d9111..7e1e2355f22 100644 --- a/src/sage/geometry/cone.py +++ b/src/sage/geometry/cone.py @@ -6566,19 +6566,19 @@ def random_cone(lattice=None, min_ambient_dim=0, max_ambient_dim=None, # The next three checks prevent an infinite loop (a futile # search for more rays) in zero, one, or two dimensions. if min_rays > 4 and max_ambient_dim < 3: - msg = 'all cones in zero/one/two dimensions have four or fewer ' + msg = 'all cones in zero/one/two dimensions have four or fewer ' msg += 'generators. Please increase max_ambient_dim to at least ' msg += '3, or decrease min_rays.' raise ValueError(msg) if min_rays > 2 and max_ambient_dim < 2: - msg = 'all cones in zero/one dimensions have two or fewer ' + msg = 'all cones in zero/one dimensions have two or fewer ' msg += 'generators. Please increase max_ambient_dim to at least ' msg += '2, or decrease min_rays.' raise ValueError(msg) if min_rays > 0 and max_ambient_dim == 0: - msg = 'all cones in zero dimensions have no generators. ' + msg = 'all cones in zero dimensions have no generators. ' msg += 'Please increase max_ambient_dim to at least 1, or ' msg += 'decrease min_rays.' raise ValueError(msg) @@ -6593,17 +6593,17 @@ def random_cone(lattice=None, min_ambient_dim=0, max_ambient_dim=None, # using its dimension rather than max_ambient_dim as the indicator. if lattice is not None: if min_rays > 4 and lattice.dimension() < 3: - msg = 'all cones in the given lattice have four or fewer ' + msg = 'all cones in the given lattice have four or fewer ' msg += 'generators. Please decrease min_rays.' raise ValueError(msg) if min_rays > 2 and lattice.dimension() < 2: - msg = 'all cones in the given lattice have two or fewer ' + msg = 'all cones in the given lattice have two or fewer ' msg += 'generators. Please decrease min_rays.' raise ValueError(msg) if min_rays > 0 and lattice.dimension() == 0: - msg = 'all cones in the given lattice have no generators. ' + msg = 'all cones in the given lattice have no generators. ' msg += 'Please decrease min_rays.' raise ValueError(msg) @@ -6613,7 +6613,7 @@ def random_cone(lattice=None, min_ambient_dim=0, max_ambient_dim=None, msg = 'all cones in this lattice are strictly convex (trivial).' raise ValueError(msg) if max_rays is not None and max_rays < 2: - msg = 'all cones are strictly convex when ``max_rays`` is ' + msg = 'all cones are strictly convex when ``max_rays`` is ' msg += 'less than two.' raise ValueError(msg) diff --git a/src/sage/geometry/hyperplane_arrangement/arrangement.py b/src/sage/geometry/hyperplane_arrangement/arrangement.py index 2874eb57409..bed0fa2a7c4 100644 --- a/src/sage/geometry/hyperplane_arrangement/arrangement.py +++ b/src/sage/geometry/hyperplane_arrangement/arrangement.py @@ -1934,7 +1934,7 @@ def regions(self): # In this case, at least one of the vertices is not on the hyperplane. # So we check if any ray or line pokes the hyperplane. if ( any(ieq[1:]*r[:]*direction < 0 for r in region.rays()) or - any(ieq[1:]*l[:] != 0 for l in region_lines)): + any(ieq[1:]*l[:] != 0 for l in region_lines)): splits = True if splits: diff --git a/src/sage/geometry/polyhedron/backend_cdd_rdf.py b/src/sage/geometry/polyhedron/backend_cdd_rdf.py index 2f3795a4b0f..2d9e5359425 100644 --- a/src/sage/geometry/polyhedron/backend_cdd_rdf.py +++ b/src/sage/geometry/polyhedron/backend_cdd_rdf.py @@ -204,7 +204,7 @@ def try_init(rep): from warnings import catch_warnings, simplefilter vertices, rays, lines = (tuple(x) for x in Vrep) - ieqs, eqns = (tuple(x) for x in Hrep) + ieqs, eqns = (tuple(x) for x in Hrep) if not (vertices or rays or lines): # cdd refuses to handle empty polyhedra. @@ -214,7 +214,7 @@ def try_init(rep): # We prefer the shorter representation. # Note that for the empty polyhedron we prefer Hrepresentation. prim = "Hrep" if len(ieqs) <= len(vertices) + len(rays) else "Vrep" - sec = "Vrep" if len(ieqs) <= len(vertices) + len(rays) else "Hrep" + sec = "Vrep" if len(ieqs) <= len(vertices) + len(rays) else "Hrep" with catch_warnings(): # Raise an error and try the other representation in case of diff --git a/src/sage/geometry/polyhedron/cdd_file_format.py b/src/sage/geometry/polyhedron/cdd_file_format.py index 78fd01787b7..4388f2ecb0b 100644 --- a/src/sage/geometry/polyhedron/cdd_file_format.py +++ b/src/sage/geometry/polyhedron/cdd_file_format.py @@ -50,8 +50,8 @@ def cdd_Vrepresentation(cdd_type, vertices, rays, lines, file_output=None): sage: cdd_Vrepresentation('rational', [[0,0]], [[1,0]], [[0,1]], file_output=filename) """ vertices = _set_to_None_if_empty(vertices) - rays = _set_to_None_if_empty(rays) - lines = _set_to_None_if_empty(lines) + rays = _set_to_None_if_empty(rays) + lines = _set_to_None_if_empty(lines) num, ambient_dim = _common_length_of(vertices, rays, lines) @@ -115,7 +115,7 @@ def cdd_Hrepresentation(cdd_type, ieqs, eqns, file_output=None): sage: cdd_Hrepresentation('rational', None, [[0,1]], file_output=filename) """ ieqs = _set_to_None_if_empty(ieqs) - eqns = _set_to_None_if_empty(eqns) + eqns = _set_to_None_if_empty(eqns) num, ambient_dim = _common_length_of(ieqs, eqns) ambient_dim -= 1 diff --git a/src/sage/geometry/polyhedron/double_description.py b/src/sage/geometry/polyhedron/double_description.py index c1c94a9b8f9..e8aad9bcd29 100644 --- a/src/sage/geometry/polyhedron/double_description.py +++ b/src/sage/geometry/polyhedron/double_description.py @@ -147,7 +147,7 @@ def __init__(self, problem, A_rows, R_cols): self.problem = problem self.A = list(A_rows) self.R = list(R_cols) - self.one = problem._field.one() + self.one = problem._field.one() self.zero = problem._field.zero() # a cache for scalar products (see the method zero_set) diff --git a/src/sage/geometry/toric_lattice.py b/src/sage/geometry/toric_lattice.py index 7f1665ee79a..ce5817c991a 100644 --- a/src/sage/geometry/toric_lattice.py +++ b/src/sage/geometry/toric_lattice.py @@ -1169,7 +1169,7 @@ def _latex_(self): '\\left\\langle\\left(1,\\,2,\\,3\\right)_{L}, \\left(0,\\,4,\\,8\\right)_{L}\\right\\rangle' """ - s = '\\left\\langle' + s = '\\left\\langle' s += ', '.join([ b._latex_() for b in self.basis() ]) s += '\\right\\rangle' return s diff --git a/src/sage/geometry/toric_plotter.py b/src/sage/geometry/toric_plotter.py index 988c180431a..07aed17663a 100644 --- a/src/sage/geometry/toric_plotter.py +++ b/src/sage/geometry/toric_plotter.py @@ -731,7 +731,7 @@ def set_rays(self, generators): rays = generators elif self.mode == "round": r = self.radius - rays = [r * gen / gen.norm() for gen in generators] + rays = [r * gen / gen.norm() for gen in generators] self.rays = rays diff --git a/src/sage/geometry/triangulation/point_configuration.py b/src/sage/geometry/triangulation/point_configuration.py index 3ad39184f37..a4cea3829cd 100644 --- a/src/sage/geometry/triangulation/point_configuration.py +++ b/src/sage/geometry/triangulation/point_configuration.py @@ -1493,9 +1493,9 @@ def circuits(self): m = matrix([ U[i] for i in support ]).transpose() ker = m.right_kernel().basis()[0] assert len(ker)==len(support) - Cplus = [ support[i] for i in range(len(support)) if ker[i]>0 ] + Cplus = [ support[i] for i in range(len(support)) if ker[i]>0 ] Cminus = [ support[i] for i in range(len(support)) if ker[i]<0 ] - Czero = set( range(n) ).difference(support) + Czero = set( range(n) ).difference(support) Circuits += ( (tuple(Cplus), tuple(Czero), tuple(Cminus)), ) self._circuits = Circuits return Circuits diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 8a95e53d8f8..ce0283aa4b1 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -18762,8 +18762,8 @@ def union(self, other, immutable=None): raise TypeError('both arguments must be of the same class') multiedges = self.allows_multiple_edges() or other.allows_multiple_edges() - loops = self.allows_loops() or other.allows_loops() - weighted = self.weighted() and other.weighted() + loops = self.allows_loops() or other.allows_loops() + weighted = self.weighted() and other.weighted() if self._directed: from sage.graphs.digraph import DiGraph @@ -21015,7 +21015,7 @@ def plot3d(self, bgcolor=(1, 1, 1), """ from . import graph_plot layout_options = {key: kwds[key] for key in kwds.keys() if key in graph_plot.layout_options} - kwds = {key: kwds[key] for key in kwds.keys() if key not in graph_plot.layout_options} + kwds = {key: kwds[key] for key in kwds.keys() if key not in graph_plot.layout_options} if pos3d is None: pos3d = self.layout(dim=3, **layout_options) diff --git a/src/sage/modular/abvar/cuspidal_subgroup.py b/src/sage/modular/abvar/cuspidal_subgroup.py index 2113272d2c4..fe174e6631a 100644 --- a/src/sage/modular/abvar/cuspidal_subgroup.py +++ b/src/sage/modular/abvar/cuspidal_subgroup.py @@ -158,8 +158,8 @@ def _compute_lattice(self, rational_only=False, rational_subgroup=False): """ A = self.abelian_variety() Cusp = A.modular_symbols() - Amb = Cusp.ambient_module() - Eis = Amb.eisenstein_submodule() + Amb = Cusp.ambient_module() + Eis = Amb.eisenstein_submodule() C = Amb.cusps() N = Amb.level() diff --git a/src/sage/modular/arithgroup/arithgroup_generic.py b/src/sage/modular/arithgroup/arithgroup_generic.py index cbad28e64c6..892c8de62d2 100644 --- a/src/sage/modular/arithgroup/arithgroup_generic.py +++ b/src/sage/modular/arithgroup/arithgroup_generic.py @@ -971,7 +971,7 @@ def genus(self): sage: [n for n in [1..200] if Gamma0(n).genus() == 1] [11, 14, 15, 17, 19, 20, 21, 24, 27, 32, 36, 49] """ - return ZZ(1 + (self.projective_index()) / ZZ(12) - (self.nu2())/ZZ(4) - (self.nu3())/ZZ(3) - self.ncusps()/ZZ(2)) + return ZZ(1 + (self.projective_index()) / ZZ(12) - (self.nu2())/ZZ(4) - (self.nu3())/ZZ(3) - self.ncusps()/ZZ(2)) def farey_symbol(self): r""" diff --git a/src/sage/modular/modform/half_integral.py b/src/sage/modular/modform/half_integral.py index 432b4318046..eda22b15916 100644 --- a/src/sage/modular/modform/half_integral.py +++ b/src/sage/modular/modform/half_integral.py @@ -123,18 +123,18 @@ def half_integral_weight_modform_basis(chi, k, prec): psi = chi.parent()(DirichletGroup(4, chi.base_ring()).gen()) eps = chi*psi**((k+1) // 2) eps = eps.minimize_base_ring() - M = constructor.ModularForms(eps, (k+1)//2) - C = M.cuspidal_subspace() - B = C.basis() + M = constructor.ModularForms(eps, (k+1)//2) + C = M.cuspidal_subspace() + B = C.basis() # This computation of S below -- of course --dominates the whole function. S = [f.q_expansion(prec) for f in B] - T2 = theta2_qexp(prec) - T3 = theta_qexp(prec) - n = len(S) - MS = MatrixSpace(M.base_ring(), 2*n, prec) - A = copy(MS.zero_matrix()) + T2 = theta2_qexp(prec) + T3 = theta_qexp(prec) + n = len(S) + MS = MatrixSpace(M.base_ring(), 2*n, prec) + A = copy(MS.zero_matrix()) for i in range(n): T2f = T2*S[i] diff --git a/src/sage/modular/modform/numerical.py b/src/sage/modular/modform/numerical.py index ad52403f471..f096ad53f22 100644 --- a/src/sage/modular/modform/numerical.py +++ b/src/sage/modular/modform/numerical.py @@ -104,7 +104,7 @@ def __init__(self, group, weight=2, eps=1e-20, """ if isinstance(group, (int, Integer)): group = Gamma0(Integer(group)) - self._group = group + self._group = group self._weight = Integer(weight) self._tp = tp if self._weight < 2: diff --git a/src/sage/modular/modform_hecketriangle/abstract_ring.py b/src/sage/modular/modform_hecketriangle/abstract_ring.py index 0ff086c0a60..aa70599f0cc 100644 --- a/src/sage/modular/modform_hecketriangle/abstract_ring.py +++ b/src/sage/modular/modform_hecketriangle/abstract_ring.py @@ -89,17 +89,17 @@ def __init__(self, group, base_ring, red_hom, n): if (base_ring.characteristic() > 0): raise NotImplementedError("only characteristic 0 is supported") - self._group = group - self._red_hom = red_hom - self._base_ring = base_ring - self._coeff_ring = FractionField(PolynomialRing(base_ring,'d')) - self._pol_ring = PolynomialRing(base_ring,'x,y,z,d') - self._rat_field = FractionField(self._pol_ring) + self._group = group + self._red_hom = red_hom + self._base_ring = base_ring + self._coeff_ring = FractionField(PolynomialRing(base_ring,'d')) + self._pol_ring = PolynomialRing(base_ring,'x,y,z,d') + self._rat_field = FractionField(self._pol_ring) # default values - self._weight = None - self._ep = None - self._analytic_type = self.AT(["quasi", "mero"]) + self._weight = None + self._ep = None + self._analytic_type = self.AT(["quasi", "mero"]) self.default_prec(10) self.disp_prec(5) @@ -1947,12 +1947,12 @@ def EisensteinSeries(self, k=None): reduced_self = extended_self.reduce_type(["holo"], degree = (QQ(k), ep)) if (n == infinity): - l2 = ZZ(0) - l1 = ZZ((k-(1-ep)) / ZZ(4)) + l2 = ZZ(0) + l1 = ZZ((k-(1-ep)) / ZZ(4)) else: num = ZZ((k-(1-ep)*n/(n-2)) * (n-2) / ZZ(4)) - l2 = num % n - l1 = ((num-l2)/n).numerator() + l2 = num % n + l1 = ((num-l2)/n).numerator() # If the space is one dimensional we return the normalized generator if l1 == 0: diff --git a/src/sage/modular/modform_hecketriangle/abstract_space.py b/src/sage/modular/modform_hecketriangle/abstract_space.py index 3d30e8495b2..a6141f4067a 100644 --- a/src/sage/modular/modform_hecketriangle/abstract_space.py +++ b/src/sage/modular/modform_hecketriangle/abstract_space.py @@ -959,22 +959,22 @@ def Faber_pol(self, m, order_1=ZZ(0), fix_d = False, d_num_prec = None): if (m > order_inf): raise ValueError("Invalid basis index: m = {} > {} = order_inf!".format(m, order_inf)) - prec = 2*order_inf - m + 1 - d = self.get_d(fix_d=fix_d, d_num_prec=d_num_prec) - q = self.get_q(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) + prec = 2*order_inf - m + 1 + d = self.get_d(fix_d=fix_d, d_num_prec=d_num_prec) + q = self.get_q(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) - simple_qexp = self.F_simple(order_1=order_1).q_expansion(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) - J_qexp = self.J_inv().q_expansion(prec=order_inf - m, fix_d=fix_d, d_num_prec=d_num_prec) + simple_qexp = self.F_simple(order_1=order_1).q_expansion(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) + J_qexp = self.J_inv().q_expansion(prec=order_inf - m, fix_d=fix_d, d_num_prec=d_num_prec) # The precision could be infinity, otherwise we could do this: #assert(temp_reminder.prec() == 1) temp_reminder = (1 / simple_qexp / q**(-m)).add_bigoh(1) - fab_pol = q.parent()([]) + fab_pol = q.parent()([]) while (len(temp_reminder.coefficients()) > 0): - temp_coeff = temp_reminder.coefficients()[0] - temp_exp = -temp_reminder.exponents()[0] - fab_pol += temp_coeff * (q/d)**temp_exp + temp_coeff = temp_reminder.coefficients()[0] + temp_exp = -temp_reminder.exponents()[0] + fab_pol += temp_coeff * (q/d)**temp_exp temp_reminder -= temp_coeff * (J_qexp/d)**temp_exp # The first term is zero only up to numerical errors, @@ -1101,22 +1101,22 @@ def faber_pol(self, m, order_1=ZZ(0), fix_d = False, d_num_prec = None): if (m > order_inf): raise ValueError("Invalid basis index: m = {} > {} = order_inf!".format(m, order_inf)) - prec = 2*order_inf - m + 1 - d = self.get_d(fix_d=fix_d, d_num_prec=d_num_prec) - q = self.get_q(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) + prec = 2*order_inf - m + 1 + d = self.get_d(fix_d=fix_d, d_num_prec=d_num_prec) + q = self.get_q(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) - simple_qexp = self.F_simple(order_1=order_1).q_expansion(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) - j_qexp = self.j_inv().q_expansion(prec=order_inf - m, fix_d=fix_d, d_num_prec=d_num_prec) + simple_qexp = self.F_simple(order_1=order_1).q_expansion(prec=prec, fix_d=fix_d, d_num_prec=d_num_prec) + j_qexp = self.j_inv().q_expansion(prec=order_inf - m, fix_d=fix_d, d_num_prec=d_num_prec) # The precision could be infinity, otherwise we could do this: #assert(temp_reminder.prec() == 1) temp_reminder = (1 / simple_qexp / q**(-m)).add_bigoh(1) - fab_pol = q.parent()([]) + fab_pol = q.parent()([]) while (len(temp_reminder.coefficients()) > 0): - temp_coeff = temp_reminder.coefficients()[0] - temp_exp = -temp_reminder.exponents()[0] - fab_pol += temp_coeff*q**temp_exp + temp_coeff = temp_reminder.coefficients()[0] + temp_exp = -temp_reminder.exponents()[0] + fab_pol += temp_coeff*q**temp_exp temp_reminder -= temp_coeff*j_qexp**temp_exp # The first term is zero only up to numerical errors, @@ -1214,17 +1214,17 @@ def F_basis_pol(self, m, order_1=ZZ(0)): n = self._group.n() if (n ==infinity): - order_1 = ZZ(order_1) + order_1 = ZZ(order_1) order_inf = self._l1 - order_1 - finf_pol = d*(x-y**2) - jinv_pol = x/(x-y**2) - rat = finf_pol**order_inf * x**order_1 * y**(ZZ(1-self._ep)/ZZ(2)) * self.Faber_pol(m, order_1)(jinv_pol) + finf_pol = d*(x-y**2) + jinv_pol = x/(x-y**2) + rat = finf_pol**order_inf * x**order_1 * y**(ZZ(1-self._ep)/ZZ(2)) * self.Faber_pol(m, order_1)(jinv_pol) else: order_inf = self._l1 - order_1 = order_inf - finf_pol = d*(x**n-y**2) - jinv_pol = x**n/(x**n-y**2) - rat = finf_pol**order_inf * x**self._l2 * y**(ZZ(1-self._ep)/ZZ(2)) * self.Faber_pol(m)(jinv_pol) + order_1 = order_inf + finf_pol = d*(x**n-y**2) + jinv_pol = x**n/(x**n-y**2) + rat = finf_pol**order_inf * x**self._l2 * y**(ZZ(1-self._ep)/ZZ(2)) * self.Faber_pol(m)(jinv_pol) return rat @@ -1734,9 +1734,9 @@ def construct_form(self, laurent_series, order_1=ZZ(0), check=True, rationalize= if (laurent_series.prec() < order_inf + 1): raise ValueError("Insufficient precision: {} < {} = order_inf!".format(laurent_series.prec(), order_inf + 1)) - new_series = laurent_series.add_bigoh(order_inf + 1) - coefficients = new_series.coefficients() - exponents = new_series.exponents() + new_series = laurent_series.add_bigoh(order_inf + 1) + coefficients = new_series.coefficients() + exponents = new_series.exponents() if (len(coefficients) == 0): return self(0) diff --git a/src/sage/modular/modform_hecketriangle/constructor.py b/src/sage/modular/modform_hecketriangle/constructor.py index 15ddd6e4c9d..c7079c8779b 100644 --- a/src/sage/modular/modform_hecketriangle/constructor.py +++ b/src/sage/modular/modform_hecketriangle/constructor.py @@ -131,26 +131,26 @@ def rational_type(f, n=ZZ(3), base_ring=ZZ): analytic_type = AT(["quasi", "mero"]) - R = PolynomialRing(base_ring,'x,y,z,d') - F = FractionField(R) - (x,y,z,d) = R.gens() - R2 = PolynomialRing(PolynomialRing(base_ring, 'd'), 'x,y,z') - dhom = R.hom( R2.gens() + (R2.base().gen(),), R2) + R = PolynomialRing(base_ring,'x,y,z,d') + F = FractionField(R) + (x,y,z,d) = R.gens() + R2 = PolynomialRing(PolynomialRing(base_ring, 'd'), 'x,y,z') + dhom = R.hom( R2.gens() + (R2.base().gen(),), R2) - f = F(f) + f = F(f) - num = R(f.numerator()) - denom = R(f.denominator()) - ep_num = set([ZZ(1) - 2*(( sum([g.exponents()[0][m] for m in [1,2]]) )%2) for g in dhom(num).monomials()]) - ep_denom = set([ZZ(1) - 2*(( sum([g.exponents()[0][m] for m in [1,2]]) )%2) for g in dhom(denom).monomials()]) + num = R(f.numerator()) + denom = R(f.denominator()) + ep_num = set([ZZ(1) - 2*(( sum([g.exponents()[0][m] for m in [1,2]]) )%2) for g in dhom(num).monomials()]) + ep_denom = set([ZZ(1) - 2*(( sum([g.exponents()[0][m] for m in [1,2]]) )%2) for g in dhom(denom).monomials()]) if (n == infinity): - hom_num = R( num.subs(x=x**4, y=y**2, z=z**2) ) - hom_denom = R( denom.subs(x=x**4, y=y**2, z=z**2) ) + hom_num = R( num.subs(x=x**4, y=y**2, z=z**2) ) + hom_denom = R( denom.subs(x=x**4, y=y**2, z=z**2) ) else: - n = ZZ(n) - hom_num = R( num.subs(x=x**4, y=y**(2*n), z=z**(2*(n-2))) ) - hom_denom = R( denom.subs(x=x**4, y=y**(2*n), z=z**(2*(n-2))) ) + n = ZZ(n) + hom_num = R( num.subs(x=x**4, y=y**(2*n), z=z**(2*(n-2))) ) + hom_denom = R( denom.subs(x=x**4, y=y**(2*n), z=z**(2*(n-2))) ) # Determine whether the denominator of f is homogeneous if (len(ep_denom) == 1 and dhom(hom_denom).is_homogeneous()): @@ -161,17 +161,17 @@ def rational_type(f, n=ZZ(3), base_ring=ZZ): # Determine whether f is homogeneous if (len(ep_num) == 1 and dhom(hom_num).is_homogeneous()): - homo = True + homo = True if (n == infinity): weight = (dhom(hom_num).degree() - dhom(hom_denom).degree()) else: weight = (dhom(hom_num).degree() - dhom(hom_denom).degree()) / (n-2) - ep = ep_num.pop() / ep_denom.pop() + ep = ep_num.pop() / ep_denom.pop() # TODO: decompose f (resp. its degrees) into homogeneous parts else: - homo = False + homo = False weight = None - ep = None + ep = None # Note that we intentionally leave out the d-factor! if (n == infinity): diff --git a/src/sage/modular/modform_hecketriangle/graded_ring_element.py b/src/sage/modular/modform_hecketriangle/graded_ring_element.py index c244bc34f48..837091a6982 100644 --- a/src/sage/modular/modform_hecketriangle/graded_ring_element.py +++ b/src/sage/modular/modform_hecketriangle/graded_ring_element.py @@ -1100,14 +1100,14 @@ def diff_op(self, op, new_parent=None): L = op.monomials() new_rat = 0 for mon in L: - mon_summand = self._rat - mon_summand = mon_summand.derivative(x,mon.degree(dX)) - mon_summand = mon_summand.derivative(y,mon.degree(dY)) - mon_summand = mon_summand.derivative(z,mon.degree(dZ)) + mon_summand = self._rat + mon_summand = mon_summand.derivative(x,mon.degree(dX)) + mon_summand = mon_summand.derivative(y,mon.degree(dY)) + mon_summand = mon_summand.derivative(z,mon.degree(dZ)) mon_summand *= x**(mon.degree(X)) mon_summand *= y**(mon.degree(Y)) mon_summand *= z**(mon.degree(Z)) - new_rat += op.monomial_coefficient(mon)*mon_summand + new_rat += op.monomial_coefficient(mon)*mon_summand res = self.parent().rat_field()(new_rat) if (new_parent is None): new_parent = self.parent().extend_type(["quasi", "mero"], ring=True) @@ -1346,12 +1346,12 @@ def order_at(self, tau=infinity): return infinity if (self.is_homogeneous() and self.is_modular()): - rat = self.parent().rat_field()(self._rat) - R = self.parent().pol_ring() + rat = self.parent().rat_field()(self._rat) + R = self.parent().pol_ring() numerator = R(rat.numerator()) - denom = R(rat.denominator()) + denom = R(rat.denominator()) (x,y,z,d) = R.gens() - n = self.hecke_n() + n = self.hecke_n() if (tau == i): f_pol = y @@ -1378,17 +1378,17 @@ def order_at(self, tau=infinity): # Also numerator /= f_pol doesn't seem to return an element of R for non-exact rings... try: while (f_pol.divides(numerator)): - numerator = numerator.quo_rem(f_pol)[0] + numerator = numerator.quo_rem(f_pol)[0] #numerator /= f_pol - numerator = R(numerator) + numerator = R(numerator) order_f += 1 except TypeError: pass try: while (f_pol.divides(denom)): - denom = denom.quo_rem(f_pol)[0] + denom = denom.quo_rem(f_pol)[0] #denom /= f_pol - denom = R(denom) + denom = R(denom) order_f -= 1 except TypeError: pass @@ -1398,12 +1398,12 @@ def order_at(self, tau=infinity): if (tau != infinity): raise NotImplementedError("Only the order at infinity is supported for non-homogeneous or quasi forms!") - num_val = prec_num_bound = 1 #(self.parent()._prec/ZZ(2)).ceil() + num_val = prec_num_bound = 1 #(self.parent()._prec/ZZ(2)).ceil() denom_val = prec_denom_bound = 1 #(self.parent()._prec/ZZ(2)).ceil() while (num_val >= prec_num_bound): - prec_num_bound *= 2 - num_val = self.numerator().q_expansion(prec=prec_num_bound, fix_prec=True).valuation() + prec_num_bound *= 2 + num_val = self.numerator().q_expansion(prec=prec_num_bound, fix_prec=True).valuation() while (denom_val >= prec_denom_bound): prec_denom_bound *= 2 denom_val = self.denominator().q_expansion(prec=prec_denom_bound, fix_prec=True).valuation() @@ -1563,7 +1563,7 @@ def _q_expansion_cached(self, prec, fix_d, subs_d, d_num_prec, fix_prec = False) X = SC.E4_ZZ().base_extend(formal_d.parent()) else: X = SC.f_rho_ZZ().base_extend(formal_d.parent()) - Y = SC.f_i_ZZ().base_extend(formal_d.parent()) + Y = SC.f_i_ZZ().base_extend(formal_d.parent()) if (self.parent().is_modular()): # z does not appear in self._rat but we need to specialize it for @@ -2193,9 +2193,9 @@ def evaluate(self, tau, prec = None, num_prec = None, check=False): E2_cor_term = 4 * self.group().lam() / (2*pi*i).n(num_prec) * self.hecke_n() / (self.hecke_n()-2) * A.c() * (A.c()*w + A.d()) return E2_wvalue*aut_factor + E2_cor_term else: - f_i = self.parent().graded_ring().f_i() - E2 = self.parent().graded_ring().E2() - dval = self.parent().group().dvalue().n(num_prec) + f_i = self.parent().graded_ring().f_i() + E2 = self.parent().graded_ring().E2() + dval = self.parent().group().dvalue().n(num_prec) if (self.hecke_n() == infinity): E4 = self.parent().graded_ring().E4() return self._rat.subs(x=E4(tau), y=f_i(tau), z=E2(tau), d=dval) diff --git a/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py index 090d1bfaf0f..8f4d3a25d47 100644 --- a/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py +++ b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py @@ -202,10 +202,10 @@ def _word_S_T_data(self): (((1, 1), (0, 1)), 1) """ res = [] - ID = self.parent().I()._matrix - T = self.parent().T()._matrix - S = self.parent().S()._matrix - M = self._matrix + ID = self.parent().I()._matrix + T = self.parent().T()._matrix + S = self.parent().S()._matrix + M = self._matrix lam = self.parent().lam() zero = ZZ.zero() one = ZZ.one() @@ -602,18 +602,18 @@ def continued_fraction(self): # emb = self.root_extension_embedding(QQbar) raise NotImplementedError - emb = self.root_extension_embedding(AA) - G = self.parent() - S = G.S() - TI = G.T().inverse() - lam = G.lam() + emb = self.root_extension_embedding(AA) + G = self.parent() + S = G.S() + TI = G.T().inverse() + lam = G.lam() - p = self.fixed_points()[0] + p = self.fixed_points()[0] - cf_dict = {} - L = [] + cf_dict = {} + L = [] cf_index = ZZ.zero() - one = ZZ.one() + one = ZZ.one() while(p not in cf_dict): cf_dict[p] = cf_index @@ -765,22 +765,22 @@ def _primitive_block_decomposition_data(self): G = self.parent() zero = ZZ.zero() - one = ZZ.one() + one = ZZ.one() # The elliptic case (for this case we use a special notation): if self.is_elliptic(): if self.parent().n() == infinity: raise NotImplementedError - emb = self.root_extension_embedding(QQbar) - p = self.fixed_points()[0] - embp = emb(p) + emb = self.root_extension_embedding(QQbar) + p = self.fixed_points()[0] + embp = emb(p) embp.simplify() embp.exactify() (R, embw) = G.get_FD(embp) - w = R.inverse().acton(p) + w = R.inverse().acton(p) # we should have: embw == emb(w) - embw = emb(w) + embw = emb(w) embw.simplify() embw.exactify() @@ -807,7 +807,7 @@ def _primitive_block_decomposition_data(self): (preperiod, period) = self.continued_fraction() number_of_ones = [] - list_larger = [] + list_larger = [] ones = 0 for l in period: if l > 1: @@ -820,11 +820,11 @@ def _primitive_block_decomposition_data(self): initial_ones = number_of_ones.pop(0) if len(list_larger) == 0: - list_v1 = [-ZZ(1)] - list_vlarger = [ initial_ones + 2 ] + list_v1 = [-ZZ(1)] + list_vlarger = [ initial_ones + 2 ] else: - list_v1 = [ v-2 for v in list_larger ] - list_vlarger = [ v+2 for v in number_of_ones ] + list_v1 = [ v-2 for v in list_larger ] + list_vlarger = [ v+2 for v in number_of_ones ] list_vlarger[-1] += initial_ones L = [] @@ -1331,8 +1331,8 @@ def primitive_power(self, method="cf"): warn("The case n=infinity here is not verified at all and probably wrong!") zero = ZZ.zero() - one = ZZ.one() - two = ZZ(2) + one = ZZ.one() + two = ZZ(2) if self.is_identity(): return zero @@ -1352,7 +1352,7 @@ def primitive_power(self, method="cf"): Uj = G.I() for j in range(1, G.n()): Uj *= U - if U_power == Uj: + if U_power == Uj: #L = [one, ZZ(j)] break elif U_power == -Uj: diff --git a/src/sage/modular/modform_hecketriangle/hecke_triangle_groups.py b/src/sage/modular/modform_hecketriangle/hecke_triangle_groups.py index fdd7e38b552..d84bb365745 100644 --- a/src/sage/modular/modform_hecketriangle/hecke_triangle_groups.py +++ b/src/sage/modular/modform_hecketriangle/hecke_triangle_groups.py @@ -619,8 +619,8 @@ def get_FD(self, z): 134.1200000... + 0.2200000000...*I """ ID = self.I() - T = self.T() - S = self.S() + T = self.T() + S = self.S() TI = self.T(-1) A = ID @@ -960,9 +960,9 @@ def _conjugacy_representatives(self, max_block_length=ZZ(0), D=None): if not hasattr(self, "_max_block_length"): self._max_block_length = ZZ(0) - self._conj_block = {} - self._conj_nonprim = {} - self._conj_prim = {} + self._conj_block = {} + self._conj_nonprim = {} + self._conj_prim = {} # It is not clear how to define the class number for D=0: # Conjugacy classes are V(n-1)^(+-k) for arbitrary k diff --git a/src/sage/modular/modform_hecketriangle/series_constructor.py b/src/sage/modular/modform_hecketriangle/series_constructor.py index 881270c5bfa..7bd6e256c31 100644 --- a/src/sage/modular/modform_hecketriangle/series_constructor.py +++ b/src/sage/modular/modform_hecketriangle/series_constructor.py @@ -115,9 +115,9 @@ def __init__(self, group, prec): Power series constructor for Hecke modular forms for n=+Infinity with (basic series) precision 10 """ - self._group = group - self._prec = prec - self._series_ring = PowerSeriesRing(QQ,'q',default_prec=self._prec) + self._group = group + self._prec = prec + self._series_ring = PowerSeriesRing(QQ,'q',default_prec=self._prec) def _repr_(self): r""" @@ -210,7 +210,7 @@ def J_inv_ZZ(self): q^-1 + 3/8 + 69/1024*q + O(q^2) """ - F1 = lambda a,b: self._series_ring( + F1 = lambda a,b: self._series_ring( [ ZZ(0) ] + [ rising_factorial(a,k) * rising_factorial(b,k) / (ZZ(k).factorial())**2 @@ -222,23 +222,23 @@ def J_inv_ZZ(self): ZZ(self._prec+1) ) - F = lambda a,b,c: self._series_ring( + F = lambda a,b,c: self._series_ring( [ rising_factorial(a,k) * rising_factorial(b,k) / rising_factorial(c,k) / ZZ(k).factorial() for k in range(ZZ(0), ZZ(self._prec+1)) ], ZZ(self._prec+1) ) - a = self._group.alpha() - b = self._group.beta() - Phi = F1(a,b) / F(a,b,ZZ(1)) - q = self._series_ring.gen() + a = self._group.alpha() + b = self._group.beta() + Phi = F1(a,b) / F(a,b,ZZ(1)) + q = self._series_ring.gen() # the current implementation of power series reversion is slow # J_inv_ZZ = ZZ(1) / ((q*Phi.exp()).reverse()) - temp_f = (q*Phi.exp()).polynomial() - new_f = temp_f.revert_series(temp_f.degree()+1) + temp_f = (q*Phi.exp()).polynomial() + new_f = temp_f.revert_series(temp_f.degree()+1) J_inv_ZZ = ZZ(1) / (new_f + O(q**(temp_f.degree()+1))) return J_inv_ZZ @@ -341,7 +341,7 @@ def f_inf_ZZ(self): if (n == infinity): f_inf_ZZ = ((-q*self.J_inv_ZZ().derivative())**2/(self.J_inv_ZZ()**2*(self.J_inv_ZZ()-1))).power_series() else: - temp_expr = ((-q*self.J_inv_ZZ().derivative())**(2*n)/(self.J_inv_ZZ()**(2*n-2)*(self.J_inv_ZZ()-1)**n)/q**(n-2)).power_series() + temp_expr = ((-q*self.J_inv_ZZ().derivative())**(2*n)/(self.J_inv_ZZ()**(2*n-2)*(self.J_inv_ZZ()-1)**n)/q**(n-2)).power_series() f_inf_ZZ = (temp_expr.log()/(n-2)).exp()*q return f_inf_ZZ @@ -563,7 +563,7 @@ def EisensteinSeries_ZZ(self, k): if k == 0: return self._series_ring(1) - M = ZZ(self.group().lam()**2) + M = ZZ(self.group().lam()**2) lamk = M**(ZZ(k/2)) dval = self.group().dvalue() @@ -575,7 +575,7 @@ def coeff(m): return ZZ(1) factor = -2*k / QQ(bernoulli(k)) / lamk - sum1 = sigma(m, k-1) + sum1 = sigma(m, k-1) if M.divides(m): sum2 = (lamk-1) * sigma(ZZ(m/M), k-1) else: diff --git a/src/sage/modular/modsym/boundary.py b/src/sage/modular/modsym/boundary.py index ec41f8c36dd..f29c363cf8b 100644 --- a/src/sage/modular/modsym/boundary.py +++ b/src/sage/modular/modsym/boundary.py @@ -896,8 +896,8 @@ def _coerce_cusp(self, c): sage: [ B(Cusp(i,7)) for i in range(7) ] [0, [1/7], [2/7], [3/7], -[3/7], -[2/7], -[1/7]] """ - N = self.level() - k = self.weight() + N = self.level() + k = self.weight() sign = self.sign() i, eps = self._cusp_index(c) if i != -1: @@ -1146,7 +1146,7 @@ def _coerce_cusp(self, c): sage: S.dimension() 8 """ - k = self.weight() + k = self.weight() sign = self.sign() i, eps = self._cusp_index(c) if i != -1: diff --git a/src/sage/schemes/elliptic_curves/constructor.py b/src/sage/schemes/elliptic_curves/constructor.py index 8d1a7ddf363..f40b294324a 100644 --- a/src/sage/schemes/elliptic_curves/constructor.py +++ b/src/sage/schemes/elliptic_curves/constructor.py @@ -731,7 +731,7 @@ def coefficients_from_j(j, minimal_twist=True): for p in Set(n.prime_divisors()+m.prime_divisors()): e = min(a4.valuation(p)//2,a6.valuation(p)//3) if e>0: - p = p**e + p = p**e a4 /= p**2 a6 /= p**3 diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 213ac83d73b..df96fdcd1f4 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -2219,7 +2219,7 @@ def __init_even_kernel_polynomial(self, E, psi_G): (x^7 + 5*x^6 + 2*x^5 + 6*x^4 + 3*x^3 + 5*x^2 + 6*x + 3, x^9*y - 3*x^8*y + 2*x^7*y - 3*x^3*y + 2*x^2*y + x*y - y, 1, 6, 3, 4) """ # check if the polynomial really divides the two_torsion_polynomial - if self.__check and E.division_polynomial(2, x=self.__poly_ring.gen()) % psi_G != 0 : + if self.__check and E.division_polynomial(2, x=self.__poly_ring.gen()) % psi_G != 0 : raise ValueError(f"the polynomial {psi_G} does not define a finite subgroup of {E}") n = psi_G.degree() # 1 or 3 diff --git a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py index b31f7dfe46c..9789701f026 100644 --- a/src/sage/schemes/elliptic_curves/ell_modular_symbols.py +++ b/src/sage/schemes/elliptic_curves/ell_modular_symbols.py @@ -448,7 +448,7 @@ def __init__(self, E, sign, normalize="L_ratio"): if self._failed_to_scale: self._find_scaling_period() # will reset _e and _scaling else: - self._e *= self._scaling + self._e *= self._scaling elif normalize == "period" : self._find_scaling_period() # this will set _e and _scaling elif normalize == "none": diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py index f1b7d937748..ffc35984fff 100644 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py @@ -2333,7 +2333,7 @@ def _compute_gens(self, proof, for a in ai: if not a.is_integral(): for p, _ in a.denom().factor(): - e = min((ai[i].valuation(p)/[1,2,3,4,6][i]) + e = min((ai[i].valuation(p)/[1,2,3,4,6][i]) for i in range(5)).floor() ai = [ai[i]/p**(e*[1,2,3,4,6][i]) for i in range(5)] xterm *= p**(2*e) @@ -2747,9 +2747,9 @@ def silverman_height_bound(self, algorithm='default'): 0.16397076103046915 """ if algorithm == 'default': - Delta = self.discriminant() - j = self.j_invariant() - b2 = self.b2() + Delta = self.discriminant() + j = self.j_invariant() + b2 = self.b2() twostar = 2 if b2 else 1 from math import log @@ -2758,7 +2758,7 @@ def h(x): def h_oo(x): return log(max(abs(x), 1)) - mu = h(Delta)/12 + h_oo(j)/12 + h_oo(b2/12)/2 + log(twostar)/2 + mu = h(Delta)/12 + h_oo(j)/12 + h_oo(b2/12)/2 + log(twostar)/2 lower = 2*(-h(j)/24 - mu - 0.961) upper = 2*(mu + 1.07) return max(abs(lower), abs(upper)) @@ -3489,7 +3489,7 @@ def local_integral_model(self, p): """ assert p.is_prime(), "p must be prime in local_integral_model()" ai = self.a_invariants() - e = min([(ai[i].valuation(p)/[1,2,3,4,6][i]) for i in range(5)]).floor() + e = min([(ai[i].valuation(p)/[1,2,3,4,6][i]) for i in range(5)]).floor() return constructor.EllipticCurve([ai[i]/p**(e*[1,2,3,4,6][i]) for i in range(5)]) def is_global_integral_model(self): @@ -3523,7 +3523,7 @@ def global_integral_model(self): for a in ai: if not a.is_integral(): for p, _ in a.denom().factor(): - e = min((ai[i].valuation(p)/[1,2,3,4,6][i]) + e = min((ai[i].valuation(p)/[1,2,3,4,6][i]) for i in range(5)).floor() ai = [ai[i]/p**(e*[1,2,3,4,6][i]) for i in range(5)] for z in ai: @@ -3620,7 +3620,7 @@ def _generalized_congmod_numbers(self, M, invariant="both"): if invariant in ["moddeg", "both"]: V = A.integral_structure() W = B.integral_structure() - moddeg = (V + W).index_in(S.integral_structure()) + moddeg = (V + W).index_in(S.integral_structure()) L["moddeg"] = moddeg self.__generalized_modular_degree[M] = moddeg diff --git a/src/sage/schemes/elliptic_curves/gal_reps.py b/src/sage/schemes/elliptic_curves/gal_reps.py index 056268eb230..140e1560f66 100644 --- a/src/sage/schemes/elliptic_curves/gal_reps.py +++ b/src/sage/schemes/elliptic_curves/gal_reps.py @@ -989,7 +989,7 @@ def image_type(self, p): could_be_split = 1 could_be_non_split = 1 # loops over primes as long as we still have two options left - while ell < 10000 and (could_be_exc + could_be_split + could_be_non_split > 1): + while ell < 10000 and (could_be_exc + could_be_split + could_be_non_split > 1): ell = arith.next_prime(ell) if Np % ell != 0: a_ell = self._E.ap(ell) @@ -1007,7 +1007,7 @@ def image_type(self, p): verbose("the image cannot be split, found u=%s"%u, level=2) could_be_split = 0 - assert could_be_exc + could_be_split + could_be_non_split > 0, "bug in image_type." + assert could_be_exc + could_be_split + could_be_non_split > 0, "bug in image_type." if could_be_exc + could_be_split + could_be_non_split == 1: # it is only one of the three cases: @@ -1029,7 +1029,7 @@ def image_type(self, p): f = R([1,-3,1]) #(X**2 - 3*X+1) el5 = f.roots() # loops over primes as long as we still have two options left - while ell < 10000 and (could_be_s4 + could_be_a4 + could_be_a5 > 1): + while ell < 10000 and (could_be_s4 + could_be_a4 + could_be_a5 > 1): ell = arith.next_prime(ell) if Np % ell != 0: a_ell = self._E.ap(ell) @@ -1043,7 +1043,7 @@ def image_type(self, p): could_be_a4 = 0 could_be_s4 = 0 - assert (could_be_s4 + could_be_a4 + could_be_a5 > 0), "bug in image_type." + assert (could_be_s4 + could_be_a4 + could_be_a5 > 0), "bug in image_type." if could_be_s4 + could_be_a4 + could_be_a5 == 1: if could_be_s4 == 1: diff --git a/src/sage/schemes/elliptic_curves/heegner.py b/src/sage/schemes/elliptic_curves/heegner.py index ebbfcb00afa..05c03f3906b 100644 --- a/src/sage/schemes/elliptic_curves/heegner.py +++ b/src/sage/schemes/elliptic_curves/heegner.py @@ -516,7 +516,7 @@ def quadratic_field(self): sage: K.quadratic_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I """ - D = self.__D + D = self.__D var = 'sqrt_minus_%s'%(-D) return number_field.QuadraticField(D,var) @@ -2192,7 +2192,7 @@ def quadratic_field(self): sage: K.quadratic_field() Number Field in sqrt_minus_7 with defining polynomial x^2 + 7 with sqrt_minus_7 = 2.645751311064591?*I """ - D = self.__D + D = self.__D var = 'sqrt_minus_%s'%(-D) return number_field.QuadraticField(D,var) @@ -3847,7 +3847,7 @@ def _qf_from_tau(self, tau): sage: P._qf_from_tau(tau) (57, 26, 3) """ - g = tau.minpoly() + g = tau.minpoly() g *= g.denominator() return (ZZ(g[2]), ZZ(g[1]), ZZ(g[0])) @@ -4799,7 +4799,7 @@ def optimal_embeddings(self, D, c, R): Embedding sending 2*sqrt(-7) to -2*i + 2*j + 2*k] """ Q, G = R.ternary_quadratic_form(include_basis=True) - n = -D*c*c + n = -D*c*c reps = Q.representation_vector_list(n+1)[-1] # The representatives give elements in terms of the @@ -6672,7 +6672,7 @@ def heegner_index(self, D, min_p=2, prec=5, descent_second_limit=12, else: F = self # Now rank(F) > 0 - h = ht.upper() + h = ht.upper() verbose("Heegner height bound = %s"%h) B = F.CPS_height_bound() verbose("CPS bound = %s"%B) @@ -6818,7 +6818,7 @@ def heegner_index_bound(self, D=0, prec=5, max_height=None): if 0 in ht: return 0, D, False F = self.quadratic_twist(D) - h = ht.upper() + h = ht.upper() verbose("Heegner height bound = %s"%h) B = F.CPS_height_bound() verbose("CPS bound = %s"%B) @@ -6949,25 +6949,25 @@ def _heegner_index_in_EK(self, D): # so we may assume t is of 2-power order. ##################################################################### - E = self # nice shortcut - F = E.quadratic_twist(D).minimal_model() - K = rings.QuadraticField(D, 'a') + E = self # nice shortcut + F = E.quadratic_twist(D).minimal_model() + K = rings.QuadraticField(D, 'a') # Define a map phi that we'll use to put the points of E^D(QQ) # into E(K): - G = E.change_ring(K) - G2 = F.change_ring(K) - phi = G2.isomorphism_to(G) + G = E.change_ring(K) + G2 = F.change_ring(K) + phi = G2.isomorphism_to(G) # Basis for E(Q)/tor oplus E^D(QQ)/tor in E(K): basis = [G(z) for z in E.gens()] + [G(phi(z)) for z in F.gens()] # Make a list of the 2-power order torsion points in E(K), including 0. - T = [G(z) for z in G.torsion_subgroup().list() if z.order() == 1 or + T = [G(z) for z in G.torsion_subgroup().list() if z.order() == 1 or ((z.order() % 2 == 0 and len(z.order().factor()) == 1))] - r = len(basis) # rank - V = rings.QQ**r - B = [] + r = len(basis) # rank + V = rings.QQ**r + B = [] # Iterate through reps for A/(2*A) creating vectors in (1/2)*ZZ^r for v in rings.GF(2)**r: @@ -6980,7 +6980,7 @@ def _heegner_index_in_EK(self, D): A = rings.ZZ**r # Take span of our vectors in (1/2)*ZZ^r, along with ZZ^r. This is E(K)/tor. - W = V.span(B, rings.ZZ) + A + W = V.span(B, rings.ZZ) + A # Compute the index in E(K)/tor of A = E(Q)/tor + E^D(Q)/tor, cache, and return. index = A.index_in(W) @@ -7077,13 +7077,13 @@ def heegner_sha_an(self, D, prec=53): # Use the BSD conjecture over the quadratic imaginary K -- # see page 311 of [GZ1986]_ for the formula. - E = self # notational convenience - F = E.quadratic_twist(D).minimal_model() - K = rings.QuadraticField(D, 'a') + E = self # notational convenience + F = E.quadratic_twist(D).minimal_model() + K = rings.QuadraticField(D, 'a') # Compute each of the quantities in BSD # - The torsion subgroup over K. - T = E.change_ring(K).torsion_order() + T = E.change_ring(K).torsion_order() # - The product of the Tamagawa numbers, which because D is # coprime to N is just the square of the product of the @@ -7093,7 +7093,7 @@ def heegner_sha_an(self, D, prec=53): # - The leading term of the L-series, as a product of two # other L-series. - rE = E.rank() + rE = E.rank() rF = F.rank() L_E = E.lseries().dokchitser(prec).derivative(1, rE) L_F = F.lseries().dokchitser(prec).derivative(1, rF) diff --git a/src/sage/schemes/elliptic_curves/padic_lseries.py b/src/sage/schemes/elliptic_curves/padic_lseries.py index 875a4113464..7b72c68b232 100644 --- a/src/sage/schemes/elliptic_curves/padic_lseries.py +++ b/src/sage/schemes/elliptic_curves/padic_lseries.py @@ -1450,7 +1450,7 @@ def Dp_valued_series(self, n=3, quadratic_twist=+1, prec=5): # now compute phi phi = matrix.matrix([[0,-1/p],[1,E.ap(p)/p]]) - lpv = vector([G + (E.ap(p))*H , - R(p) * H ]) # this is L_p + lpv = vector([G + (E.ap(p))*H , - R(p) * H ]) # this is L_p eps = (1-phi)**(-2) resu = lpv*eps.transpose() return resu @@ -1506,7 +1506,7 @@ def isom(e1,e2): raise ValueError("Curves must be isomorphic.") usq = (e1.discriminant()/e2.discriminant()).nth_root(6) u = usq.sqrt() - s = (u * e2.a1() - e1.a1() )/ZZ(2) + s = (u * e2.a1() - e1.a1() )/ZZ(2) r = (usq * e2.a2() - e1.a2() + s**2 + e1.a1()*s)/ZZ(3) t = (u**3 * e2.a3() - e1.a3() - e1.a1()*r)/ZZ(2) return [u,r,s,t] diff --git a/src/sage/schemes/elliptic_curves/padics.py b/src/sage/schemes/elliptic_curves/padics.py index e4d88113716..7ee1499c7a2 100644 --- a/src/sage/schemes/elliptic_curves/padics.py +++ b/src/sage/schemes/elliptic_curves/padics.py @@ -1096,7 +1096,7 @@ def padic_sigma(self, p, N=20, E2=None, check=False, check_hypotheses=True): Rt = x.parent() - A = (x + c) * f + A = (x + c) * f # do integral over QQ, to avoid divisions by p A = Rt(QQt(A).integral()) A = (-X.a1()/2 - A) * f @@ -1284,7 +1284,7 @@ def padic_sigma_truncated(self, p, N=20, lamb=0, E2=None, check_hypotheses=True) Rt = x.parent() - A = (x + c) * f + A = (x + c) * f # do integral over QQ, to avoid divisions by p A = Rt(QQt(A).integral()) A = (-X.a1()/2 - A) * f diff --git a/src/sage/schemes/elliptic_curves/saturation.py b/src/sage/schemes/elliptic_curves/saturation.py index 57367c515d4..fcd02287b27 100644 --- a/src/sage/schemes/elliptic_curves/saturation.py +++ b/src/sage/schemes/elliptic_curves/saturation.py @@ -268,7 +268,7 @@ def full_p_saturation(self, Plist, p): verbose = self._verbose if verbose: - print(" --starting full %s-saturation" % p) + print(" --starting full %s-saturation" % p) n = len(Plist) # number of points supplied & to be returned Plist = Plist + [T for T in self._torsion_gens if p.divides(T.order())] @@ -656,7 +656,7 @@ def p_projections(Eq, Plist, p, debug=False): # project onto p-primary part - pts = [m*pt for pt in Plist] + pts = [m*pt for pt in Plist] gens = [m*g.element() for g in G.gens()] gens = [g for g in gens if g] if debug: diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py index ad3b7d59a53..828b6514cb2 100644 --- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py @@ -507,7 +507,7 @@ def local_coordinates_at_weierstrass(self, P, prec=20, name='t'): pol = self.hyperelliptic_polynomials()[0] pol_prime = pol.derivative() b = P[0] - t2 = t**2 + t2 = t**2 c = b + t2/pol_prime(b) c = c.add_bigoh(prec) for _ in range(int(1 + log(prec, 2))): diff --git a/src/sage/schemes/product_projective/morphism.py b/src/sage/schemes/product_projective/morphism.py index b558d88b304..86fe1bce757 100644 --- a/src/sage/schemes/product_projective/morphism.py +++ b/src/sage/schemes/product_projective/morphism.py @@ -160,7 +160,7 @@ def _repr_defn(self): sage: f._repr_defn() 'Defined by sending (x : y , z : w) to \n(x^2 : y^2 , z : w).' """ - s = 'Defined by sending ' + s = 'Defined by sending ' s += self.domain().ambient_space()._repr_generic_point() s += ' to \n' s += self.codomain().ambient_space()._repr_generic_point(self._polys) diff --git a/src/sage/schemes/projective/projective_rational_point.py b/src/sage/schemes/projective/projective_rational_point.py index 738f28cb993..1b4c7da1543 100644 --- a/src/sage/schemes/projective/projective_rational_point.py +++ b/src/sage/schemes/projective/projective_rational_point.py @@ -445,7 +445,7 @@ def good_primes(B): best_size = 2 best_time = (N**2)*M[2][-1]**(N) + (N**5 * RR(prod(M[2])**dim_scheme / M[2][-1]) ) for i in range(2, max_length + 1): - current_time = (N**2)*M[i][-1]**(N) + (N**5 * RR(prod(M[i])**dim_scheme / M[i][-1]) ) + current_time = (N**2)*M[i][-1]**(N) + (N**5 * RR(prod(M[i])**dim_scheme / M[i][-1]) ) if current_time < best_time: best_size = i best_time = current_time diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py index d41c35c5a7b..82b7c4d46b4 100644 --- a/src/sage/schemes/toric/morphism.py +++ b/src/sage/schemes/toric/morphism.py @@ -678,7 +678,7 @@ def _repr_defn(self): 'Defined by embedding the torus closure associated to the 1-d cone of Rational polyhedral fan in 2-d lattice N.' """ - s = 'Defined by embedding the torus closure associated to the ' + s = 'Defined by embedding the torus closure associated to the ' s += str(self._defining_cone) s += '.' return s @@ -964,7 +964,7 @@ def _repr_defn(self): sage: f._repr_defn() 'Defined by sending Rational polyhedral fan in 2-d lattice N to Rational polyhedral fan in 1-d lattice N.' """ - s = 'Defined by sending ' + s = 'Defined by sending ' s += str(self.domain().fan()) s += ' to ' s += str(self.codomain().fan())