Skip to content

Commit 69d7cda

Browse files
committed
ruff auto-fix for C4 in modular
1 parent ebef87a commit 69d7cda

22 files changed

+40
-40
lines changed

src/sage/modular/abvar/abvar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,8 +2060,8 @@ def newform_level(self, none_if_not_known=False):
20602060
if none_if_not_known:
20612061
return None
20622062
level = LCM([f.level() for f in self.newform_decomposition('a')])
2063-
groups = sorted(set([f.group() for f in
2064-
self.newform_decomposition('a')]))
2063+
groups = sorted({f.group() for f in
2064+
self.newform_decomposition('a')})
20652065
if len(groups) == 1:
20662066
groups = groups[0]
20672067
self.__newform_level = level, groups
@@ -3870,7 +3870,7 @@ def _factors_with_same_label(self, other):
38703870
if not isinstance(other, ModularAbelianVariety_abstract):
38713871
raise TypeError("other must be an abelian variety")
38723872
D = self.decomposition()
3873-
C = set([A.newform_label() for A in other.decomposition()])
3873+
C = {A.newform_label() for A in other.decomposition()}
38743874
Z = []
38753875
for X in D:
38763876
lbl = X.newform_label()
@@ -4899,7 +4899,7 @@ def tamagawa_number_bounds(self, p):
48994899
else:
49004900
raise NotImplementedError("Atkin-Lehner at p must act as a scalar")
49014901
else:
4902-
mul_primes = sorted(set([p] + [q for q in prime_range(2, 2 * self.dimension() + 2)]))
4902+
mul_primes = sorted(set([p] + list(prime_range(2, 2 * self.dimension() + 2))))
49034903
div = Integer(div)
49044904
mul = Integer(mul)
49054905
mul_primes = tuple(mul_primes)

src/sage/modular/abvar/homspace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def calculate_generators(self):
570570
return
571571

572572
if (self.domain() == self.codomain()) and (self.domain().dimension() == 1):
573-
self._gens = tuple([ identity_matrix(ZZ,2) ])
573+
self._gens = ( identity_matrix(ZZ,2), )
574574
return
575575

576576
phi = self.domain()._isogeny_to_product_of_powers()

src/sage/modular/arithgroup/arithgroup_perm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,7 @@ def cusp_widths(self,exp=False):
17981798
"""
17991799
inv = self.S2()**2
18001800
L = self.L()
1801-
cusps = set(c[0] for c in L.cycle_tuples(singletons=True))
1801+
cusps = {c[0] for c in L.cycle_tuples(singletons=True)}
18021802
if exp:
18031803
widths = {}
18041804
else:
@@ -2603,7 +2603,7 @@ def odd_subgroups(self):
26032603
s3 = PermutationConstructor([x + tuple(y + n for y in x) for x in s3cycs])
26042604
H = ArithmeticSubgroup_Permutation(S2=s2,S3=s3)
26052605

2606-
bucket = set([H])
2606+
bucket = {H}
26072607
res = [H]
26082608
# We use a set *and* a list since checking whether an element is in a
26092609
# set is very fast, but on the other hand we want the order the results

src/sage/modular/arithgroup/congroup_gammaH.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def _normalize_H(H, level):
146146
for h in H:
147147
if gcd(h, level) > 1:
148148
raise ArithmeticError('The generators %s must be units modulo %s' % (H, level))
149-
H = set(u for u in H if u > 1)
149+
H = {u for u in H if u > 1}
150150
final_H = set()
151151
for h in H:
152152
inv_h = h.inverse_mod(level)
@@ -1140,7 +1140,7 @@ def ncusps(self):
11401140
c = ZZ(0)
11411141
for d in (d for d in N.divisors() if d**2 <= N):
11421142
Nd = lcm(d, N // d)
1143-
Hd = set([x % Nd for x in H])
1143+
Hd = {x % Nd for x in H}
11441144
lenHd = len(Hd)
11451145
if Nd - 1 not in Hd:
11461146
lenHd *= 2
@@ -1182,7 +1182,7 @@ def nregcusps(self):
11821182
c = ZZ(0)
11831183
for d in (d for d in divisors(N) if d**2 <= N):
11841184
Nd = lcm(d, N // d)
1185-
Hd = set([x % Nd for x in H])
1185+
Hd = {x % Nd for x in H}
11861186
if Nd - 1 not in Hd:
11871187
summand = euler_phi(d) * euler_phi(N // d) // (2 * len(Hd))
11881188
if d**2 == N:
@@ -1395,7 +1395,7 @@ def _list_subgroup(N, gens):
13951395
sage: sage.modular.arithgroup.congroup_gammaH._list_subgroup(11, [3])
13961396
[1, 3, 4, 5, 9]
13971397
"""
1398-
H = set([1])
1398+
H = {1}
13991399
N = int(N)
14001400
for g in gens:
14011401
if gcd(g, N) != 1:
@@ -1405,7 +1405,7 @@ def _list_subgroup(N, gens):
14051405
while not (gk in H):
14061406
gk = (gk * g) % N
14071407
sbgrp.append(gk)
1408-
H = set([(x * h) % N for x in sbgrp for h in H])
1408+
H = {(x * h) % N for x in sbgrp for h in H}
14091409
return sorted(H)
14101410

14111411

src/sage/modular/btquotients/btquotient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3710,7 +3710,7 @@ def _compute_quotient(self, check=True):
37103710
'from expected.')
37113711

37123712
self._nontorsion_generators = nontorsion_generators
3713-
self._boundary = dict([(vv.rep, vv) for vv in vertex_list])
3713+
self._boundary = {vv.rep: vv for vv in vertex_list}
37143714
self._edge_list = edge_list
37153715
self._vertex_list = vertex_list
37163716
self._num_edges = num_edges

src/sage/modular/dirichlet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ def galois_orbit(self, sort=True):
12821282
P = self.parent()
12831283
z = self.element()
12841284
o = int(z.additive_order())
1285-
Auts = set([m % o for m in P._automorphisms()])
1285+
Auts = {m % o for m in P._automorphisms()}
12861286
v = [P.element_class(P, m * z, check=False) for m in Auts]
12871287
if sort:
12881288
v.sort()

src/sage/modular/etaproducts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def basis(self, reduce=True):
558558
nf = (i < S.ncols() and S[i, i]) or 0 # ?
559559
good_vects.append((vect * 24 / gcd(nf, 24)).list())
560560
for v in good_vects:
561-
v.append(-sum([r for r in v]))
561+
v.append(-sum(list(v)))
562562
dicts = []
563563
for v in good_vects:
564564
dicts.append({})

src/sage/modular/hypergeometric_motive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ def wild_primes(self):
661661
[2, 3, 5]
662662
"""
663663
gamma = self.gamma_array()
664-
return sorted(set([p for n in gamma.keys() for (p, _) in n.factor()]))
664+
return sorted({p for n in gamma.keys() for (p, _) in n.factor()})
665665

666666
def zigzag(self, x, flip_beta=False):
667667
r"""

src/sage/modular/local_comp/smoothchar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ def quadratic_chars(self):
11031103
q = 1
11041104
ram = [self.from_dirichlet(chi) for chi in DirichletGroup(self.prime() ** q, QQ) if not chi.is_trivial()]
11051105
nr = self.character(0, [-1])
1106-
return sorted([nr] + [f for f in ram] + [f*nr for f in ram])
1106+
return sorted([nr] + list(ram) + [f*nr for f in ram])
11071107

11081108
class SmoothCharacterGroupQuadratic(SmoothCharacterGroupGeneric):
11091109
r"""
@@ -1793,12 +1793,12 @@ def exponents(self, c):
17931793
c = ZZ(c)
17941794
p = self.prime()
17951795
if c == 0:
1796-
return tuple([0])
1796+
return (0,)
17971797
elif c == 1:
1798-
return tuple([p - 1, 0])
1798+
return (p - 1, 0)
17991799
elif p > 3 or self._unif_sqr == 3 or c <= 3:
18001800
d = (c + 1) // 2
1801-
return tuple([p**(d - 1) * (p - 1), p**(c // 2), 0])
1801+
return (p**(d - 1) * (p - 1), p**(c // 2), 0)
18021802
else:
18031803
# awkward case, see above
18041804
return self.ideal(c).idealstar(2).gens_orders() + (0,)

src/sage/modular/modform_hecketriangle/abstract_space.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ def aut_factor(self, gamma, t):
761761
elif (gamma.is_reflection()):
762762
return self._ep * (t/QQbar(I))**self._weight
763763
else:
764-
L = [v for v in gamma.word_S_T()[0]]
764+
L = list(gamma.word_S_T()[0])
765765
aut_f = ZZ(1)
766766
while (len(L) > 0):
767767
M = L.pop(-1)
@@ -1857,7 +1857,7 @@ def _quasi_form_matrix(self, min_exp=0, order_1=ZZ(0), incr_prec_by=0):
18571857
return A
18581858

18591859
B = A
1860-
A = A.delete_rows([r for r in range(column_size + (row_size-column_size)//2 - 1, row_size)])
1860+
A = A.delete_rows(list(range(column_size + (row_size-column_size)//2 - 1, row_size)))
18611861

18621862
# Next we simply delete row by row. Note that A is still modified here...
18631863
while (B.rank() == column_size):

0 commit comments

Comments
 (0)