${c[3]}$ '
html += f'${c[2]}$ '
@@ -914,7 +930,7 @@ def get_aliases():
}
for ky in aliases:
nt = aliases[ky][0]
- label = "%sT%s"% nt
+ label = "%sT%s" % nt
aliases[ky] = siblings[label][:]
if nt not in aliases[ky]:
aliases[ky].append(nt)
diff --git a/lmfdb/genus2_curves/g2c_test_pages.py b/lmfdb/genus2_curves/g2c_test_pages.py
index 59dc418fa5..c9b6870260 100644
--- a/lmfdb/genus2_curves/g2c_test_pages.py
+++ b/lmfdb/genus2_curves/g2c_test_pages.py
@@ -13,7 +13,7 @@ def test_all_pages(self):
n = 0
for c in db.g2c_curves.search({}, ['label','class']):
l = c['label'].split('.')
- url = "Genus2Curve/Q/%s/%s/%s/%s"%(l[0],l[1],l[2],l[3])
+ url = "Genus2Curve/Q/%s/%s/%s/%s" % (l[0],l[1],l[2],l[3])
print("Checking home page for genus 2 curve " + c['label'])
try:
n = n+1
@@ -23,7 +23,7 @@ def test_all_pages(self):
print("Internal server error on page " + url)
errors.append(url)
continue
- url = "Genus2Curve/Q/%s/%s/"%(l[0],l[1])
+ url = "Genus2Curve/Q/%s/%s/" % (l[0],l[1])
print("Checking home page for genus 2 isogeny class " + c['class'])
try:
n = n+1
@@ -36,6 +36,6 @@ def test_all_pages(self):
if not errors:
print("Tested %s pages with no errors" % n)
else:
- print("Tested %d pages with %d errors occurring on the following pages:" %(n,len(errors)))
+ print("Tested %d pages with %d errors occurring on the following pages:" % (n,len(errors)))
for url in errors:
print(url)
diff --git a/lmfdb/genus2_curves/main.py b/lmfdb/genus2_curves/main.py
index 9aecd04370..9e010a2a26 100644
--- a/lmfdb/genus2_curves/main.py
+++ b/lmfdb/genus2_curves/main.py
@@ -582,11 +582,11 @@ class G2C_download(Downloader):
MathCol("analytic_rank", "g2c.analytic_rank", "Rank*"),
MathCol("two_selmer_rank", "g2c.two_selmer_rank", "2-Selmer rank", default=False),
ListCol("torsion_subgroup", "g2c.torsion", "Torsion",
- lambda tors: r"\oplus".join([r"\Z/%s\Z"%n for n in literal_eval(tors)]) if tors != "[]" else r"\mathsf{trivial}",
+ lambda tors: r"\oplus".join([r"\Z/%s\Z" % n for n in literal_eval(tors)]) if tors != "[]" else r"\mathsf{trivial}",
mathmode=True, align="center"),
- ProcessedCol("geom_end_alg", "g2c.geom_end_alg", r"$\textrm{End}^0(J_{\overline\Q})$", lambda v: r"\(%s\)"%geom_end_alg_name(v),
+ ProcessedCol("geom_end_alg", "g2c.geom_end_alg", r"$\textrm{End}^0(J_{\overline\Q})$", lambda v: r"\(%s\)" % geom_end_alg_name(v),
short_title="Qbar-end algebra", align="center"),
- ProcessedCol("end_alg", "g2c.end_alg", r"$\textrm{End}^0(J)$", lambda v: r"\(%s\)"%end_alg_name(v), short_title="Q-end algebra", align="center", default=False),
+ ProcessedCol("end_alg", "g2c.end_alg", r"$\textrm{End}^0(J)$", lambda v: r"\(%s\)" % end_alg_name(v), short_title="Q-end algebra", align="center", default=False),
CheckCol("is_gl2_type", "g2c.gl2type", r"$\GL_2\textsf{-type}$", short_title="GL2-type", default=False),
ProcessedCol("st_label", "g2c.st_group", "Sato-Tate", st_display_knowl, short_title='Sato-Tate group', align="center", default=False),
ProcessedCol("non_maximal_primes", "g2c.galois_rep.non_maximal_primes", "Nonmaximal primes",
@@ -605,9 +605,9 @@ class G2C_download(Downloader):
CheckCol("has_square_sha", "g2c.analytic_sha", "Square Ш*", default=False),
MathCol("analytic_sha", "g2c.analytic_sha", "Analytic Ш*", default=False),
ProcessedCol("tamagawa_product", "g2c.tamagawa", "Tamagawa", lambda v: web_latex(factor(v)), short_title="Tamagawa product", align="center", default=False),
- ProcessedCol("regulator", "g2c.regulator", "Regulator", lambda v: r"\(%.6f\)"%v, align="right", default=False),
- ProcessedCol("real_period", "g2c.real_period", "Real period", lambda v: r"\(%.6f\)"%v, align="right", default=False),
- ProcessedCol("leading_coeff", "g2c.bsd_invariants", "Leading coefficient", lambda v: r"\(%.6f\)"%v, align="right", default=False),
+ ProcessedCol("regulator", "g2c.regulator", "Regulator", lambda v: r"\(%.6f\)" % v, align="right", default=False),
+ ProcessedCol("real_period", "g2c.real_period", "Real period", lambda v: r"\(%.6f\)" % v, align="right", default=False),
+ ProcessedCol("leading_coeff", "g2c.bsd_invariants", "Leading coefficient", lambda v: r"\(%.6f\)" % v, align="right", default=False),
ListCol("igusa_clebsch_inv", "g2c.igusa_clebsch_invariants", "Igusa-Clebsch invariants", lambda v: v.replace("'",""), short_title="Igusa-Clebsch invariants", mathmode=True, default=False),
ListCol("igusa_inv", "g2c.igusa_invariants", "Igusa invariants", lambda v: v.replace("'",""), short_title="Igusa invariants", mathmode=True, default=False),
ListCol("g2_inv", "g2c.g2_invariants", "G2-invariants", lambda v: v.replace("'",""), short_title="G2-invariants", mathmode=True, default=False),
@@ -924,7 +924,7 @@ def g2c_code(**args):
Ccode = C.get_code()
lang = args['download_type']
code = "%s %s code for working with genus 2 curve %s\n\n" % (Comment[lang],Fullname[lang],label)
- if lang=='gp':
+ if lang == 'gp':
lang = 'pari'
for k in sorted_code_names:
if lang in Ccode[k]:
diff --git a/lmfdb/groups/abstract/circles.py b/lmfdb/groups/abstract/circles.py
index b6657fe5f1..2234b925b4 100644
--- a/lmfdb/groups/abstract/circles.py
+++ b/lmfdb/groups/abstract/circles.py
@@ -500,13 +500,13 @@ def arrange_ring(radii, colors, R0, rmax):
else:
equal_centers = True
for i in range(len(placed)):
- if placed[i] + placed[(i+1)%len(placed)] > dist + eps:
+ if placed[i] + placed[(i+1) % len(placed)] > dist + eps:
equal_centers = False
break
if not equal_centers:
theta_diffs = []
for i, r in enumerate(placed):
- nextr = placed[(i+1)%len(placed)]
+ nextr = placed[(i+1) % len(placed)]
theta_diffs.append((1 - (r + nextr)**2 / (2*Rc**2)).arccos())
thetasum = sum(theta_diffs)
if thetasum > 2*pi + eps:
diff --git a/lmfdb/groups/abstract/groups_test_pages.py b/lmfdb/groups/abstract/groups_test_pages.py
index 466e89ee4f..649c565d12 100644
--- a/lmfdb/groups/abstract/groups_test_pages.py
+++ b/lmfdb/groups/abstract/groups_test_pages.py
@@ -107,4 +107,4 @@ def all_small_groups(self, maxord=None, chunksize=1000):
bins[i] += 1
for i, b in enumerate(bins):
d = 100*float(b)/total
- print('%.2f\t|' %((i + 0.5)*h + times[0]) + '-'*(int(d)-1) + '| - %.2f%%' % d)
+ print('%.2f\t|' % ((i + 0.5)*h + times[0]) + '-'*(int(d)-1) + '| - %.2f%%' % d)
diff --git a/lmfdb/groups/abstract/main.py b/lmfdb/groups/abstract/main.py
index 768d522380..6f5bd9ffa7 100644
--- a/lmfdb/groups/abstract/main.py
+++ b/lmfdb/groups/abstract/main.py
@@ -451,7 +451,7 @@ def create_boolean_subgroup_string(sgp, type="normal"):
"nonsolvable": display_knowl("group.solvable", "nonsolvable"),
}
if getattr(sgp,'normal'): #if gp isn't normal we don't store direct/semidirect
- norm_attr ={"direct": f"a {display_knowl('group.direct_product', 'direct factor')}","semidirect": f"a {display_knowl('group.semidirect_product', 'semidirect factor')}"}
+ norm_attr = {"direct": f"a {display_knowl('group.direct_product', 'direct factor')}","semidirect": f"a {display_knowl('group.semidirect_product', 'semidirect factor')}"}
overall_display.update(norm_attr)
if type == "normal":
@@ -622,7 +622,7 @@ def index():
info["search_array"] = ComplexCharSearchArray()
return complex_char_search(info)
elif search_type in ["ConjugacyClasses"]: # no random since lots of groups with cc don't have characters also computed
- info["search_array"]=ConjugacyClassSearchArray()
+ info["search_array"] = ConjugacyClassSearchArray()
return conjugacy_class_search(info)
info["stats"] = GroupStats()
info["count"] = 50
@@ -738,7 +738,7 @@ def by_abelian_label(label):
primary = canonify_abelian_label(label)
# Avoid database error on a hopeless search
dblabel = None
- if not [z for z in primary if z>2**31-1]:
+ if not [z for z in primary if z > 2**31-1]:
dblabel = db.gps_groups.lucky(
{"abelian": True, "primary_abelian_invariants": primary}, "label"
)
@@ -1003,7 +1003,7 @@ def get_cc_url(gp_order, gp_counter, label, highlight):
if highlight_col is None:
return label
else:
- return "" + label + " "
+ return "" + label + " "
def field_knowl(fld):
from lmfdb.number_fields.web_number_field import WebNumberField
@@ -1491,7 +1491,7 @@ def diagram_js(gp, layers, display_opts, aut=False, normal=False):
if not aut and not gp.outer_equivalence:
ilayer += 2
iorder += 2
- if gp.outer_equivalence and ilayer>3:
+ if gp.outer_equivalence and ilayer > 3:
ilayer -= 2
ll = [
[
@@ -1532,7 +1532,7 @@ def diagram_js_string(gp, only=None):
for i, pair in enumerate([("subgroup", ""), ("subgroup", "aut"), ("normal", ""), ("normal", "aut")]):
sub_all, sub_aut = pair
if (only is None or only == pair) and gp.diagram_count(sub_all, sub_aut, limit=limit):
- glist[i], order_lookup[i] = diagram_js(gp, gp.subgroup_lattice(sub_all, sub_aut), display_opts, aut=bool(sub_aut), normal=(sub_all=="normal"))
+ glist[i], order_lookup[i] = diagram_js(gp, gp.subgroup_lattice(sub_all, sub_aut), display_opts, aut=bool(sub_aut), normal=(sub_all == "normal"))
if any(glist):
return f'var [sdiagram,glist] = make_sdiagram("subdiagram", "{gp.label}", {glist}, {order_lookup}, {display_opts["layers"]});', display_opts
@@ -2344,14 +2344,14 @@ def __init__(self):
("321", "other")]),
)
# Numbers of things boxes
- number_subgroups= TextBox(
+ number_subgroups = TextBox(
name="number_subgroups",
label="Number of subgroups",
knowl="group.subgroup",
example="3",
example_span="4, or a range like 3..5",
)
- number_normal_subgroups= TextBox(
+ number_normal_subgroups = TextBox(
name="number_normal_subgroups",
label="Number of normal subgroups",
knowl="group.subgroup.normal",
@@ -2728,7 +2728,7 @@ def cc_data(gp, label, typ="complex", representative=None):
ans += " Size of class: {}".format(wacc.size)
ans += " Order of elements: {}".format(wacc.order)
if wacc.centralizer is None:
- ans +=" Centralizer: not computed"
+ ans += " Centralizer: not computed"
else:
group = cc_data_to_gp_label(wacc.group_order,wacc.group_counter)
centralizer = f"{group}.{wacc.centralizer}"
diff --git a/lmfdb/groups/abstract/stats.py b/lmfdb/groups/abstract/stats.py
index 9e22a8c241..49ebc9fb06 100644
--- a/lmfdb/groups/abstract/stats.py
+++ b/lmfdb/groups/abstract/stats.py
@@ -113,7 +113,7 @@ def nilp_qformatter(nilp):
def stype_insert_knowls(s):
L = re.split("(,? ?(?:(?:and)|(?:or)|(?:not))? )", s)
for i in range(len(L)):
- if i%2 == 0 and L[i] in group_knowls:
+ if i % 2 == 0 and L[i] in group_knowls:
L[i] = display_knowl(group_knowls[L[i]], L[i])
return "".join(L)
stype_klookup = {stype: stype_insert_knowls(desc) for (stype, desc) in stype_lookup.items()}
diff --git a/lmfdb/groups/abstract/verify.py b/lmfdb/groups/abstract/verify.py
index e3912caab2..5ece487fe2 100644
--- a/lmfdb/groups/abstract/verify.py
+++ b/lmfdb/groups/abstract/verify.py
@@ -66,5 +66,5 @@ def test_small_gps(sample_gp):
for i in range(10):
x = db.gps_groups_test.random({'order': {"$lte" :2000}})
- sample_gp =db.gps_groups_test.lucky({'label': x})
+ sample_gp = db.gps_groups_test.lucky({'label': x})
test_small_gps(sample_gp)
diff --git a/lmfdb/groups/abstract/web_groups.py b/lmfdb/groups/abstract/web_groups.py
index e05c73af3b..53eaf19497 100644
--- a/lmfdb/groups/abstract/web_groups.py
+++ b/lmfdb/groups/abstract/web_groups.py
@@ -147,7 +147,7 @@ def split_matrix_list_Fq(longList,d, Fqfld):
def split_matrix_Fq_add_al(longList,d):
# for magma definition of Fq
- longList = [0 if x == -1 else 1 if x ==0 else f"al^{x}" for x in longList]
+ longList = [0 if x == -1 else 1 if x == 0 else f"al^{x}" for x in longList]
return str([longList[i:i+d] for i in range(0,d**2,d)]).replace("'", "")
@@ -276,9 +276,9 @@ def abelian_get_elementary(snf):
def compress_perm(perms, cutoff=150, sides=70):
- if len(perms) < cutoff or sides >=cutoff:
- return r'$\langle'+ perms + r'\rangle$'
- short_perm = r'$\langle'+ perms[:sides]
+ if len(perms) < cutoff or sides >= cutoff:
+ return r'$\langle' + perms + r'\rangle$'
+ short_perm = r'$\langle' + perms[:sides]
while perms[sides] != ")": # will always have ")" as long as sides < cutoff (see above)
short_perm = short_perm + perms[sides]
sides += 1
@@ -289,7 +289,7 @@ def compress_perm(perms, cutoff=150, sides=70):
def compress_pres(pres, cutoff=150, sides=70):
if len(pres) < cutoff:
return f"${pres}$"
- short_pres = '${'+ pres[:sides]
+ short_pres = '${' + pres[:sides]
while pres[sides] != "=" and sides < len(pres)-1:
short_pres = short_pres + pres[sides]
sides += 1
@@ -398,15 +398,15 @@ def G_gens(self):
elif rep_type == "PC":
gens = G.GeneratorsOfGroup()
gens = [gens[z-1] for z in repn['gens']]
- elif rep_type=="Perm":
+ elif rep_type == "Perm":
n = repn["d"]
gens = [SymmetricGroup(n)(Permutations(n).unrank(z)) for z in repn["gens"]]
- elif rep_type=="Lie":
+ elif rep_type == "Lie":
# problems here
# projective groups need to be accounted for
gens = [self.decode(g) for g in repn[0]["gens"]]
elif rep_type in ['GLZ', 'GLFp','GLZN','GLZq','GLFq']:
- gens=[self.decode(g) for g in repn["gens"]]
+ gens = [self.decode(g) for g in repn["gens"]]
return gens
@lazy_attribute
@@ -994,20 +994,20 @@ def subgp_paragraph(self):
if self.number_normal_subgroups is None:
return " "
elif self.number_characteristic_subgroups is None:
- return """There are """ +str(self.number_normal_subgroups) + " normal subgroups. "+normalcolor
+ return """There are """ + str(self.number_normal_subgroups) + " normal subgroups.
"+normalcolor
else:
- ret_str = """ There are """ +str(self.number_normal_subgroups) + """ normal subgroups """
+ ret_str = """ There are """ + str(self.number_normal_subgroups) + """ normal subgroups """
if self.number_characteristic_subgroups < self.number_normal_subgroups:
ret_str = ret_str + """ (""" + str(self.number_characteristic_subgroups) + " characteristic ).
"+charcolor+" "+normalcolor
else:
- ret_str=ret_str+ ", and all normal subgroups are characteristic.
"+charcolor
+ ret_str = ret_str + ", and all normal subgroups are characteristic.
"+charcolor
return ret_str
elif self.number_normal_subgroups < self.number_subgroups:
- ret_str = "There are " + str(self.number_subgroups) + """ subgroups in """ + str(self.number_subgroup_classes) + """ conjugacy classes , """ +str(self.number_normal_subgroups) + """ normal """
+ ret_str = "There are " + str(self.number_subgroups) + """ subgroups in """ + str(self.number_subgroup_classes) + """ conjugacy classes , """ + str(self.number_normal_subgroups) + """ normal """
else:
- ret_str = """ There are """ +str(self.number_subgroups) + """ subgroups , all normal"""
+ ret_str = """ There are """ + str(self.number_subgroups) + """ subgroups , all normal"""
if self.number_characteristic_subgroups < self.number_normal_subgroups:
- ret_str = ret_str + """ (""" + str(self.number_characteristic_subgroups) + """ characteristic ).
"""+charcolor+" "+normalcolor
+ ret_str = ret_str + """ (""" + str(self.number_characteristic_subgroups) + """ characteristic ).
"""+charcolor+" "+normalcolor
else:
ret_str = ret_str + ", and all normal subgroups are characteristic.
"+charcolor
return ret_str
@@ -1204,7 +1204,7 @@ def _subgroup_summary(self, in_profile):
if self.subgroup_index_bound != 0:
if self.normal_index_bound is None or self.normal_index_bound == 0:
return f"All subgroup of index up to {self.subgroup_index_bound} (order at least {self.subgroup_order_bound}) are shown, as well as all normal subgroups of any index. "
- elif self.normal_order_bound !=0:
+ elif self.normal_order_bound != 0:
return f"All subgroup of index up to {self.subgroup_index_bound} (order at least {self.subgroup_order_bound}) are shown, as well as normal subgroups of index up to {self.normal_index_bound} or of order up to {self.normal_order_bound}. "
else:
return f"All subgroup of index up to {self.subgroup_index_bound} (order at least {self.subgroup_order_bound}) are shown, as well as normal subgroups of index up to {self.normal_index_bound}. "
@@ -1245,7 +1245,7 @@ def impose_limit(n):
return n
if sub_all == "subgroup":
if sub_aut:
- subs = [H for H in self.subgroups.values() if (H.quotient_order <= self.subgroup_index_bound) or (self.subgroup_index_bound==0)]
+ subs = [H for H in self.subgroups.values() if (H.quotient_order <= self.subgroup_index_bound) or (self.subgroup_index_bound == 0)]
if any(H.aut_label is None or H.diagramx is None for H in subs):
# We don't know subgroups up to automorphism or can't lay out the subgroups
return 0
@@ -1254,7 +1254,7 @@ def impose_limit(n):
if self.outer_equivalence:
# We don't know subgroups up to conjugacy
return 0
- subs = [H for H in self.subgroups.values() if (H.quotient_order <= self.subgroup_index_bound) or (self.subgroup_index_bound==0)]
+ subs = [H for H in self.subgroups.values() if (H.quotient_order <= self.subgroup_index_bound) or (self.subgroup_index_bound == 0)]
if any(H.diagramx is None for H in subs):
# No layout computed
return 0
@@ -1603,17 +1603,17 @@ def display_wreath_product(self):
return None
wpd = self.wreath_data
from lmfdb.galois_groups.transitive_group import transitive_group_display_knowl
- if len(wpd)==3:
+ if len(wpd) == 3:
[A, B, nt] = wpd
# try to guess actual group for A from the latex
cn_re = re.compile(r'^C_\{?(\d+)\}?$')
- cn_match= cn_re.match(A)
+ cn_match = cn_re.match(A)
if cn_match:
order = cn_match.group(1)
Agroup = db.gps_groups.lucky({'order':int(order), 'cyclic':True})
A = Agroup['label']
A = abstract_group_display_knowl(Agroup['label'])
- elif A=='S_3':
+ elif A == 'S_3':
A = abstract_group_display_knowl('6.1')
else:
A = rf'${sub_paren(A)}$ '
@@ -1627,7 +1627,7 @@ def display_wreath_product(self):
B = [z for z in allsubs if z.short_label == B][0]
B = B.subgroup_tex_parened
B = transitive_group_display_knowl(nt, rf'${B}$')
- return A+r"$\ \wr\ $"+ B
+ return A+r"$\ \wr\ $" + B
@lazy_attribute
def semidirect_products(self):
@@ -1848,7 +1848,7 @@ def pcgs_expos_to_str(self, vec):
def pcgs_as_str(self, elt):
# take an element of a pcgs in GAP and make our string form
- if elt=='':
+ if elt == '':
return ''
return self.pcgs_expos_to_str(self.pcgs.ExponentsOfPcElement(elt))
@@ -1936,7 +1936,7 @@ def decode_as_matrix(self, code, rep_type, as_str=False, LieType=False, ListForm
else:
R, N, k, d, rep_type = self._matrix_coefficient_data(rep_type)
if rep_type == "GLFq":
- q=N**k
+ q = N**k
R = GF(q, modulus="primitive", names=('a',))
(a,) = R._first_ngens(1) #need a for powers
L = ZZ(code).digits(N)
@@ -1946,7 +1946,7 @@ def pad(X, m):
L = pad(L, k * d**2)
if rep_type == "GLFq":
L = [R(L[i:i+k]) for i in range(0, k*d**2, k)]
- L = [l.log(a) if l!= 0 else -1 for l in L] #-1 represents 0, to distinguish from a^0
+ L = [l.log(a) if l != 0 else -1 for l in L] #-1 represents 0, to distinguish from a^0
elif rep_type == "GLZ":
shift = (N - 1) // 2
L = [c - shift for c in L]
@@ -1965,16 +1965,16 @@ def pad(X, m):
st_latex = r'\left(\begin{array}{'+rs+'}'
for i in range(d):
for j in range(d):
- if j0:
- st_latex =st_latex + r'\alpha^{' +str(L[d*i+j]) + '}' + endstr
+ if L[d*i+j] > 0:
+ st_latex = st_latex + r'\alpha^{' + str(L[d*i+j]) + '}' + endstr
elif L[d*i+j] == 0:
- st_latex = st_latex+ str(1)+ endstr
+ st_latex = st_latex + str(1) + endstr
else:
- st_latex = st_latex+ str(0)+ endstr
+ st_latex = st_latex + str(0) + endstr
st_latex = st_latex + r'\end{array}\right)'
return st_latex
return latex(x)
@@ -1990,7 +1990,7 @@ def decode(self, code, rep_type=None, as_str=False):
return "1"
return self.decode_as_pcgs(code, as_str=as_str)
else:
- return self.decode_as_matrix(code, rep_type=rep_type, as_str=as_str, LieType=(rep_type=="Lie"))
+ return self.decode_as_matrix(code, rep_type=rep_type, as_str=as_str, LieType=(rep_type == "Lie"))
@lazy_attribute
def pc_code(self):
@@ -2116,7 +2116,7 @@ def print_elt(vec):
s = var_name(i) + s
first_pass = False
else:
- s = var_name(i)+ '*' + s
+ s = var_name(i) + '*' + s
elif e > 1:
if first_pass:
@@ -2204,7 +2204,7 @@ def representation_line(self, rep_type, skip_head=False):
elif rep_type == "PC":
pres = self.presentation()
if not skip_head: #add copy button in certain cases
- pres_raw=self.presentation_raw()
+ pres_raw = self.presentation_raw()
pres = raw_typeset(pres_raw,compress_pres(pres))
if self.live(): # skip code snippet on live group for now
return f'{display_knowl("group.presentation", "Presentation")}: {pres} '
@@ -2221,14 +2221,14 @@ def representation_line(self, rep_type, skip_head=False):
return f'{display_knowl("group.presentation", "Presentation")}: {pres} {code_cmd}'
elif rep_type == "Perm":
gens = ", ".join(self.decode_as_perm(g, as_str=True) for g in rdata["gens"])
- gens=raw_typeset(gens,compress_perm(gens))
+ gens = raw_typeset(gens,compress_perm(gens))
d = rdata["d"]
if self.live(): # skip code snippet on live group for now
code_cmd = ""
else:
code_cmd = self.create_snippet('permutation')
if d >= 10:
- gens=f"Degree ${d}$" + gens
+ gens = f"Degree ${d}$" + gens
return f'{display_knowl("group.permutation_gens", "Permutation group")}: {gens} {code_cmd}'
else:
# Matrix group
@@ -2481,8 +2481,8 @@ def live_composition_factors(self):
# is only done for one of them, and only if the user clicks
# on the link
basiclist = [(url_for(".by_abelian_label", label=z[0]),
- "C_{%d}"%z[0],
- "" if z[1] == 1 else " x %d "% z[1]
+ "C_{%d}" % z[0],
+ "" if z[1] == 1 else " x %d " % z[1]
)
for z in theorder]
@@ -2733,14 +2733,14 @@ def code_snippets(self):
nZN = self.representations["GLZN"]["d"]
N = self.representations["GLZN"]["p"]
LZN = [self.decode_as_matrix(g, "GLZN", ListForm=True) for g in self.representations["GLZN"]["gens"]]
- LZNsplit ="[" + ",".join([split_matrix_list_ZN(self.decode_as_matrix(g, "GLZN", ListForm=True) , nZN, N) for g in self.representations["GLZN"]["gens"]]) +"]"
+ LZNsplit = "[" + ",".join([split_matrix_list_ZN(self.decode_as_matrix(g, "GLZN", ListForm=True) , nZN, N) for g in self.representations["GLZN"]["gens"]]) + "]"
else:
nZN, N, LZN, LZNsplit = None, None, None, None
if "GLZq" in self.representations:
nZq = self.representations["GLZq"]["d"]
Zq = self.representations["GLZq"]["q"]
LZq = [self.decode_as_matrix(g, "GLZq", ListForm=True) for g in self.representations["GLZq"]["gens"]]
- LZqsplit ="[" + ",".join([split_matrix_list_ZN(self.decode_as_matrix(g, "GLZq", ListForm=True) , nZq, Zq) for g in self.representations["GLZq"]["gens"]]) +"]"
+ LZqsplit = "[" + ",".join([split_matrix_list_ZN(self.decode_as_matrix(g, "GLZq", ListForm=True) , nZq, Zq) for g in self.representations["GLZq"]["gens"]]) + "]"
else:
nZq, Zq, LZq, LZqsplit = None, None, None, None
# add below for GLFq implementation
@@ -2748,7 +2748,7 @@ def code_snippets(self):
nFq = self.representations["GLFq"]["d"]
Fq = self.representations["GLFq"]["q"]
LFq = ",".join([split_matrix_Fq_add_al(self.decode_as_matrix(g, "GLFq", ListForm=True), nFq ) for g in self.representations["GLFq"]["gens"]])
- LFqsplit = "[" + ",".join([split_matrix_list_Fq(self.decode_as_matrix(g, "GLFq", ListForm=True), nFq, Fq) for g in self.representations["GLFq"]["gens"]]) +"]"
+ LFqsplit = "[" + ",".join([split_matrix_list_Fq(self.decode_as_matrix(g, "GLFq", ListForm=True), nFq, Fq) for g in self.representations["GLFq"]["gens"]]) + "]"
else:
nFq, Fq, LFq, LFqsplit = None, None, None, None
@@ -3073,7 +3073,7 @@ def sub(self):
data={'order': order, 'G': None, 'abelian': self.abelian,'cyclic': self.cyclic,
# What if aut_label is set?
'aut_group': self.aut_label, 'aut_order': None,
- 'pgroup':len(ZZ(order).abs().factor())==1})
+ 'pgroup':len(ZZ(order).abs().factor()) == 1})
return newgroup
if self.subgroup_order == 6561:
gp = WebAbstractGroup(self.subgroup, None)
@@ -3083,7 +3083,7 @@ def sub(self):
data={'order': order, 'G': None, 'abelian': self.abelian,'cyclic': self.cyclic,
# What if aut_label is set?
'aut_group': self.aut_label, 'aut_order': None, 'sub_missing' : True,
- 'pgroup':len(ZZ(order).abs().factor())==1})
+ 'pgroup':len(ZZ(order).abs().factor()) == 1})
return newgroup
for prop in [
"pgroup",
@@ -3287,7 +3287,7 @@ def __init__(self, group, label, data=None):
# Allows us to use representative from a Galois group
def force_repr(self, newrep):
- newrep=newrep.replace(' ','')
+ newrep = newrep.replace(' ','')
self.representative = newrep
self.force_repr_elt = True
diff --git a/lmfdb/groups/glnC/main.py b/lmfdb/groups/glnC/main.py
index 9f23c613be..e950fcda7f 100644
--- a/lmfdb/groups/glnC/main.py
+++ b/lmfdb/groups/glnC/main.py
@@ -116,7 +116,7 @@ def get_url(label):
db_cols=["label", "group", "order", "dim"])
-glnC_columns.dummy_download=True
+glnC_columns.dummy_download = True
def glnC_postprocess(res, info, query):
@@ -176,7 +176,7 @@ def render_glnC_group(args):
def make_knowl(title, knowlid):
- return '%s '%(title, knowlid, title)
+ return '%s ' % (title, knowlid, title)
@glnC_page.route("/Completeness")
diff --git a/lmfdb/groups/glnQ/main.py b/lmfdb/groups/glnQ/main.py
index 5229b65bc8..8b65e875d7 100644
--- a/lmfdb/groups/glnQ/main.py
+++ b/lmfdb/groups/glnQ/main.py
@@ -28,7 +28,7 @@ def learnmore_list():
('Labeling convention', url_for(".labels_page")) ]
def learnmore_list_remove(matchstring):
- return filter(lambda t:t[0].find(matchstring) <0, learnmore_list())
+ return filter(lambda t:t[0].find(matchstring) < 0, learnmore_list())
def sub_label_is_valid(lab):
return abstract_subgroup_label_regex.fullmatch(lab)
@@ -48,7 +48,7 @@ def index():
bread = get_bread()
if request.args:
return group_search(info)
- info['order_list']= ['1-10', '20-100', '101-200']
+ info['order_list'] = ['1-10', '20-100', '101-200']
return render_template("glnQ-index.html", title=r"Finite subgroups of $\GL(n,\Q)$", bread=bread, info=info, learnmore=learnmore_list(), credit=credit_string)
@@ -106,7 +106,7 @@ def get_url(label):
MathCol("order", "group.order", "Order"),
MathCol("dim", "group.dimension", "Dimension")],
db_cols=["label", "group", "order", "dim"])
-glnQ_columns.dummy_download=True
+glnQ_columns.dummy_download = True
def glnQ_postprocess(res, info, query):
tex_names = {rec["label"]: rec["tex_name"] for rec in db.gps_groups.search({"label": {"$in": [gp["group"] for gp in res]}}, ["label", "tex_name"])}
@@ -161,7 +161,7 @@ def render_glnQ_group(args):
credit=credit_string)
def make_knowl(title, knowlid):
- return '%s '%(title, knowlid, title)
+ return '%s ' % (title, knowlid, title)
@glnQ_page.route("/Completeness")
def completeness_page():
diff --git a/lmfdb/hecke_algebras/main.py b/lmfdb/hecke_algebras/main.py
index 5ae9445098..c70008e761 100644
--- a/lmfdb/hecke_algebras/main.py
+++ b/lmfdb/hecke_algebras/main.py
@@ -80,8 +80,8 @@ def hecke_algebras_by_label(lab):
def hecke_algebras_by_orbit_label(lab):
if db.hecke_orbits.exists({'orbit_label': lab}):
- sp=split_hecke_algebras_orbit_label(lab)
- ol=sp[0]+'.'+sp[1]+'.'+sp[2]
+ sp = split_hecke_algebras_orbit_label(lab)
+ ol = sp[0]+'.'+sp[1]+'.'+sp[2]
return render_hecke_algebras_webpage(label=ol)
if hecke_algebras_orbit_label_regex.match(lab):
flash_error("The Hecke algebra orbit %s is not recorded in the database or the label is invalid", lab)
@@ -103,13 +103,13 @@ def download_search(info):
c = download_comment_prefix[lang]
s = '\n'
if 'ell' in info["query"]:
- s += c + ' Hecke algebras downloaded from the LMFDB on %s. Found %s algebras. The data is given in the following format: it is a list of lists, each containing level, weight and the Hecke orbits for which l-adic data is available.\n\n'%(mydate, len(res))
+ s += c + ' Hecke algebras downloaded from the LMFDB on %s. Found %s algebras. The data is given in the following format: it is a list of lists, each containing level, weight and the Hecke orbits for which l-adic data is available.\n\n' % (mydate, len(res))
else:
- s += c + ' Hecke algebras downloaded from the LMFDB on %s. Found %s algebras. The data is given in the following format: it is a list of lists, each containing level, weight, list of the first 10 Hecke operators (to download more operators for a given algebra, please visit its webpage).\n\n'%(mydate, len(res))
+ s += c + ' Hecke algebras downloaded from the LMFDB on %s. Found %s algebras. The data is given in the following format: it is a list of lists, each containing level, weight, list of the first 10 Hecke operators (to download more operators for a given algebra, please visit its webpage).\n\n' % (mydate, len(res))
# The list entries are matrices of different sizes. Sage and gp
# do not mind this but Magma requires a different sort of list.
- list_start = '[*' if lang=='magma' else '['
- list_end = '*]' if lang=='magma' else ']'
+ list_start = '[*' if lang == 'magma' else '['
+ list_end = '*]' if lang == 'magma' else ']'
s += download_assignment_start[lang] + list_start + '\\\n'
mat_start = "Mat(" if lang == 'gp' else "Matrix("
mat_end = "~)" if lang == 'gp' else ")"
@@ -160,14 +160,14 @@ def hecke_algebras_search(info, query):
('ell','characteristic')):
parse_ints(info, query, field, name)
if info.get('ell'):
- if int(info.get('ell'))>13:
+ if int(info.get('ell')) > 13:
flash_error("No data for primes or integers greater than $13$ is available")
return redirect(url_for(".hecke_algebras_render_webpage"))
elif int(info.get('ell')) not in [2,3,5,7,11,13]:
flash_error("No data for integers which are not primes")
return redirect(url_for(".hecke_algebras_render_webpage"))
if info.get('orbit_label'):
- check=[int(i) for i in info['orbit_label'].split(".")]
+ check = [int(i) for i in info['orbit_label'].split(".")]
if 'level' in info and info.get('level'):
try:
for field in ['level','weight']:
@@ -176,11 +176,11 @@ def hecke_algebras_search(info, query):
except ValueError:
flash_error("Orbit label %s and input Level or Weight are not compatible", info.get('orbit_label'))
return redirect(url_for(".hecke_algebras_render_webpage"))
- if int(info.get('level'))!=check[0]:
+ if int(info.get('level')) != check[0]:
flash_error("Orbit label %s and Level %s are not compatible inputs", info.get('orbit_label'), info.get('level'))
return redirect(url_for(".hecke_algebras_render_webpage"))
if 'weight' in info and info.get('weight'):
- if int(info.get('weight'))!=check[1]:
+ if int(info.get('weight')) != check[1]:
flash_error("Orbit label %s and Weight %s are not compatible inputs", info.get('orbit_label'), info.get('weight'))
return redirect(url_for(".hecke_algebras_render_webpage"))
if 'ell' in info and info.get('ell'):
@@ -218,9 +218,9 @@ def render_hecke_algebras_webpage(**args):
bread = [('HeckeAlgebra', url_for(".hecke_algebras_render_webpage")), ('%s' % data['label'], ' ')]
credit = hecke_algebras_credit
- info['level']=int(data['level'])
- info['weight']= int(data['weight'])
- info['num_orbits']= int(data['num_orbits'])
+ info['level'] = int(data['level'])
+ info['weight'] = int(data['weight'])
+ info['num_orbits'] = int(data['num_orbits'])
dim_count = "not available"
proj = ['orbit_label','hecke_op','num_hecke_op','Zbasis','discriminant','disc_fac','Qbasis','Qalg_gen']
@@ -230,7 +230,7 @@ def render_hecke_algebras_webpage(**args):
if len(orb) != int(data['num_orbits']):
return search_input_error(info)
- dim_count=0
+ dim_count = 0
for v in orb:
ops = sage_eval(v['hecke_op'])
dim = int(matrix(ops[0]).nrows())
@@ -261,15 +261,15 @@ def render_hecke_algebras_webpage(**args):
info['dim_alg'] = dim_count
info['l_adic'] = l_range
info['properties'] = [
- ('Label', '%s' %info['label']),
- ('Level', '%s' %info['level']),
- ('Weight', '%s' %info['weight'])]
- if info['num_orbits']!=0:
+ ('Label', '%s' % info['label']),
+ ('Level', '%s' % info['level']),
+ ('Weight', '%s' % info['weight'])]
+ if info['num_orbits'] != 0:
info['friends'] = [('Newforms space ' + info['label'], url_for("cmf.by_url_space_label", level=info['level'], weight=info['weight'], char_orbit_label='a'))]
else:
info['friends'] = []
t = "Hecke algebra %s" % info['label']
- return render_template("hecke_algebras-single.html", info=info, credit=credit, title=t, bread=bread, properties=info['properties'], learnmore=learnmore_list(), friends=info['friends'], KNOWL_ID='hecke_algebra.%s'%(info['label']))
+ return render_template("hecke_algebras-single.html", info=info, credit=credit, title=t, bread=bread, properties=info['properties'], learnmore=learnmore_list(), friends=info['friends'], KNOWL_ID='hecke_algebra.%s' % (info['label']))
hecke_algebras_orbit_label_regex = re.compile(r'(\d+)\.(\d+)\.(\d+)\.(\d*)')
@@ -283,12 +283,12 @@ def render_hecke_algebras_webpage_l_adic(**args):
if 'orbit_label' in args and 'prime' in args:
lab = clean_input(args.get('orbit_label'))
if lab != args.get('orbit_label'):
- base_lab=".".join([split(lab)[i] for i in [0,1,2]])
+ base_lab = ".".join([split(lab)[i] for i in [0,1,2]])
return redirect(url_for('.render_hecke_algebras_webpage', label=base_lab), 301)
try:
ell = int(args.get('prime'))
except ValueError:
- base_lab=".".join([split(lab)[i] for i in [0,1,2]])
+ base_lab = ".".join([split(lab)[i] for i in [0,1,2]])
return redirect(url_for('.render_hecke_algebras_webpage', label=base_lab), 301)
data = db.hecke_ladic.lucky({'orbit_label': lab, 'ell': ell})
if data is None:
@@ -313,7 +313,7 @@ def render_hecke_algebras_webpage_l_adic(**args):
else:
f['idempotent_display'] = latex(matrix(sage_eval(f['idempotent'])))
else:
- f['idempotent_display']=latex(matrix([[1]]))
+ f['idempotent_display'] = latex(matrix([[1]]))
del f['idempotent']
f['download_id'] = [(i, url_for(".render_hecke_algebras_webpage_ell_download", orbit_label=f['orbit_label'], index=f['index'], prime=f['ell'], lang=i, obj='idempotents')) for i in ['magma','sage']] # for 'gp' the code does not work, since p-adics are not implemented
field = f.pop('field')
@@ -347,23 +347,23 @@ def render_hecke_algebras_webpage_l_adic(**args):
info['num_l_adic_orbits'] = len(res)
info['l_adic_orbits'] = res
- info['level']=int(data['level'])
- info['weight']= int(data['weight'])
- info['base_lab']=".".join([split(data['orbit_label'])[i] for i in [0,1,2]])
- info['orbit_label']= str(data['orbit_label'])
- info['ell']=int(data['ell'])
+ info['level'] = int(data['level'])
+ info['weight'] = int(data['weight'])
+ info['base_lab'] = ".".join([split(data['orbit_label'])[i] for i in [0,1,2]])
+ info['orbit_label'] = str(data['orbit_label'])
+ info['ell'] = int(data['ell'])
bread = [('HeckeAlgebra', url_for(".hecke_algebras_render_webpage")), ('%s' % info['base_lab'], url_for('.render_hecke_algebras_webpage', label=info['base_lab'])), ('%s' % info['ell'], ' ')]
credit = hecke_algebras_credit
info['properties'] = [
- ('Level', '%s' %info['level']),
- ('Weight', '%s' %info['weight']),
- ('Characteristic', '%s' %info['ell']),
- ('Orbit label', '%s' %info['orbit_label'])]
+ ('Level', '%s' % info['level']),
+ ('Weight', '%s' % info['weight']),
+ ('Characteristic', '%s' % info['ell']),
+ ('Orbit label', '%s' % info['orbit_label'])]
info['friends'] = [('Modular form ' + info['base_lab'], url_for("cmf.by_url_space_label", level=info['level'], weight=info['weight'], char_orbit_label='a'))]
t = "%s-adic and mod %s data for the Hecke algebra orbit %s" % (info['ell'], info['ell'], info['orbit_label'])
- return render_template("hecke_algebras_l_adic-single.html", info=info, credit=credit, title=t, bread=bread, properties=info['properties'], learnmore=learnmore_list(), friends=info['friends'], KNOWL_ID='hecke_algebra_l_adic.%s'%(info['orbit_label']))
+ return render_template("hecke_algebras_l_adic-single.html", info=info, credit=credit, title=t, bread=bread, properties=info['properties'], learnmore=learnmore_list(), friends=info['friends'], KNOWL_ID='hecke_algebra_l_adic.%s' % (info['orbit_label']))
#data quality pages
@@ -433,7 +433,7 @@ def download_hecke_algebras_full_lists_op(**args):
mat_end = "~)" if lang == 'gp' else ")"
def entry(r): return "".join([mat_start, str(r), mat_end])
- outstr = c + 'Hecke algebra for Gamma0(%s) and weight %s, orbit label %s. List of Hecke operators T_1, ..., T_%s. Downloaded from the LMFDB on %s. \n\n'%(res['level'], res['weight'], res['orbit_label'],res['num_hecke_op'], mydate)
+ outstr = c + 'Hecke algebra for Gamma0(%s) and weight %s, orbit label %s. List of Hecke operators T_1, ..., T_%s. Downloaded from the LMFDB on %s. \n\n' % (res['level'], res['weight'], res['orbit_label'],res['num_hecke_op'], mydate)
outstr += download_assignment_start[lang] + '[\\\n'
outstr += ",\\\n".join(entry(r) for r in [sage_eval(res['hecke_op'])[i] for i in range(res['num_hecke_op'])])
outstr += ']'
@@ -453,7 +453,7 @@ def download_hecke_algebras_full_lists_gen(**args):
mat_end = "~)" if lang == 'gp' else ")"
def entry(r): return "".join([mat_start,str(r),mat_end])
- outstr = c + 'Hecke algebra for Gamma0(%s) and weight %s, orbit label %s. List of generators for the algebra. Downloaded from the LMFDB on %s. \n\n'%(res['level'], res['weight'], res['orbit_label'], mydate)
+ outstr = c + 'Hecke algebra for Gamma0(%s) and weight %s, orbit label %s. List of generators for the algebra. Downloaded from the LMFDB on %s. \n\n' % (res['level'], res['weight'], res['orbit_label'], mydate)
outstr += download_assignment_start[lang] + '[\\\n'
outstr += ",\\\n".join([entry([list(k) for k in matrix(sqrt(len(r)), sqrt(len(r)), r).rows()]) for r in [[int(i) for i in j] for j in res['Zbasis']] ])
outstr += ']'
@@ -476,21 +476,21 @@ def render_hecke_algebras_webpage_ell_download(**args):
def download_hecke_algebras_full_lists_mod_op(**args):
label = str(args['orbit_label'])
- ell=int(args['prime'])
- index=int(args['index'])
+ ell = int(args['prime'])
+ index = int(args['index'])
res = db.hecke_ladic.lucky({'orbit_label': label, 'index': index, 'ell': ell})
mydate = time.strftime("%d %B %Y")
if res is None:
- return "No mod %s operators available"%ell
+ return "No mod %s operators available" % ell
lang = args['lang']
c = download_comment_prefix[lang]
- field='GF(%s), %s, %s, '%(res['ell'], sqrt(len(res['operators'][0])), sqrt(len(res['operators'][0])))
+ field = 'GF(%s), %s, %s, ' % (res['ell'], sqrt(len(res['operators'][0])), sqrt(len(res['operators'][0])))
mat_start = "Mat("+field if lang == 'gp' else "Matrix("+field
mat_end = "~)" if lang == 'gp' else ")"
def entry(r): return "".join([mat_start,str(r),mat_end])
- outstr = c + ' List of Hecke operators T_1, ..., T_%s mod %s for orbit %s index %s downloaded from the LMFDB on %s. \n\n'%(len(res['operators']), ell, label, index, mydate)
- outstr += download_assignment_start[lang] +'[\\\n'
+ outstr = c + ' List of Hecke operators T_1, ..., T_%s mod %s for orbit %s index %s downloaded from the LMFDB on %s. \n\n' % (len(res['operators']), ell, label, index, mydate)
+ outstr += download_assignment_start[lang] + '[\\\n'
outstr += ",\\\n".join([entry(r) for r in res['operators']])
outstr += ']'
outstr += download_assignment_end[lang]
@@ -500,24 +500,24 @@ def entry(r): return "".join([mat_start,str(r),mat_end])
def download_hecke_algebras_full_lists_id(**args):
label = str(args['orbit_label'])
- ell=int(args['prime'])
- index=int(args['index'])
+ ell = int(args['prime'])
+ index = int(args['index'])
idempotent = db.hecke_ladic.lucky({'orbit_label': label, 'index': index, 'ell': ell }, projection='idempotent')
mydate = time.strftime("%d %B %Y")
if idempotent is None:
- return "No mod %s operators available"%ell
+ return "No mod %s operators available" % ell
lang = args['lang']
c = download_comment_prefix[lang]
if lang == 'magma': #no idea for gp
- ladic = 'pAdicRing(%s : Precision :=200),'%ell
- elif lang== 'sage':
- ladic = 'Qp(%s, 200),'%ell
+ ladic = 'pAdicRing(%s : Precision :=200),' % ell
+ elif lang == 'sage':
+ ladic = 'Qp(%s, 200),' % ell
mat_start = "Mat("+ladic if lang == 'gp' else "Matrix("+ladic
mat_end = "~)" if lang == 'gp' else ")"
- outstr = c + ' Idempotent for the Hecke orbit %s mod %s and index %s downloaded from the LMFDB on %s. \n\n'%( label, ell, index, mydate)
- outstr += download_assignment_start[lang] +'['
+ outstr = c + ' Idempotent for the Hecke orbit %s mod %s and index %s downloaded from the LMFDB on %s. \n\n' % ( label, ell, index, mydate)
+ outstr += download_assignment_start[lang] + '['
outstr += " ".join([mat_start, idempotent, mat_end])
outstr += ']'
outstr += download_assignment_end[lang]
diff --git a/lmfdb/higher_genus_w_automorphisms/main.py b/lmfdb/higher_genus_w_automorphisms/main.py
index ee1a15d5b1..d07b7b3cc8 100644
--- a/lmfdb/higher_genus_w_automorphisms/main.py
+++ b/lmfdb/higher_genus_w_automorphisms/main.py
@@ -543,7 +543,7 @@ def parse_range2_extend(arg, key, parse_singleton=int, parse_endpoint=None, inst
group_order = g-b
else: #ag-b
group_order = int(a)*g-b
- elif a== '':
+ elif a == '':
group_order = g
else: #ag
group_order = int(a)*g
@@ -712,8 +712,8 @@ def render_family(args):
spname = False
else:
spname = True
- title = 'Family of genus ' + str(g) + ' curves with automorphism group $' + pretty_group +'$'
- smallgroup="[" + str(gn) + "," +str(gt) + "]"
+ title = 'Family of genus ' + str(g) + ' curves with automorphism group $' + pretty_group + '$'
+ smallgroup = "[" + str(gn) + "," + str(gt) + "]"
prop2 = [
('Label', label),
@@ -735,9 +735,9 @@ def render_family(args):
if spname:
info.update({'specialname': True})
- Lcc=[]
- Lall=[]
- Ltopo_rep=[] #List of topological representatives
+ Lcc = []
+ Lall = []
+ Ltopo_rep = [] #List of topological representatives
for dat in dataz:
if ast.literal_eval(dat['con']) not in Lcc:
urlstrng = dat['passport_label']
@@ -824,21 +824,21 @@ def render_passport(args):
bread = get_bread([("Search Error", url_for('.index'))])
flash_error("No refined passport with label %s was found in the database.", label)
return redirect(url_for(".index"))
- data=dataz[0]
+ data = dataz[0]
g = data['genus']
- g0=data['g0']
+ g0 = data['g0']
GG = ast.literal_eval(data['group'])
gn = GG[0]
gt = GG[1]
- gp_string=str(gn) + '.' + str(gt)
- pretty_group=sg_pretty(gp_string)
+ gp_string = str(gn) + '.' + str(gt)
+ pretty_group = sg_pretty(gp_string)
info['cyclic'] = db.gps_small.lookup(gp_string,projection="cyclic")
if gp_string == pretty_group:
- spname=False
+ spname = False
else:
- spname=True
+ spname = True
numb = len(dataz)
@@ -849,11 +849,11 @@ def render_passport(args):
numgenvecs = 20
numbraidreps = 20
- info['numgenvecs']=numgenvecs
- info['numbraidreps']=numbraidreps
+ info['numgenvecs'] = numgenvecs
+ info['numbraidreps'] = numbraidreps
- title = 'One refined passport of genus ' + str(g) + ' with automorphism group $' + pretty_group +'$'
- smallgroup="[" + str(gn) + "," +str(gt) +"]"
+ title = 'One refined passport of genus ' + str(g) + ' with automorphism group $' + pretty_group + '$'
+ smallgroup = "[" + str(gn) + "," + str(gt) + "]"
prop2 = [
('Label', label),
@@ -1148,9 +1148,9 @@ def hgcwa_code_download(**args):
label = args['label']
#Choose language
- if args['download_type'] == 'topo_magma' or args['download_type'] == 'braid_magma' or args['download_type']=='rep_magma':
+ if args['download_type'] == 'topo_magma' or args['download_type'] == 'braid_magma' or args['download_type'] == 'rep_magma':
lang = 'magma'
- elif args['download_type'] == 'topo_gap' or args['download_type'] == 'braid_gap' or args['download_type']=='rep_gap':
+ elif args['download_type'] == 'topo_gap' or args['download_type'] == 'braid_gap' or args['download_type'] == 'rep_gap':
lang = 'gap'
else:
lang = args['download_type']
@@ -1159,13 +1159,13 @@ def hgcwa_code_download(**args):
#Choose filename
if lang == args['download_type']:
- filename= 'HigherGenusData_' + str(label) + FileSuffix[lang]
- elif args['download_type']=='topo_magma' or args['download_type']=='topo_gap':
- filename= 'HigherGenusDataTopolRep_' + str(label) + FileSuffix[lang]
- elif args['download_type']=='braid_magma' or args['download_type']=='braid_gap':
- filename= 'HigherGenusDataBraidRep_' + str(label) + FileSuffix[lang]
- elif args['download_type']=='rep_magma' or args['download_type']=='rep_gap':
- filename= 'HigherGenusDataTopolClass_' + str(label) + FileSuffix[lang]
+ filename = 'HigherGenusData_' + str(label) + FileSuffix[lang]
+ elif args['download_type'] == 'topo_magma' or args['download_type'] == 'topo_gap':
+ filename = 'HigherGenusDataTopolRep_' + str(label) + FileSuffix[lang]
+ elif args['download_type'] == 'braid_magma' or args['download_type'] == 'braid_gap':
+ filename = 'HigherGenusDataBraidRep_' + str(label) + FileSuffix[lang]
+ elif args['download_type'] == 'rep_magma' or args['download_type'] == 'rep_gap':
+ filename = 'HigherGenusDataTopolClass_' + str(label) + FileSuffix[lang]
code = s + " " + Fullname[lang] + " code for the lmfdb family of higher genus curves " + str(label) + '\n'
code += s + " The results are stored in a list of records called 'data'\n\n"
diff --git a/lmfdb/hilbert_modular_forms/hilbert_field.py b/lmfdb/hilbert_modular_forms/hilbert_field.py
index 38790c4d20..47cff0a54b 100644
--- a/lmfdb/hilbert_modular_forms/hilbert_field.py
+++ b/lmfdb/hilbert_modular_forms/hilbert_field.py
@@ -100,8 +100,8 @@ def __init__(self, label):
self.ideal_dict = {}
self.label_dict = {}
for I in self.ideals_iter():
- self.ideal_dict[I['label']]=I['ideal']
- self.label_dict[I['ideal']]=I['label']
+ self.ideal_dict[I['label']] = I['ideal']
+ self.label_dict[I['ideal']] = I['label']
def _iter_ideals(self, primes=False, number=None):
"""
@@ -124,7 +124,7 @@ def _iter_ideals(self, primes=False, number=None):
yield {'label':label, 'ideal':idl}
ilabel += 1
count += 1
- if count==number:
+ if count == number:
raise StopIteration
def primes_iter(self, number=None):
diff --git a/lmfdb/hilbert_modular_forms/hilbert_modular_form.py b/lmfdb/hilbert_modular_forms/hilbert_modular_form.py
index 98616fcdb1..d1b51f1889 100644
--- a/lmfdb/hilbert_modular_forms/hilbert_modular_form.py
+++ b/lmfdb/hilbert_modular_forms/hilbert_modular_form.py
@@ -143,8 +143,8 @@ def hilbert_modular_form_jump(info):
MathCol("level_norm", "mf.level_norm", "Level norm", default=False),
ListCol("weight", "mf.hilbert.weight_vector", "Weight", mathmode=True, default=False),
MathCol("dimension", "mf.hilbert.dimension", "Dimension"),
- ProcessedCol("is_CM", "mf.cm", "CM", lambda cm: "✓" if cm=="yes" else "", short_title="CM", align="center", apply_download=lambda cm: (cm == "yes"), default=False),
- ProcessedCol("is_base_change", "mf.base_change", "Base change", lambda bc: "✓" if bc=="yes" else "", align="center", apply_download=lambda bc: (bc == "yes"), default=False)])
+ ProcessedCol("is_CM", "mf.cm", "CM", lambda cm: "✓" if cm == "yes" else "", short_title="CM", align="center", apply_download=lambda cm: (cm == "yes"), default=False),
+ ProcessedCol("is_base_change", "mf.base_change", "Base change", lambda bc: "✓" if bc == "yes" else "", align="center", apply_download=lambda bc: (bc == "yes"), default=False)])
@search_wrap(table=db.hmf_forms,
title='Hilbert modular form search results',
@@ -482,7 +482,7 @@ def render_hmf_webpage(**args):
'prime_norm': al[0][1:al[0].index(',')]} for al in data['AL_eigenvalues']]
max_eig_len = max([len(eig['eigenvalue']) for eig in info['eigs']])
- display_eigs = display_eigs or (max_eig_len<=300)
+ display_eigs = display_eigs or (max_eig_len <= 300)
info['display_eigs'] = display_eigs
if not display_eigs:
for eig in info['eigs']:
@@ -526,7 +526,7 @@ def render_hmf_webpage(**args):
bread=bread,
friends=info['friends'],
learnmore=learnmore_list(),
- KNOWL_ID="mf.hilbert.%s"%label,
+ KNOWL_ID="mf.hilbert.%s" % label,
)
@hmf_page.route("/data/")
@@ -585,7 +585,7 @@ def statistics_by_degree(d):
counts = HMFstats().counts()
info = {}
if d not in counts['degrees']:
- if d==1:
+ if d == 1:
info['error'] = r"For modular forms over $\mathbb{Q}$ go here " % url_for('cmf.index')
else:
info['error'] = "The database does not contain any Hilbert modular forms over fields of degree %s" % d
@@ -596,22 +596,22 @@ def statistics_by_degree(d):
info['degree'] = d
info['stats'] = HMFstats().statistics(d)
- if d==2:
+ if d == 2:
t = 'Hilbert modular forms over real quadratic number fields'
- elif d==3:
+ elif d == 3:
t = 'Hilbert modular forms over totally real cubic number fields'
- elif d==4:
+ elif d == 4:
t = 'Hilbert modular forms over totally real quartic number fields'
- elif d==5:
+ elif d == 5:
t = 'Hilbert modular forms over totally real quintic number fields'
- elif d==6:
+ elif d == 6:
t = 'Hilbert modular forms over totally real sextic number fields'
else:
t = 'Hilbert modular forms over totally real fields of degree %s' % d
bread = get_bread("Degree %s" % d)
- if d=='bad':
+ if d == 'bad':
t = 'Hilbert modular forms'
bread = bread[:-1]
diff --git a/lmfdb/hilbert_modular_forms/web_HMF.py b/lmfdb/hilbert_modular_forms/web_HMF.py
index 33fd81bd89..bda3e2791d 100644
--- a/lmfdb/hilbert_modular_forms/web_HMF.py
+++ b/lmfdb/hilbert_modular_forms/web_HMF.py
@@ -172,24 +172,24 @@ def compare_with_db(self, field=None):
for key in self.dbdata:
if key in ['is_base_change', 'is_CM']:
continue
- if key=='hecke_eigenvalues':
- if self.dbdata[key]!=f.dbdata[key]:
+ if key == 'hecke_eigenvalues':
+ if self.dbdata[key] != f.dbdata[key]:
agree = False
print("Inconsistent data for HMF %s in field %s" % (lab,key))
print("self has %s entries, \ndb has %s entries" % (len(self.dbdata[key]),len(f.dbdata[key])))
- print("Entries differ at indices %s" % [i for i in range(len(self.dbdata[key])) if self.dbdata[key][i]!=f.dbdata[key][i]])
- elif key=='level_ideal':
- if self.dbdata[key]!=f.dbdata[key]:
+ print("Entries differ at indices %s" % [i for i in range(len(self.dbdata[key])) if self.dbdata[key][i] != f.dbdata[key][i]])
+ elif key == 'level_ideal':
+ if self.dbdata[key] != f.dbdata[key]:
I = field.ideal_from_str(f.dbdata['level_ideal'])[2]
J = field.ideal_from_str(self.dbdata['level_ideal'])[2]
- if I==J:
+ if I == J:
print("OK, these are the same ideal")
else:
agree = False
print("These are different ideals!")
else:
- if self.dbdata[key]!=f.dbdata[key]:
+ if self.dbdata[key] != f.dbdata[key]:
agree = False
print("Inconsistent data for HMF %s in field %s" % (lab,key))
return agree
diff --git a/lmfdb/knowledge/knowl.py b/lmfdb/knowledge/knowl.py
index 555988c684..0539f8f1d5 100644
--- a/lmfdb/knowledge/knowl.py
+++ b/lmfdb/knowledge/knowl.py
@@ -119,7 +119,7 @@ def normalize_define(term):
m = define_fixer.search(term)
if m:
n = 6 if (m.group(5) is None) else 5
- term = define_fixer.sub(r'\%s'%n, term)
+ term = define_fixer.sub(r'\%s' % n, term)
return ' '.join(term.lower().replace('"', '').replace("'", "").split())
@@ -572,9 +572,9 @@ def code_references(self, knowl):
for kid in kids:
try:
if sys.version_info[0] == 3:
- matches.extend(subprocess.check_output(['git', 'grep', '--full-name', '--line-number', '--context', '2', """['"]%s['"]"""%(kid.replace('.',r'\.'))],encoding='utf-8').split('\n--\n'))
+ matches.extend(subprocess.check_output(['git', 'grep', '--full-name', '--line-number', '--context', '2', """['"]%s['"]""" % (kid.replace('.',r'\.'))],encoding='utf-8').split('\n--\n'))
else:
- matches.extend(subprocess.check_output(['git', 'grep', '--full-name', '--line-number', '--context', '2', """['"]%s['"]"""%(kid.replace('.',r'\.'))]).split('\n--\n'))
+ matches.extend(subprocess.check_output(['git', 'grep', '--full-name', '--line-number', '--context', '2', """['"]%s['"]""" % (kid.replace('.',r'\.'))]).split('\n--\n'))
except subprocess.CalledProcessError: # no matches
pass
return [self._process_git_grep(match) for match in matches]
@@ -590,9 +590,9 @@ def check_sed_safety(self, knowlid):
"""
try:
if sys.version_info[0] == 3:
- matches = subprocess.check_output(['git', 'grep', """['"]%s['"]"""%(knowlid.replace('.',r'\.'))],encoding='utf-8').split('\n')
+ matches = subprocess.check_output(['git', 'grep', """['"]%s['"]""" % (knowlid.replace('.',r'\.'))],encoding='utf-8').split('\n')
else:
- matches = subprocess.check_output(['git', 'grep', """['"]%s['"]"""%(knowlid.replace('.',r'\.'))]).split('\n')
+ matches = subprocess.check_output(['git', 'grep', """['"]%s['"]""" % (knowlid.replace('.',r'\.'))]).split('\n')
except subprocess.CalledProcessError: # no matches
return 0
@@ -613,7 +613,7 @@ def start_rename(self, knowl, new_name, who):
if knowl.source is not None or knowl.source_name is not None:
raise ValueError("This knowl is already involved in a rename. Use undo_rename or actually_rename instead.")
if self.knowl_exists(new_name):
- raise ValueError("A knowl with id %s already exists."%new_name)
+ raise ValueError("A knowl with id %s already exists." % new_name)
updater = SQL("UPDATE kwl_knowls SET (source, source_name) = (%s, %s) WHERE id = %s AND timestamp = %s")
old_name = knowl.id
with DelayCommit(self):
@@ -816,7 +816,7 @@ def __init__(self, ID, template_kwargs=None, data=None, editing=False, showing=F
if self.exists(allow_deleted=allow_deleted):
if editing:
# as we want to make edits on the most recent version
- timestamp=None
+ timestamp = None
data = knowldb.get_knowl(ID,
allow_deleted=allow_deleted, timestamp=timestamp)
else:
diff --git a/lmfdb/lattice/isom.py b/lmfdb/lattice/isom.py
index 935093f3f5..0cd6baefcb 100644
--- a/lmfdb/lattice/isom.py
+++ b/lmfdb/lattice/isom.py
@@ -8,26 +8,26 @@ def isom(A,B):
return False
# Then check A against the viable database candidates.
else:
- n=len(A[0])
- m=len(B[0])
- Avec=[]
- Bvec=[]
+ n = len(A[0])
+ m = len(B[0])
+ Avec = []
+ Bvec = []
for i in range(n):
for j in range(i,n):
- if i==j:
- Avec+=[A[i][j]]
+ if i == j:
+ Avec += [A[i][j]]
else:
- Avec+=[2*A[i][j]]
+ Avec += [2*A[i][j]]
for i in range(m):
for j in range(i,m):
- if i==j:
- Bvec+=[B[i][j]]
+ if i == j:
+ Bvec += [B[i][j]]
else:
- Bvec+=[2*B[i][j]]
- Aquad=QuadraticForm(ZZ,len(A[0]),Avec)
+ Bvec += [2*B[i][j]]
+ Aquad = QuadraticForm(ZZ,len(A[0]),Avec)
# check positive definite
if Aquad.is_positive_definite():
- Bquad=QuadraticForm(ZZ,len(B[0]),Bvec)
+ Bquad = QuadraticForm(ZZ,len(B[0]),Bvec)
return Aquad.is_globally_equivalent_to(Bquad)
else:
return False
diff --git a/lmfdb/lfunctions/Lfunction.py b/lmfdb/lfunctions/Lfunction.py
index d80b1df885..1dfe0aeefd 100644
--- a/lmfdb/lfunctions/Lfunction.py
+++ b/lmfdb/lfunctions/Lfunction.py
@@ -862,7 +862,7 @@ def __init__(self, **args):
raise ValueError(f'Error constructing L-function for Hilbert modular form {self.origin_label}, as it is not in the database')
self.number = int(args['number'])
- self.character= int(args['character'])
+ self.character = int(args['character'])
if self.character != 0:
raise KeyError('L-function of Hilbert form of non-trivial character not implemented yet.')
@@ -870,7 +870,7 @@ def __init__(self, **args):
(f, F_hmf) = getHmfData(self.origin_label)
if f is None:
# NB raising an error is not a good way to handle this on website!
- raise KeyError('No Hilbert modular form with label "%s" found in database.'%self.origin_label)
+ raise KeyError('No Hilbert modular form with label "%s" found in database.' % self.origin_label)
try:
self.weight = int(f['parallel_weight'])
except KeyError:
@@ -879,7 +879,7 @@ def __init__(self, **args):
# Load the field (F)
F = WebNumberField(f['field_label'])
if not F or F.is_null():
- raise KeyError('Error constructing number field %s'%f['field_label'])
+ raise KeyError('Error constructing number field %s' % f['field_label'])
self.field_disc = F.disc()
self.field_degree = int(F.degree())
@@ -1033,7 +1033,7 @@ def __init__(self, **args):
self.number = 0 # Default embedding of the coefficients
# Load form (S) from database
- label = '%d_%s'%(self.weight,self.orbit)
+ label = '%d_%s' % (self.weight,self.orbit)
# disable L-functions on the fly in production
if not is_debug_mode():
@@ -1139,7 +1139,7 @@ def __init__(self, **args):
# Fetch the polynomial of the field from the database
wnf = WebNumberField(self.origin_label)
if not wnf or wnf.is_null():
- raise KeyError('Unable to construct Dedekind zeta function.', 'No data for the number field "%s" was found in the database'%self.origin_label)
+ raise KeyError('Unable to construct Dedekind zeta function.', 'No data for the number field "%s" was found in the database' % self.origin_label)
self.NF = wnf.K()
self.h = wnf.class_number()
self.R = wnf.regulator()
@@ -1179,7 +1179,7 @@ def __init__(self, **args):
# Determine the factorization
self.grh = wnf.used_grh()
if self.degree > 1:
- if wnf.is_abelian() and len(wnf.dirichlet_group())>0:
+ if wnf.is_abelian() and len(wnf.dirichlet_group()) > 0:
dir_group = wnf.dirichlet_group()
# Remove 1 from the list
j = 0
@@ -1199,16 +1199,16 @@ def __init__(self, **args):
nfgg = wnf.factor_perm_repn() # first call cached it
ar = wnf.artin_reps() # these are in the same order
self.factorization = (r'\(\zeta_K(s) =\) '
- +r'\(\zeta(s)\) ')
+ + r'\(\zeta(s)\)')
for j in range(len(ar)):
- if nfgg[j]>0:
+ if nfgg[j] > 0:
the_rep = ar[j]
- if (the_rep.dimension()>1
- or str(the_rep.conductor())!=str(1)):
+ if (the_rep.dimension() > 1
+ or str(the_rep.conductor()) != str(1)):
ar_url = url_for("l_functions.l_function_artin_page",
label=the_rep.label())
right = (r'\({}^{%d}\)' % (nfgg[j])
- if nfgg[j]>1 else r'')
+ if nfgg[j] > 1 else r'')
self.factorization += r'\(\;\cdot\)'
tex_label = the_rep.label()
tex_label = tex_label.replace('_',r'\_')
@@ -1263,7 +1263,7 @@ def __init__(self, **args):
try:
self.artin = ArtinRepresentation(self.origin_label)
except Exception as err:
- raise KeyError('Error constructing Artin representation %s.'%self.origin_label, *err.args)
+ raise KeyError('Error constructing Artin representation %s.' % self.origin_label, *err.args)
# Mandatory properties
self.fromDB = False
@@ -1286,7 +1286,7 @@ def __init__(self, **args):
self.motivic_weight = 0
cc = self.artin.central_character()
if not cc:
- raise ValueError('Error constructing Artin representation %s, unable to compute central character, possibly because the modulus is too large.'%self.origin_label)
+ raise ValueError('Error constructing Artin representation %s, unable to compute central character, possibly because the modulus is too large.' % self.origin_label)
self.charactermodulus, self.characternumber = cc.modulus, cc.number
# Compute Dirichlet coefficients and period ########################
@@ -1357,7 +1357,7 @@ def __init__(self, **args):
# Get the motive from the database
self.motive = getHgmData(self.origin_label)
if not self.motive:
- raise KeyError('No data for the hypergeometric motive "%s" was found in the database.'%self.origin_label)
+ raise KeyError('No data for the hypergeometric motive "%s" was found in the database.' % self.origin_label)
# Mandatory properties
self.fromDB = False
@@ -1597,7 +1597,7 @@ def __init__(self, **args):
self.texname = r"L(s,E,\chi)"
self.texnamecompleteds = r"\Lambda(s,E,\chi)"
- self.title = r"$L(s,E,\chi)$, where $E$ is the elliptic curve %s and $\chi$ is the Dirichlet character of conductor %s, modulo %s, number %s"%(self.ellipticcurvelabel, self.tp.chi.conductor(), self.charactermodulus, self.characternumber)
+ self.title = r"$L(s,E,\chi)$, where $E$ is the elliptic curve %s and $\chi$ is the Dirichlet character of conductor %s, modulo %s, number %s" % (self.ellipticcurvelabel, self.tp.chi.conductor(), self.charactermodulus, self.characternumber)
self.credit = 'Workshop in Besancon, 2014'
diff --git a/lmfdb/lfunctions/Lfunctionutilities.py b/lmfdb/lfunctions/Lfunctionutilities.py
index 0ec61904b8..afb7f79f39 100644
--- a/lmfdb/lfunctions/Lfunctionutilities.py
+++ b/lmfdb/lfunctions/Lfunctionutilities.py
@@ -39,7 +39,7 @@ def p2sage(s):
return f(str(z))
except (ValueError, TypeError, NameError, SyntaxError):
pass
- if z!='??':
+ if z != '??':
logger.error('Error converting "{}" in p2sage'.format(z))
return z
@@ -61,7 +61,7 @@ def string2number(s):
return CDF(tuple(s))
elif '/' in strs:
return Rational(strs)
- elif strs=='0.5': # Temporary fix because 0.5 in db for EC
+ elif strs == '0.5': # Temporary fix because 0.5 in db for EC
return Rational('1/2')
elif '.' in strs:
return float(strs)
@@ -118,12 +118,12 @@ def seriescoeff(coeff, index, seriescoefftype, seriestype, digits):
# deal with the zero case
if coeff_display == "0":
- if seriescoefftype=="literal":
+ if seriescoefftype == "literal":
return "0"
else:
return ""
- if seriescoefftype=="literal":
+ if seriescoefftype == "literal":
return coeff_display
if seriescoefftype == "factor":
@@ -394,7 +394,7 @@ def row(trclass, goodorbad, p, poly):
out += "" + goodorbad + " " + str(p) + " "
if display_galois:
out += ""
- if gal_groups[0]==[0,0]:
+ if gal_groups[0] == [0,0]:
pass # do nothing, because the local factor is 1
else:
out += r"$\times$".join( [transitive_group_display_knowl_C1_as_trivial(f"{n}T{k}") for n, k in gal_groups] )
@@ -435,7 +435,7 @@ def row(trclass, goodorbad, p, poly):
last_entry = ""
if display_galois:
- last_entry +=" "
+ last_entry += " "
last_entry += " "
eptable += last_entry
eptable += " "
diff --git a/lmfdb/lfunctions/main.py b/lmfdb/lfunctions/main.py
index eab710ac56..370d87b35d 100644
--- a/lmfdb/lfunctions/main.py
+++ b/lmfdb/lfunctions/main.py
@@ -436,17 +436,17 @@ def euler_search(info, query):
info['err'] = ''
raise ValueError("To search on Euler factors, you must specify one degree")
for p in prime_range(100):
- parse_euler(info, query, 'euler_constraints', qfield='euler%s'%p, p=p, d=d)
+ parse_euler(info, query, 'euler_constraints', qfield='euler%s' % p, p=p, d=d)
class LFunctionSearchArray(SearchArray):
sorts = [('', 'root analytic conductor', ['root_analytic_conductor', 'label']),
('analytic_conductor', 'analytic conductor', ['analytic_conductor', 'label']),
('z1', 'first zero', ['z1']),
('conductor', 'conductor', ['conductor', 'root_analytic_conductor', 'label'])]
- jump_example="1-1-1.1-r0-0-0"
- jump_egspan="e.g. 2-1-1.1-c11-0-0 or 4-1-1.1-r0e4-c4.72c12.47-0"
- jump_knowl="lfunction.search_input"
- jump_prompt="Label"
+ jump_example = "1-1-1.1-r0-0-0"
+ jump_egspan = "e.g. 2-1-1.1-c11-0-0 or 4-1-1.1-r0e4-c4.72c12.47-0"
+ jump_knowl = "lfunction.search_input"
+ jump_prompt = "Label"
null_column_explanations = { # No need to display warnings for these
'dirichlet_coefficients': False,
'euler_factors': False,
@@ -1205,7 +1205,7 @@ def render_lfunction_exception(err):
try:
errmsg = "Unable to render L-function page due to the following problem(s):" + "".join("" + msg + " " for msg in err.args) + " "
except Exception:
- errmsg = "Unable to render L-function page due to the following problem: "%err
+ errmsg = "Unable to render L-function page due to the following problem: " % err
bread = [('L-functions', url_for('.index')), ('Error', '')]
info = {'explain': errmsg, 'title': 'Error displaying L-function', 'bread': bread }
return render_template('problem.html', **info)
@@ -1468,13 +1468,13 @@ def set_navi(L):
Lpattern = r"\(L(s,\chi_{%s}(%s,·))\)"
if mod > 1:
pmod,pnum = WebDirichlet.prevprimchar(mod, num)
- prev_data = ("previous",Lpattern%(pmod,pnum) if pmod > 1 else r"\(\zeta(s)\)",
+ prev_data = ("previous",Lpattern % (pmod,pnum) if pmod > 1 else r"\(\zeta(s)\)",
url_for('.l_function_dirichlet_page',
modulus=pmod,number=pnum))
else:
prev_data = ('','','')
nmod,nnum = WebDirichlet.nextprimchar(mod, num)
- next_data = ("next",Lpattern%(nmod,nnum) if nmod > 1 else r"\(\zeta(s)\)",
+ next_data = ("next",Lpattern % (nmod,nnum) if nmod > 1 else r"\(\zeta(s)\)",
url_for('.l_function_dirichlet_page',
modulus=nmod,number=nnum))
@@ -1978,7 +1978,7 @@ def source(prepath):
assert L
except Exception:
return abort(404)
- info={'bread': ()}
+ info = {'bread': ()}
set_bread_and_friends(info, L, request)
knowl = ''
if L.fromDB:
@@ -2007,7 +2007,7 @@ def completeness(prepath):
assert L
except Exception:
return abort(404)
- info={'bread': ()}
+ info = {'bread': ()}
set_bread_and_friends(info, L, request)
knowl = ''
if L.fromDB:
@@ -2034,7 +2034,7 @@ def reliability(prepath):
assert L
except Exception:
return abort(404)
- info={'bread': ()}
+ info = {'bread': ()}
set_bread_and_friends(info, L, request)
knowl = ''
if L.fromDB:
diff --git a/lmfdb/lfunctions/test_lfunctions.py b/lmfdb/lfunctions/test_lfunctions.py
index 941b86f14b..515976f5b6 100644
--- a/lmfdb/lfunctions/test_lfunctions.py
+++ b/lmfdb/lfunctions/test_lfunctions.py
@@ -49,7 +49,7 @@ def test_Lec(self):
L = self.tc.get('/L/EllipticCurve/Q/27/a/', follow_redirects=True)
assert '0.5888795834' in L.get_data(as_text=True)
- assert 'Elliptic curve 27.a'in L.get_data(as_text=True)
+ assert 'Elliptic curve 27.a' in L.get_data(as_text=True)
assert 'Modular form 27.2.a.a' in L.get_data(as_text=True)
#assert '/SatoTateGroup/1.2.' in L.get_data(as_text=True)
assert '2-3e3-1.1-c1-0-0' in L.get_data(as_text=True)
diff --git a/lmfdb/local_fields/main.py b/lmfdb/local_fields/main.py
index 9c50d579ac..36a6ee4fde 100644
--- a/lmfdb/local_fields/main.py
+++ b/lmfdb/local_fields/main.py
@@ -67,37 +67,40 @@ def local_algebra_data(labels):
f1 = labs[0].split('.')
labs = sorted(labs, key=lambda u: (int(j) for j in u.split('.')), reverse=True)
ans = ''
- ans += '$%s$-adic algebra'%str(f1[0])
+ ans += '$%s$-adic algebra' % str(f1[0])
ans += '
'
ans += ''
ans += "
Label Polynomial $e$ $f$ $c$ $G$ Slopes"
fall = [db.lf_fields.lookup(label) for label in labs]
for f in fall:
l = str(f['label'])
- ans += ' %s '%(url_for_label(l),l)
+ ans += ' %s ' % (url_for_label(l),l)
ans += format_coeffs(f['coeffs'])
- ans += ' %d %d %d '%(f['e'],f['f'],f['c'])
+ ans += ' %d %d %d ' % (f['e'],f['f'],f['c'])
ans += transitive_group_display_knowl(f['galois_label'])
- ans += ' $'+ show_slope_content(f['slopes'],f['t'],f['u'])+'$'
+ ans += ' $' + show_slope_content(f['slopes'],f['t'],f['u'])+'$'
ans += '
'
if len(labs) != len(set(labs)):
- ans +='Fields which appear more than once occur according to their given multiplicities in the algebra'
+ ans += '
Fields which appear more than once occur according to their given multiplicities in the algebra'
return ans
def local_field_data(label):
f = db.lf_fields.lookup(label)
nicename = ''
if f['n'] < 3:
- nicename = ' = '+ prettyname(f)
- ans = '$p$-adic field %s%s '% (label, nicename)
- ans += r'Extension of $\Q_{%s}$ defined by %s '%(str(f['p']),web_latex(coeff_to_poly(f['coeffs'])))
- gt = int(f['galois_label'].split('T')[1])
+ nicename = ' = ' + prettyname(f)
+ ans = '$p$-adic field %s%s ' % (label, nicename)
+ ans += r'Extension of $\Q_{%s}$ defined by %s ' % (str(f['p']),web_latex(coeff_to_poly(f['coeffs'])))
gn = f['n']
ans += 'Degree: %s ' % str(gn)
ans += 'Ramification index $e$: %s ' % str(f['e'])
ans += 'Residue field degree $f$: %s ' % str(f['f'])
ans += 'Discriminant ideal: $(p^{%s})$ ' % str(f['c'])
- ans += 'Galois group $G$: %s ' % group_pretty_and_nTj(gn, gt, True)
+ if 'galois_label' in f:
+ gt = int(f['galois_label'].split('T')[1])
+ ans += 'Galois group $G$: %s ' % group_pretty_and_nTj(gn, gt, True)
+ else:
+ ans += 'Galois group $G$: not computed '
ans += '
'
ans += '
%s home page ' % (str(url_for("local_fields.by_label", label=label)),label)
ans += '
'
@@ -239,13 +242,15 @@ def show_slopes2(sl):
return(sl)
def show_slope_content(sl,t,u):
+ if sl is None or t is None or u is None:
+ return ' $not computed$ ' # actually killing math mode
sc = str(sl)
if sc == '[]':
sc = r'[\ ]'
- if t>1:
- sc += '_{%d}'%t
- if u>1:
- sc += '^{%d}'%u
+ if t > 1:
+ sc += '_{%d}' % t
+ if u > 1:
+ sc += '^{%d}' % u
return(sc)
@local_fields_page.route("/")
@@ -294,6 +299,11 @@ class LF_download(Downloader):
),
}
+def galcolresponse(n,t,cache):
+ if t is None:
+ return 'not computed'
+ return group_pretty_and_nTj(n, t, cache=cache)
+
lf_columns = SearchColumns([
LinkCol("label", "lf.field.label", "Label", url_for_label),
MathCol("n", "lf.degree", "$n$", short_title="degree", default=False),
@@ -304,7 +314,7 @@ class LF_download(Downloader):
MathCol("c", "lf.discriminant_exponent", "$c$", short_title="discriminant exponent"),
MultiProcessedCol("gal", "nf.galois_group", "Galois group",
["n", "gal", "cache"],
- lambda n, t, cache: group_pretty_and_nTj(n, t, cache=cache),
+ galcolresponse,
apply_download=lambda n, t, cache: [n, t]),
MathCol("u", "lf.unramified_degree", "$u$", short_title="unramified degree", default=False),
MathCol("t", "lf.tame_degree", "$t$", short_title="tame degree", default=False),
@@ -322,7 +332,7 @@ class LF_download(Downloader):
db_cols=["c", "coeffs", "e", "f", "gal", "label", "n", "p", "slopes", "t", "u", "visible", "ind_of_insep", "associated_inertia","unram","eisen"])
def lf_postprocess(res, info, query):
- cache = knowl_cache(list({f"{rec['n']}T{rec['gal']}" for rec in res}))
+ cache = knowl_cache(list({f"{rec['n']}T{rec['gal']}" for rec in res if 'gal' in rec}))
for rec in res:
rec["cache"] = cache
return res
@@ -376,13 +386,16 @@ def render_field_webpage(args):
e = data['e']
f = data['f']
cc = data['c']
- gt = int(data['galois_label'].split('T')[1])
gn = data['n']
- the_gal = WebGaloisGroup.from_nt(gn,gt)
- isgal = ' Galois' if the_gal.order() == gn else ' not Galois'
- abelian = ' and abelian' if the_gal.is_abelian() else ''
- galphrase = 'This field is'+isgal+abelian+r' over $\Q_{%d}.$'%p
- autstring = r'\Gal' if the_gal.order() == gn else r'\Aut'
+ autstring = r'\Aut'
+ if 'galois_label' in data:
+ gt = int(data['galois_label'].split('T')[1])
+ the_gal = WebGaloisGroup.from_nt(gn,gt)
+ isgal = ' Galois' if the_gal.order() == gn else ' not Galois'
+ abelian = ' and abelian' if the_gal.is_abelian() else ''
+ galphrase = 'This field is'+isgal+abelian+r' over $\Q_{%d}.$' % p
+ if the_gal.order() == gn:
+ autstring = r'\Gal'
prop2 = [
('Label', label),
('Base', r'\(%s\)' % Qp),
@@ -390,7 +403,7 @@ def render_field_webpage(args):
('e', r'\(%s\)' % e),
('f', r'\(%s\)' % f),
('c', r'\(%s\)' % cc),
- ('Galois group', group_pretty_and_nTj(gn, gt)),
+ ('Galois group', group_pretty_and_nTj(gn, gt) if 'galois_label' in data else 'not computed'),
]
# Look up the unram poly so we can link to it
unramdata = db.lf_fields.lucky({'p': p, 'n': f, 'c': 0})
@@ -445,20 +458,14 @@ def render_field_webpage(args):
't': data['t'],
'u': data['u'],
'rf': lf_display_knowl( rflabel, name=printquad(data['rf'], p)),
- 'base': lf_display_knowl(str(p)+'.1.0.1', name='$%s$'%Qp),
+ 'base': lf_display_knowl(str(p)+'.1.0.1', name='$%s$' % Qp),
'hw': data['hw'],
'visible': show_slopes(data['visible']),
- 'slopes': show_slopes(data['slopes']),
- 'gal': group_pretty_and_nTj(gn, gt, True),
- 'gt': gt,
- 'inertia': group_display_inertia(data['inertia']),
'wild_inertia': wild_inertia,
'unram': unramp,
'ind_insep': show_slopes(str(data['ind_of_insep'])),
'eisen': eisenp,
- 'gms': data['gms'],
'gsm': gsm,
- 'galphrase': galphrase,
'autstring': autstring,
'subfields': format_subfields(data['subfield'],data['subfield_mult'],p),
'aut': data['aut'],
@@ -466,7 +473,18 @@ def render_field_webpage(args):
'residual_polynomials': ",".join(f"${teXify_pol(poly)}$" for poly in data['residual_polynomials']),
'associated_inertia': ",".join(f"${ai}$" for ai in data['associated_inertia']),
})
- friends = [('Galois group', "/GaloisGroup/%dT%d" % (gn, gt))]
+ friends=[]
+ if 'slopes' in data:
+ info.update({'slopes': show_slopes(data['slopes'])})
+ if 'inertia' in data:
+ info.update({'inertia': group_display_inertia(data['inertia'])})
+ if 'gms' in data:
+ info.update({'gms': data['gms']})
+ if 'galois_label' in data:
+ info.update({'gal': group_pretty_and_nTj(gn, gt, True),
+ 'galphrase': galphrase,
+ 'gt': gt})
+ friends.append(('Galois group', "/GaloisGroup/%dT%d" % (gn, gt)))
if unramfriend != '':
friends.append(('Unramified subfield', unramfriend))
if rffriend != '':
@@ -726,7 +744,7 @@ def ramdisp(p):
'top_title':[('degree', 'lf.degree'),
('and', None),
('ramification index', 'lf.ramification_index'),
- ('for %s-adic fields'%p, None)],
+ ('for %s-adic fields' % p, None)],
'totaler': totaler(col_counts=False),
'proportioner': proportioners.per_row_total}
@@ -736,7 +754,7 @@ def discdisp(p):
'top_title':[('degree', 'lf.degree'),
('and', None),
('discriminant exponent', 'lf.discriminant_exponent'),
- ('for %s-adic fields'%p, None)],
+ ('for %s-adic fields' % p, None)],
'totaler': totaler(col_counts=False),
'proportioner': proportioners.per_row_query(lambda n: {'n':int(n)})}
@@ -744,7 +762,7 @@ def galdisp(p, n):
return {'cols': ['galois_label'],
'constraint': {'p': p, 'n': n},
'top_title':[('Galois groups', 'nf.galois_group'),
- ('for %s-adic fields of'%p, None),
+ ('for %s-adic fields of' % p, None),
('degree', 'lf.degree'),
(str(n), None)]}
diff --git a/lmfdb/local_fields/templates/lf-show-field.html b/lmfdb/local_fields/templates/lf-show-field.html
index ae3811dc66..013ed8f248 100644
--- a/lmfdb/local_fields/templates/lf-show-field.html
+++ b/lmfdb/local_fields/templates/lf-show-field.html
@@ -50,15 +50,20 @@ {{ KNOWL('lf.unramified_totally_ramified_tower', title='Unramified/totally r
{{ KNOWL('lf.ramification_polygon_display', title='Ramification polygon') }}
+
{% if info.e > 1 %}
-
+ {% if info.ram_poly_polt %}
+
-
- {{ KNOWL('lf.residual_polynomials', title='Residual polynomials') }}: {{info.residual_polynomials}}
- {{ KNOWL('lf.associated_inertia', title='Associated inertia') }}: {{info.associated_inertia}}
- {{ KNOWL('lf.indices_of_inseparability', 'Indices of inseparability')}}: {{info.ind_insep|safe}}
-
+
+ {{ KNOWL('lf.residual_polynomials', title='Residual polynomials') }}: {{info.residual_polynomials}}
+ {{ KNOWL('lf.associated_inertia', title='Associated inertia') }}: {{info.associated_inertia}}
+ {{ KNOWL('lf.indices_of_inseparability', 'Indices of inseparability')}}: {{info.ind_insep|safe}}
+
+ {% else %}
+ Data not computed
+ {% endif %}
{% else %}
@@ -69,13 +74,55 @@ {{ KNOWL('lf.ramification_polygon_display', title='Ramification polygon') }}
{{ KNOWL('lf.galois_invariants', title='Invariants of the Galois closure') }}
- {{ KNOWL('nf.galois_group', title='Galois group')}}: {{info.gal|safe}}
- {{ KNOWL('lf.inertia_group', title='Inertia group')}}: {{info.inertia|safe}}
- {{ KNOWL('lf.wild_inertia_group', title='Wild inertia group')}}: {{info.wild_inertia|safe}}
- {{ KNOWL('lf.unramified_degree', title='Unramified degree')}}: ${{info.u}}$
- {{ KNOWL('lf.tame_degree', title='Tame degree')}}: ${{info.t}}$
- {{ KNOWL('lf.wild_slopes', title='Wild slopes')}}: {{info.slopes}}
- {{ KNOWL('lf.galois_mean_slope', title='Galois mean slope')}}: ${{info.gms}}$
+ {{ KNOWL('nf.galois_group', title='Galois group')}}:
+ {% if info.gal %}
+ {{info.gal|safe}}
+ {% else %}
+ Not computed
+ {% endif %}
+
+ {{ KNOWL('lf.inertia_group', title='Inertia group')}}:
+ {% if info.inertia %}
+ {{info.inertia|safe}}
+ {% else %}
+ Not computed
+ {% endif %}
+
+ {{ KNOWL('lf.wild_inertia_group', title='Wild inertia group')}}:
+ {% if info.wild_inertia %}
+ {{info.wild_inertia|safe}}
+ {% else %}
+ Not computed
+ {% endif %}
+
+ {{ KNOWL('lf.unramified_degree', title='Unramified degree')}}:
+ {% if info.u %}
+ ${{info.u}}$
+ {% else %}
+ Not computed
+ {% endif %}
+
+ {{ KNOWL('lf.tame_degree', title='Tame degree')}}:
+ {% if info.t %}
+ ${{info.t}}$
+ {% else %}
+ Not computed
+ {% endif %}
+
+ {{ KNOWL('lf.wild_slopes', title='Wild slopes')}}:
+ {% if info.slopes %}
+ {{info.slopes}}
+ {% else %}
+ Not computed
+ {% endif %}
+
+ {{ KNOWL('lf.galois_mean_slope', title='Galois mean slope')}}:
+ {% if info.gms %}
+ ${{info.gms}}$
+ {% else %}
+ Not computed
+ {% endif %}
+
{{KNOWL('lf.galois_splitting_model', title='Galois splitting model')}}: {{info.gsm|safe}}
diff --git a/lmfdb/logger/start.py b/lmfdb/logger/start.py
index 3ef54bf55a..46bd8f40ea 100644
--- a/lmfdb/logger/start.py
+++ b/lmfdb/logger/start.py
@@ -14,7 +14,7 @@ def logger_file_handler():
LMFDB_SAGE_VERSION = '9.3'
def check_sage_version():
if [int(c) for c in sage_version.split(".")[:2]] < [int(c) for c in LMFDB_SAGE_VERSION.split(".")[:2]]:
- warning("*** WARNING: SAGE VERSION %s IS OLDER THAN %s ***"%(sage_version,LMFDB_SAGE_VERSION))
+ warning("*** WARNING: SAGE VERSION %s IS OLDER THAN %s ***" % (sage_version,LMFDB_SAGE_VERSION))
def start_logging():
global file_handler
diff --git a/lmfdb/maass_forms/main.py b/lmfdb/maass_forms/main.py
index 9cd3857c12..519888a419 100644
--- a/lmfdb/maass_forms/main.py
+++ b/lmfdb/maass_forms/main.py
@@ -306,7 +306,7 @@ def __init__(self):
def parse_character(inp, query, qfield):
if not CHARACTER_LABEL_RE.match(inp):
raise ValueError("Character labels must be of the form q.n, where q and n are positive integers.")
- level_field, conrey_index_field ='level', 'conrey_index'
+ level_field, conrey_index_field = 'level', 'conrey_index'
level, conrey_index = inp.split('.')
level, conrey_index = int(level), int(conrey_index)
if conrey_index > level:
diff --git a/lmfdb/maass_forms/plot.py b/lmfdb/maass_forms/plot.py
index 06887f698c..801c33fcad 100644
--- a/lmfdb/maass_forms/plot.py
+++ b/lmfdb/maass_forms/plot.py
@@ -74,7 +74,7 @@ def paintCSMaass(width, height, xMin, xMax, yMin, yMax, xfactor, yfactor, ticlen
ans += " \n".format(str(xshift))
# ----------- Tickmarks x axis
- for i in range(1, xMax -xMin + 1):
+ for i in range(1, xMax - xMin + 1):
ans += " \n"
diff --git a/lmfdb/modl_galois_representations/main.py b/lmfdb/modl_galois_representations/main.py
index 6f28ba2bcf..28639d8f87 100644
--- a/lmfdb/modl_galois_representations/main.py
+++ b/lmfdb/modl_galois_representations/main.py
@@ -131,7 +131,7 @@ def modlgal_jump(info):
return redirect(url_for_modlgal_label(info.get("jump")))
def blankzeros(n):
- return "$%o$"%n if n else ""
+ return "$%o$" % n if n else ""
modlgal_columns = SearchColumns(
[
@@ -460,7 +460,7 @@ def labels_page():
def download_modlgal_text(label):
data = db.modlgal_reps.lookup(label, label_col='label')
if data is None:
- return r"There is no mod-$\ell$ Galois representation %s in the database"%(label)
+ return r"There is no mod-$\ell$ Galois representation %s in the database" % (label)
data_list = [data]
response = make_response('\n\n'.join(Json.dumps(d) for d in data_list))
response.headers['Content-type'] = 'text/plain'
diff --git a/lmfdb/modl_galois_representations/web_modlgal.py b/lmfdb/modl_galois_representations/web_modlgal.py
index e27fb9840c..3b5809343d 100644
--- a/lmfdb/modl_galois_representations/web_modlgal.py
+++ b/lmfdb/modl_galois_representations/web_modlgal.py
@@ -32,14 +32,14 @@ def image_pretty_with_abstract(image_label, is_surjective, algebraic_group, dime
s = _codomain(algebraic_group, dimension, base_ring_order, base_ring_is_field)
if is_surjective:
return "$" + s + "$"
- if dimension==1:
+ if dimension == 1:
return image_label
- if algebraic_group=='GSp' and dimension==4 and base_ring_order==2:
+ if algebraic_group == 'GSp' and dimension == 4 and base_ring_order == 2:
t = display_knowl('gsp4.subgroup_data', title=image_label, kwargs={'label':image_label})
else:
t = display_knowl('gl2.subgroup_data', title=image_label, kwargs={'label':image_label}) if dimension == 2 else image_label
if image_abstract_group:
- t += r" $\ \cong$ "+ abstract_group_display_knowl(image_abstract_group)
+ t += r" $\ \cong$ " + abstract_group_display_knowl(image_abstract_group)
return t
def rep_pretty(algebraic_group, dimension, base_ring_order, base_ring_is_field):
@@ -66,7 +66,7 @@ def showexp(c, wrap=True):
return f"^{{{c}}}"
def modlgal_link(label):
- return '%s '%(url_for(".by_label",label=label),label)
+ return '%s ' % (url_for(".by_label",label=label),label)
def bool_string(b):
return "yes" if b else "no"
@@ -81,7 +81,7 @@ def properties(self):
("Characteristic", str(self.base_ring_characteristic)),
("Dimension", str(self.dimension))
]
- if self.dimension>1:
+ if self.dimension > 1:
props += [("Determinant", str(self.determinant_label))]
props += [
("Conductor", str(self.conductor)),
@@ -155,11 +155,11 @@ def codomain(self):
@lazy_attribute
def image_pretty_with_abstract(self):
- return image_pretty_with_abstract(self.image_label, self.image_index==1, self.algebraic_group, self.dimension, self.base_ring_order, self.base_ring_is_field, self.image_abstract_group, codomain=False)
+ return image_pretty_with_abstract(self.image_label, self.image_index == 1, self.algebraic_group, self.dimension, self.base_ring_order, self.base_ring_is_field, self.image_abstract_group, codomain=False)
@lazy_attribute
def image_pretty(self):
- return image_pretty(self.image_label, self.image_index==1, self.algebraic_group, self.dimension, self.base_ring_order, self.base_ring_is_field, codomain=False)
+ return image_pretty(self.image_label, self.image_index == 1, self.algebraic_group, self.dimension, self.base_ring_order, self.base_ring_is_field, codomain=False)
@lazy_attribute
def rep_pretty(self):
@@ -189,7 +189,7 @@ def projective_image_abstract(self):
def frobenius_generators(self):
if not self.generating_primes:
return None
- return ",".join([r"\mathrm{Frob}_{%s}"%(p) for p in self.generating_primes])
+ return ",".join([r"\mathrm{Frob}_{%s}" % (p) for p in self.generating_primes])
@lazy_attribute
def frobenius_primes(self):
@@ -209,7 +209,7 @@ def frobenius_matrices_pretty(self):
for i in range(len(ps)):
m = Matrix(F,n,frobs[i])
M = R(frobs[i])
- p = r"\mathbf{%s}"%(ps[i]) if self.generating_primes and ps[i] in self.generating_primes else ps[i]
+ p = r"\mathbf{%s}" % (ps[i]) if self.generating_primes and ps[i] in self.generating_primes else ps[i]
charpoly = m.charpoly()
pol = web_latex(charpoly) if charpoly.is_irreducible() else web_latex(factor(charpoly))
L.append([p, m.trace(), m.det(), M.order(), pol, web_latex(m)])
@@ -227,7 +227,7 @@ def dual_algebra_pretty(self):
n = sum([len(a)-1 for a in A[0]])
data = { "A": r" $\times$ ".join([formatfield(f) for f in A[0]]),
"B": r" $\times$ ".join([formatfield(f) for f in A[1]]),
- "Phi": r"\frac{1}{%s} "%(str(A[2][0])) + web_latex(Matrix(QQ,n,A[2][1]),enclose=False)
+ "Phi": r"\frac{1}{%s} " % (str(A[2][0])) + web_latex(Matrix(QQ,n,A[2][1]),enclose=False)
}
return data
diff --git a/lmfdb/modlmf/main.py b/lmfdb/modlmf/main.py
index d669cdad1c..0869e5c034 100644
--- a/lmfdb/modlmf/main.py
+++ b/lmfdb/modlmf/main.py
@@ -58,11 +58,11 @@ def modlmf_render_webpage():
args = request.args
if len(args) == 0:
counts = get_stats().counts()
- characteristic_list= [2,3,5,7,11]
- max_lvl=min(counts['max_level'],150)
+ characteristic_list = [2,3,5,7,11]
+ max_lvl = min(counts['max_level'],150)
level_list_endpoints = list(range(1, max_lvl + 1, 10))
level_list = ["%s-%s" % (start, end - 1) for start, end in zip(level_list_endpoints[:-1], level_list_endpoints[1:])]
- max_wt=min(counts['max_weight'], 10)
+ max_wt = min(counts['max_weight'], 10)
weight_list = list(range(1, max_wt + 1))
label_list = ["3.1.0.1.1","13.1.0.1.1"]
info = {'characteristic_list': characteristic_list, 'level_list': level_list,'weight_list': weight_list, 'label_list': label_list}
@@ -114,10 +114,10 @@ def download_search(info):
c = download_comment_prefix[lang]
s = '\n'
- s += c + ' Mod l modular forms downloaded from the LMFDB on %s. Found %s mod l modular forms.\n\n'%(mydate, len(res))
+ s += c + ' Mod l modular forms downloaded from the LMFDB on %s. Found %s mod l modular forms.\n\n' % (mydate, len(res))
s += ' Each entry is given in the following format: field characteristic, field degree, level, minimal weight, conductor.\n\n'
- list_start = '[*' if lang=='magma' else '['
- list_end = '*]' if lang=='magma' else ']'
+ list_start = '[*' if lang == 'magma' else '['
+ list_end = '*]' if lang == 'magma' else ']'
s += download_assignment_start[lang] + list_start + '\\\n'
for r in res:
for m in proj:
@@ -163,59 +163,59 @@ def render_modlmf_webpage(**args):
info['friends'] = []
- bread=[('Modular forms', "/ModularForm"),('mod ℓ', url_for(".modlmf_render_webpage")), ('%s' % data['label'], ' ')]
+ bread = [('Modular forms', "/ModularForm"),('mod ℓ', url_for(".modlmf_render_webpage")), ('%s' % data['label'], ' ')]
credit = modlmf_credit
for m in ['characteristic','deg','level','weight_grading', 'n_coeffs', 'min_theta_weight', 'ordinary']:
- info[m]=int(data[m])
- info['atkinlehner']=data['atkinlehner']
- info['dirchar']=str(data['dirchar'])
- info['label']=str(data['label'])
+ info[m] = int(data[m])
+ info['atkinlehner'] = data['atkinlehner']
+ info['dirchar'] = str(data['dirchar'])
+ info['label'] = str(data['label'])
if data['reducible']:
- info['reducible']=data['reducible']
- info['cuspidal_lift']=data['cuspidal_lift']
- info['cuspidal_lift_weight']=int(data['cuspidal_lift'][0])
- info['cuspidal_lift_orbit']=str(data['cuspidal_lift'][1])
+ info['reducible'] = data['reducible']
+ info['cuspidal_lift'] = data['cuspidal_lift']
+ info['cuspidal_lift_weight'] = int(data['cuspidal_lift'][0])
+ info['cuspidal_lift_orbit'] = str(data['cuspidal_lift'][1])
- if data['cuspidal_lift'][2]=='x':
- info['cuspidal_hecke_field']=1
+ if data['cuspidal_lift'][2] == 'x':
+ info['cuspidal_hecke_field'] = 1
else:
- info['cuspidal_hecke_field']=latex(data['cuspidal_lift'][2])
+ info['cuspidal_hecke_field'] = latex(data['cuspidal_lift'][2])
- info['cuspidal_lift_gen']=data['cuspidal_lift'][3]
+ info['cuspidal_lift_gen'] = data['cuspidal_lift'][3]
if data['theta_cycle']:
- info['theta_cycle']=data['theta_cycle']
+ info['theta_cycle'] = data['theta_cycle']
- info['coeffs']=[str(s).replace('x','a').replace('*','') for s in data['coeffs']]
+ info['coeffs'] = [str(s).replace('x','a').replace('*','') for s in data['coeffs']]
if data['deg'] != 1:
try:
pol = str(conway_polynomial(data['characteristic'], data['deg'])).replace('x','a').replace('*','')
- info['field']= pol
+ info['field'] = pol
except Exception:
- info['field']=""
+ info['field'] = ""
- ncoeff=int(round(20/data['deg']))
- av_coeffs=min(data['n_coeffs'],100)
- info['av_coeffs']=int(av_coeffs)
+ ncoeff = int(round(20/data['deg']))
+ av_coeffs = min(data['n_coeffs'],100)
+ info['av_coeffs'] = int(av_coeffs)
if data['coeffs'] != "":
- coeff=[info['coeffs'][i] for i in range(ncoeff+1)]
- info['q_exp']=my_latex(print_q_expansion(coeff))
+ coeff = [info['coeffs'][i] for i in range(ncoeff+1)]
+ info['q_exp'] = my_latex(print_q_expansion(coeff))
info['q_exp_display'] = url_for(".q_exp_display", label=data['label'], number="")
- p_range=prime_range(av_coeffs)
- info['table_list']=[[p_range[i], info['coeffs'][p_range[i]]] for i in range(len(p_range))]
+ p_range = prime_range(av_coeffs)
+ info['table_list'] = [[p_range[i], info['coeffs'][p_range[i]]] for i in range(len(p_range))]
info['download_q_exp'] = [
(i, url_for(".render_modlmf_webpage_download", label=info['label'], lang=i)) for i in ['gp', 'magma','sage']]
t = "Mod "+str(info['characteristic'])+" modular form "+info['label']
info['properties'] = [
- ('Label', '%s' %info['label']),
- ('Field characteristic', '%s' %info['characteristic']),
- ('Field degree', '%s' %info['deg']),
- ('Level', '%s' %info['level']),
- ('Weight grading', '%s' %info['weight_grading'])]
- return render_template("modlmf-single.html", info=info, credit=credit, title=t, bread=bread, properties=info['properties'], learnmore=learnmore_list(), KNOWL_ID='modlmf.%s'%info['label'])
+ ('Label', '%s' % info['label']),
+ ('Field characteristic', '%s' % info['characteristic']),
+ ('Field degree', '%s' % info['deg']),
+ ('Level', '%s' % info['level']),
+ ('Weight grading', '%s' % info['weight_grading'])]
+ return render_template("modlmf-single.html", info=info, credit=credit, title=t, bread=bread, properties=info['properties'], learnmore=learnmore_list(), KNOWL_ID='modlmf.%s' % info['label'])
#auxiliary function for displaying more coefficients of the theta series
@@ -237,7 +237,7 @@ def q_exp_display(label, number):
@modlmf_page.route("/Completeness")
def completeness_page():
t = 'Completeness of mod ℓ modular form data'
- bread=[('Modular forms', "/ModularForm"),('mod ℓ', url_for(".modlmf_render_webpage")),('Completeness', '')]
+ bread = [('Modular forms', "/ModularForm"),('mod ℓ', url_for(".modlmf_render_webpage")),('Completeness', '')]
credit = modlmf_credit
return render_template("single.html", kid='dq.modlmf.extent',
credit=credit, title=t, bread=bread, learnmore=learnmore_list_remove('Completeness'))
@@ -245,7 +245,7 @@ def completeness_page():
@modlmf_page.route("/Source")
def how_computed_page():
t = 'Source of mod ℓ modular form data'
- bread=[('Modular forms', "/ModularForm"),('mod ℓ', url_for(".modlmf_render_webpage")),('Source', '')]
+ bread = [('Modular forms', "/ModularForm"),('mod ℓ', url_for(".modlmf_render_webpage")),('Source', '')]
credit = modlmf_credit
return render_template("single.html", kid='dq.modlmf.source',
credit=credit, title=t, bread=bread, learnmore=learnmore_list_remove('Source'))
@@ -254,7 +254,7 @@ def how_computed_page():
def labels_page():
t = 'Label of a mod ℓ modular forms'
- bread=[('Modular forms', "/ModularForm"),('mod ℓ', url_for(".modlmf_render_webpage")), ('Labels', '')]
+ bread = [('Modular forms', "/ModularForm"),('mod ℓ', url_for(".modlmf_render_webpage")), ('Labels', '')]
credit = modlmf_credit
return render_template("single.html", kid='modlmf.label',
credit=credit, title=t, bread=bread, learnmore=learnmore_list_remove('Labels'))
@@ -274,9 +274,9 @@ def download_modlmf_full_lists(**args):
return "No such modlmf"
lang = args['lang']
c = download_comment_prefix[lang]
- outstr = c + ' List of q-expansion coefficients downloaded from the LMFDB on %s. \n\n'%(mydate)
+ outstr = c + ' List of q-expansion coefficients downloaded from the LMFDB on %s. \n\n' % (mydate)
if lang == 'magma':
- outstr += 'F:=FiniteField(%s,%s); \n' %(res['characteristic'], res['deg'])
+ outstr += 'F:=FiniteField(%s,%s); \n' % (res['characteristic'], res['deg'])
elif lang == 'sage':
outstr += 'F.=GF({0}^({1}), conway_polynomial({0},{1})) \n'.format(res['characteristic'], res['deg'])
diff --git a/lmfdb/modular_curves/main.py b/lmfdb/modular_curves/main.py
index 7934bb69f7..59c6cea01b 100644
--- a/lmfdb/modular_curves/main.py
+++ b/lmfdb/modular_curves/main.py
@@ -317,7 +317,7 @@ def needs_review():
return ModularCurveUploader().needs_review()
def blankzeros(n):
- return "$%o$"%n if n else ""
+ return "$%o$" % n if n else ""
modcurve_columns = SearchColumns(
[
@@ -332,7 +332,7 @@ def blankzeros(n):
MathCol("index", "modcurve.index", "Index"),
MathCol("genus", "modcurve.genus", "Genus"),
ProcessedCol("rank", "modcurve.rank", "Rank", lambda r: "" if r is None else r, default=lambda info: info.get("rank") or info.get("genus_minus_rank"), align="center", mathmode=True),
- ProcessedCol("q_gonality_bounds", "modcurve.gonality", r"$\Q$-gonality", lambda b: r'$%s$'%(b[0]) if b[0] == b[1] else r'$%s \le \gamma \le %s$'%(b[0],b[1]), align="center", short_title="Q-gonality"),
+ ProcessedCol("q_gonality_bounds", "modcurve.gonality", r"$\Q$-gonality", lambda b: r'$%s$' % (b[0]) if b[0] == b[1] else r'$%s \le \gamma \le %s$' % (b[0],b[1]), align="center", short_title="Q-gonality"),
MathCol("cusps", "modcurve.cusps", "Cusps"),
MathCol("rational_cusps", "modcurve.cusps", r"$\Q$-cusps", short_title="Q-cusps"),
CheckCol("cm_discriminants", "modcurve.cm_discriminants", "CM points", align="center"),
@@ -616,7 +616,7 @@ def download_modular_curve(self, label, lang):
return self._wrap(Json.dumps(data),
label,
lang=lang,
- title='Data for modular curve with label %s,'%label)
+ title='Data for modular curve with label %s,' % label)
@modcurve_page.route("/download_to_magma/")
def modcurve_magma_download(label):
@@ -873,7 +873,7 @@ def __init__(self):
)
cm_opts = ([('', ''), ('yes', 'rational CM points'), ('no', 'no rational CM points')]
+ [('-4,-16', 'CM field Q(sqrt(-1))'), ('-3,-12,-27', 'CM field Q(sqrt(-3))'), ('-7,-28', 'CM field Q(sqrt(-7))')]
- + [('-%d'%d, 'CM discriminant -%d'%d) for d in [3,4,7,8,11,12,16,19,27,38,43,67,163]])
+ + [('-%d' % d, 'CM discriminant -%d' % d) for d in [3,4,7,8,11,12,16,19,27,38,43,67,163]])
cm_discriminants = SelectBox(
name="cm_discriminants",
options=cm_opts,
@@ -1107,7 +1107,7 @@ def __init__(self):
)
cm_opts = ([('', ''), ('noCM', 'no potential CM'), ('CM', 'potential CM')]
+ [('-4,-16', 'CM field Q(sqrt(-1))'), ('-3,-12,-27', 'CM field Q(sqrt(-3))'), ('-7,-28', 'CM field Q(sqrt(-7))')]
- + [('-%d'%d, 'CM discriminant -%d'%d) for d in [3,4,7,8,11,12,16,19,27,38,43,67,163]])
+ + [('-%d' % d, 'CM discriminant -%d' % d) for d in [3,4,7,8,11,12,16,19,27,38,43,67,163]])
cm = SelectBox(
name="cm",
label="Complex multiplication",
diff --git a/lmfdb/modular_curves/test_modular_curves.py b/lmfdb/modular_curves/test_modular_curves.py
index b6f8d718a0..bc24c703e3 100644
--- a/lmfdb/modular_curves/test_modular_curves.py
+++ b/lmfdb/modular_curves/test_modular_curves.py
@@ -139,7 +139,7 @@ def test_modcrv_label(self):
assert "Cummins and Pauli (CP) label" in L.get_data(as_text=True)
assert "48P21" in L.get_data(as_text=True)
assert "Rouse, Sutherland, and Zureick-Brown (RSZB) label" in L.get_data(as_text=True)
- assert "48.576.21.26699"in L.get_data(as_text=True)
+ assert "48.576.21.26699" in L.get_data(as_text=True)
def test_GL2ZNZ_gens(self):
L = self.tc.get("/ModularCurve/Q/240.288.8-48.jt.2.31",follow_redirects=True)
diff --git a/lmfdb/modular_curves/web_curve.py b/lmfdb/modular_curves/web_curve.py
index 28071ab5c7..04c1c06a46 100644
--- a/lmfdb/modular_curves/web_curve.py
+++ b/lmfdb/modular_curves/web_curve.py
@@ -181,41 +181,33 @@ def formatted_model_html(self, m):
def title_of_model(self, lines, nb_var, typ, smooth):
if typ == 0:
- title = display_knowl('ag.canonical_model', 'Canonical model') +\
- r" in $\mathbb{P}^{ %d }$ " % (nb_var-1,)
+ title = display_knowl('ag.canonical_model', 'Canonical model') + r" in $\mathbb{P}^{ %d }$ " % (nb_var-1,)
if len(lines) > eqn_threshold:
title += " defined by %d equations" % (len(lines) - 1,)
return title
elif typ == 2:
#smooth is true, false, or none
if smooth is True:
- return display_knowl('modcurve.plane_model', 'Smooth plane model')+\
- " Smooth plane model"
+ return display_knowl('modcurve.plane_model', 'Smooth plane model')
elif smooth is False:
- return display_knowl('modcurve.plane_model', 'Singular plane model') +\
- " Singular plane model"
+ return display_knowl('modcurve.plane_model', 'Singular plane model')
else:
- return display_knowl('modcurve.plane_model', 'Plane model')+\
- " Plane model"
+ return display_knowl('modcurve.plane_model', 'Plane model')
elif typ == 5:
if self.genus == 1:
- return display_knowl('ec.weierstrass_coeffs', 'Weierstrass model') +\
- " Weierstrass model"
+ return display_knowl('ec.weierstrass_coeffs', 'Weierstrass model')
else:
- return display_knowl('ag.hyperelliptic_curve', 'Weierstrass model') +\
- " Weierstrass model"
+ return display_knowl('ag.hyperelliptic_curve', 'Weierstrass model')
elif typ == 7:
- return display_knowl('ag.hyperelliptic_curve', 'Geometric Weierstrass model')+\
- " Geometric Weierstrass model"
+ return display_knowl('ag.hyperelliptic_curve', 'Geometric Weierstrass model')
elif typ == 8:
- return display_knowl('modcurve.embedded_model', 'Embedded model') +\
- r" Embedded model in $\mathbb{P}^{%d}$" % (nb_var-1,)
+ return display_knowl('modcurve.embedded_model', 'Embedded model') + r" in $\mathbb{P}^{%d}$" % (nb_var-1,)
def equation_of_model(lines, typ):
- table = ''+\
- ''+\
+ table = '' +\
+ '' +\
f' $ {lines[0]} $ ' +\
- '$=$ '+\
+ '$=$ ' +\
f' $ {lines[1]} $ ' +\
' '
if typ == 2 or typ == 5: #plane or weierstrass, 1 eqn
@@ -393,7 +385,7 @@ def difference(Ad, Bd, Am, Bm):
return tuple(zip(*(sorted(C.items()))))
def modcurve_link(label):
- return '%s '%(url_for("modcurve.by_label",label=label),label)
+ return '%s ' % (url_for("modcurve.by_label",label=label),label)
def combined_data(label):
data = db.gps_gl2zhat_fine.lookup(label)
@@ -451,7 +443,7 @@ def friends(self):
if self.curve_label:
assert self.genus in [1,2]
route = "ec.by_ec_label" if self.genus == 1 else "g2c.by_label"
- name = ("Elliptic" if self.genus ==1 else "Genus 2") + " curve " + self.curve_label
+ name = ("Elliptic" if self.genus == 1 else "Genus 2") + " curve " + self.curve_label
friends.append((name, url_for(route, label=self.curve_label)))
else: # the best we can do is to point to the isogeny class
if self.genus == 1:
@@ -527,14 +519,14 @@ def coarse_description(self):
if self.contains_negative_one:
return r"yes"
else:
- return r"no $\quad$ (see %s for the level structure with $-I$)"%(modcurve_link(self.coarse_label))
+ return r"no $\quad$ (see %s for the level structure with $-I$)" % (modcurve_link(self.coarse_label))
@lazy_attribute
def quadratic_refinements(self):
if self.contains_negative_one:
qtwists = list(self.table.search({'coarse_label':self.label}, 'label'))
if len(qtwists) > 1:
- return r"%s"%(', '.join([modcurve_link(label) for label in qtwists if label != self.label]))
+ return r"%s" % (', '.join([modcurve_link(label) for label in qtwists if label != self.label]))
else:
return r"none in database"
else:
diff --git a/lmfdb/motives/main.py b/lmfdb/motives/main.py
index 8f2eb05bca..2215a28788 100644
--- a/lmfdb/motives/main.py
+++ b/lmfdb/motives/main.py
@@ -19,7 +19,7 @@ def index():
#if len(request.args) != 0:
# return hgm_search(**request.args)
info = {}
- friends=[('Hypergeometric', url_for(".index2"))]
+ friends = [('Hypergeometric', url_for(".index2"))]
return render_template("motive-index.html", title="Motives", bread=bread, credit=HGM_credit, info=info, friends=friends)
@motive_page.route("/Hypergeometric")
diff --git a/lmfdb/nfutils/psort.py b/lmfdb/nfutils/psort.py
index 4f8fc937a4..4940129726 100644
--- a/lmfdb/nfutils/psort.py
+++ b/lmfdb/nfutils/psort.py
@@ -44,7 +44,7 @@ def padded_list(c,k):
a = list(c.expansion(start_val=0))
except AttributeError:
a = c.list(start_val=0)
- return a[:k] + [ZZ(0)]* (k-len(a))
+ return a[:k] + [ZZ(0)] * (k-len(a))
def ZpX_key(k):
@@ -85,8 +85,8 @@ def make_keys(K,p):
hh = [QQx(h) for h in gfact]
for P in PP:
# exactly one mod-p factor h will be such that P|h(a).
- i = 1 + next((i for i,h in enumerate(hh) if h(a).valuation(P)>0), -1)
- assert i>0
+ i = 1 + next((i for i,h in enumerate(hh) if h(a).valuation(P) > 0), -1)
+ assert i > 0
key_dict[P] = (P.norm(),P.ramification_index(),i)
else:
# the general ramified case factor g over Z_p to precision
@@ -124,8 +124,8 @@ def make_keys(K,p):
hs = hd[e*f]
# work out which h in hs matches P
m = max([h(a).valuation(P) for h in hs])
- i = 1 + next((i for i,h in enumerate(hs) if h(a).valuation(P)==m), -1)
- assert i>0
+ i = 1 + next((i for i,h in enumerate(hs) if h(a).valuation(P) == m), -1)
+ assert i > 0
key_dict[P] = (P.norm(),e,i)
# Lastly we add a field j to each key (n,e,i) -> (n,j,e,i)
@@ -136,7 +136,7 @@ def make_keys(K,p):
new_key_dict = {}
for P in key_dict:
k = key_dict[P]
- j = 1 + sorted([v for v in vals if v[0]==k[0]]).index(k)
+ j = 1 + sorted([v for v in vals if v[0] == k[0]]).index(k)
new_key_dict[P] = (k[0],j,k[1],k[2])
#print("Setting psort_dict and primes_dict for p={} for K={}".format(p,K))
@@ -175,7 +175,7 @@ def prime_from_label(K, lab):
make_keys(K,p)
d = K.psort_dict[p]
try:
- return next(P for P in d if d[P][:2]==(n,j))
+ return next(P for P in d if d[P][:2] == (n,j))
except StopIteration:
return 0
@@ -193,7 +193,7 @@ def primes_of_degree_iter(K, deg, condition=None, sort_key=prime_label, maxnorm=
if condition is None or condition(p):
make_keys(K, p)
for P in K.primes_dict[p]:
- if P.residue_class_degree()==deg and P.norm()<=maxnorm:
+ if P.residue_class_degree() == deg and P.norm() <= maxnorm:
yield P
@@ -268,7 +268,7 @@ def exp_vec_wt_iter(w, wts):
for v0 in range(1+w//wts[-1]):
w1 = w-wts[-1]*v0
if w1 == 0:
- yield [0]* (len(wts)-1) + [v0]
+ yield [0] * (len(wts)-1) + [v0]
elif len(wts) > 1:
for v1 in exp_vec_wt_iter(w1,wts[:-1]):
yield v1+[v0]
@@ -345,7 +345,7 @@ def ideals_of_norm(K,n):
if not hasattr(K,'ideal_norm_dict'):
K.ideal_norm_dict = {}
if n not in K.ideal_norm_dict:
- if n==1:
+ if n == 1:
K.ideal_norm_dict[n] = [K.ideal(1)]
else:
K.ideal_norm_dict[n] = [prod(Q) for Q in cartesian_product_iterator([ppower_norm_ideals(K,p,e) for p,e in n.factor()])]
@@ -360,7 +360,7 @@ def ideal_norm_index(I):
r""" Return the index of this ideal among all ideals of the same norm.
"""
for i,J in enumerate(ideals_of_norm(I.number_field(),I.norm())):
- if I==J:
+ if I == J:
return i+1
return 0
diff --git a/lmfdb/number_fields/number_field.py b/lmfdb/number_fields/number_field.py
index 501004c319..227828b1ec 100644
--- a/lmfdb/number_fields/number_field.py
+++ b/lmfdb/number_fields/number_field.py
@@ -91,7 +91,7 @@ def nf_label_pretty(label):
# fixed precision display of float, rounding off
def fixed_prec(r, digs=3):
- if r>10**7:
+ if r > 10**7:
e = int(log(abs(r),10))
return r'%.3f\times 10^{%d}' % (r/10**e, e)
n = RealField(200)(r)*(10**digs)
@@ -122,7 +122,7 @@ def ctx_number_fields():
def global_numberfield_summary():
init_nf_count()
- return r'This database contains %s number fields of degree $n\leq %d$. Here are some further statistics . In addition, extensive data on class groups of quadratic imaginary fields is available for download.' %(comma(nfields),max_deg,url_for('number_fields.statistics'), url_for('number_fields.render_class_group_data'))
+ return r'This database contains %s number fields of degree $n\leq %d$. Here are some further statistics . In addition, extensive data on class groups of quadratic imaginary fields is available for download.' % (comma(nfields),max_deg,url_for('number_fields.statistics'), url_for('number_fields.render_class_group_data'))
def learnmore_list():
@@ -213,7 +213,7 @@ def render_class_group_data():
info['message'] = 'The value of k is either invalid or empty'
return class_group_request_error(info, bread)
k = int(k)
- if k>4095:
+ if k > 4095:
info['message'] = 'The value of k is too large'
return class_group_request_error(info, bread)
else:
@@ -247,7 +247,7 @@ def class_group_request_error(info, bread):
def galstatdict(li, tots, t):
return [{'cnt': comma(li[nn]),
'prop': format_percentage(li[nn], tots[nn]),
- 'query': url_for(".number_field_render_webpage")+'?degree=%d&galois_group=%s'%(nn + 1, "%dt%d" % (nn + 1, t[nn]))} for nn in range(len(li))]
+ 'query': url_for(".number_field_render_webpage")+'?degree=%d&galois_group=%s' % (nn + 1, "%dt%d" % (nn + 1, t[nn]))} for nn in range(len(li))]
@nf_page.route("/stats")
@@ -313,7 +313,7 @@ def statistics():
for r2 in range(12)]
nsig = [[{'cnt': comma(nsig[nn][r2]),
'prop': format_percentage(nsig[nn][r2], n[nn]),
- 'query': url_for(".number_field_render_webpage")+'?degree=%d&signature=[%d,%d]'%(nn+1,nn+1-2*r2,r2)} for r2 in range(len(nsig[nn]))] for nn in range(len(nsig))]
+ 'query': url_for(".number_field_render_webpage")+'?degree=%d&signature=[%d,%d]' % (nn+1,nn+1-2*r2,r2)} for r2 in range(len(nsig[nn]))] for nn in range(len(nsig))]
h = [{'cnt': comma(h[j]),
'prop': format_percentage(h[j], has_h),
'label': '$10^{' + str(j - 1) + r'}%s Data not computed '%str(ram_primes[j]).rstrip('L')
+ loc_alg += '%s Data not computed ' % str(ram_primes[j]).rstrip('L')
else:
from lmfdb.local_fields.main import show_slope_content
- primefirstline=True
+ primefirstline = True
mydat = ramified_algebras_data[j]
p = ram_primes[j]
pcomp = compress_int(p, cutoff=20)[0]
prawtyp = raw_typeset_int(p, cutoff=20)
- loc_alg += '%s '%(len(mydat),prawtyp)
+ loc_alg += '%s ' % (len(mydat),prawtyp)
for mm in mydat:
if primefirstline:
- primefirstline=False
+ primefirstline = False
else:
loc_alg += ''
- if len(mm)==4: # not in database
- if mm[1]*mm[2]==1: # Q_p
- loc_alg += '$\\Q_{%s}$ $x$ $1$ $1$ $0$ %s $%s$ '%(pcomp,transitive_group_display_knowl("1T1", "Trivial"), show_slope_content([],1,1))
- elif mm[1]*mm[2]==2: # quadratic
+ if len(mm) == 4: # not in database
+ if mm[1]*mm[2] == 1: # Q_p
+ loc_alg += '$\\Q_{%s}$ $x$ $1$ $1$ $0$ %s $%s$ ' % (pcomp,transitive_group_display_knowl("1T1", "Trivial"), show_slope_content([],1,1))
+ elif mm[1]*mm[2] == 2: # quadratic
loc_alg += 'Deg $2$ ${}$ ${}$ ${}$ {} ${}$ '.format(mm[1],mm[2],mm[3],transitive_group_display_knowl("2T1", "$C_2$"), show_slope_content([],mm[1],mm[2]))
- elif mm[1]==1: # unramified
+ elif mm[1] == 1: # unramified
# nT1 is cyclic except for n = 32
cyc = 33 if mm[2] == 32 else 1
loc_alg += 'Deg ${}$ ${}$ ${}$ ${}$ {} ${}$ '.format(mm[1]*mm[2],mm[1],mm[2],mm[3],transitive_group_display_knowl(f"{mm[2]}T{cyc}"), show_slope_content([],mm[1],mm[2]))
@@ -507,8 +507,8 @@ def render_field_webpage(args):
lab = mm[0]
myurl = url_for('local_fields.by_label', label=lab)
if mm[3]*mm[2] == 1:
- lab = r'$\Q_{%s}$'%str(p)
- loc_alg += '%s $%s$ $%d$ $%d$ $%d$ %s $%s$ '%(myurl,lab,mm[1],mm[2],mm[3],mm[4],mm[5],show_slope_content(mm[8],mm[6],mm[7]))
+ lab = r'$\Q_{%s}$' % str(p)
+ loc_alg += '%s $%s$ $%d$ $%d$ $%d$ %s $%s$ ' % (myurl,lab,mm[1],mm[2],mm[3],mm[4],mm[5],show_slope_content(mm[8],mm[6],mm[7]))
loc_alg += ' \n'
loc_alg += '
\n'
@@ -562,8 +562,8 @@ def render_field_webpage(args):
# Short version for properties
grh_lab = nf.short_grh_string()
if 'computed' in str(data['class_number']):
- grh_lab=''
- grh_label=''
+ grh_lab = ''
+ grh_label = ''
pretty_label = field_pretty(label)
if label != pretty_label:
pretty_label = "%s: %s" % (label, pretty_label)
@@ -624,7 +624,7 @@ def render_field_webpage(args):
poly=nf.poly())))
resinfo = []
galois_closure = nf.galois_closure()
- if galois_closure[0]>0:
+ if galois_closure[0] > 0:
if galois_closure[1]:
resinfo.append(('gc', galois_closure[1]))
if galois_closure[2]:
@@ -633,7 +633,7 @@ def render_field_webpage(args):
resinfo.append(('gc', [dnc]))
sextic_twins = nf.sextic_twin()
- if sextic_twins[0]>0:
+ if sextic_twins[0] > 0:
if sextic_twins[1]:
resinfo.append(('sex', r' $\times$ '.join(sextic_twins[1])))
else:
@@ -649,7 +649,7 @@ def render_field_webpage(args):
else:
nsibs = len(sibdeg[2])
sibdeg[2] = ', '.join(sibdeg[2])
- if nsibs0:
+ if arith_equiv[0] > 0:
if arith_equiv[1]:
resinfo.append(('ae', ', '.join(arith_equiv[1]), len(arith_equiv[1])))
for aelab in arith_equiv[2]:
@@ -718,7 +718,7 @@ def dopow(m):
info["mydecomp"] = [dopow(x) for x in v]
except AttributeError:
pass
- return render_template("nf-show-field.html", properties=properties, title=title, bread=bread, code=nf.code, friends=info.pop('friends'), downloads=downloads, learnmore=learnmore, info=info, formatfield=formatfield, KNOWL_ID="nf.%s"%label)
+ return render_template("nf-show-field.html", properties=properties, title=title, bread=bread, code=nf.code, friends=info.pop('friends'), downloads=downloads, learnmore=learnmore, info=info, formatfield=formatfield, KNOWL_ID="nf.%s" % label)
#@nf_page.route("/")
# def number_fields():
@@ -948,8 +948,8 @@ def see_frobs(frob_data):
if not firstone:
s += r'{,}\,'
if j[0] < 15:
- s += r'{\href{%s}{%d} }'%(url_for('local_fields.by_label',
- label="%d.%d.0.1"%(p,j[0])), j[0])
+ s += r'{\href{%s}{%d} }' % (url_for('local_fields.by_label',
+ label="%d.%d.0.1" % (p,j[0])), j[0])
else:
s += str(j[0])
if j[1] > 1:
@@ -979,9 +979,9 @@ def frobs(nf):
for j in dec:
if not firstone:
s += r'{,}\,'
- if j[0]<15:
- s += r'{\href{%s}{%d} }'%(url_for('local_fields.by_label',
- label="%d.%d.0.1"%(p,j[0])), j[0])
+ if j[0] < 15:
+ s += r'{\href{%s}{%d} }' % (url_for('local_fields.by_label',
+ label="%d.%d.0.1" % (p,j[0])), j[0])
else:
s += str(j[0])
if j[1] > 1:
@@ -1041,24 +1041,24 @@ def nf_data(**args):
subs = [[coeff_to_poly(string2list(z[0])),z[1]] for z in subs]
# Now add actual data
- data += '[%s, '%nf.poly()
- data += '%s, '%nf.degree()
- data += '%s, '%nf.galois_t()
- data += '%s, '%nf.signature()
- data += '%s, '%nf.disc()
- data += '%s, '%nf.ramified_primes()
- data += '[%s], '%zk
- data += '%s, '%str(1 if nf.is_cm_field() else 0)
+ data += '[%s, ' % nf.poly()
+ data += '%s, ' % nf.degree()
+ data += '%s, ' % nf.galois_t()
+ data += '%s, ' % nf.signature()
+ data += '%s, ' % nf.disc()
+ data += '%s, ' % nf.ramified_primes()
+ data += '[%s], ' % zk
+ data += '%s, ' % str(1 if nf.is_cm_field() else 0)
if nf.can_class_number():
units = ','.join(unlatex(z) for z in nf.units())
- data += '%s, '%nf.class_number()
- data += '%s, '%nf.class_group_invariants_raw()
- data += '%s, '%(1 if nf.used_grh() else 0)
- data += '[%s], '%units
- data += '%s, '%nf.regulator()
+ data += '%s, ' % nf.class_number()
+ data += '%s, ' % nf.class_group_invariants_raw()
+ data += '%s, ' % (1 if nf.used_grh() else 0)
+ data += '[%s], ' % units
+ data += '%s, ' % nf.regulator()
else:
data += '0,0,0,0,0, '
- data += '%s'%subs
+ data += '%s' % subs
data += ']'
return data
diff --git a/lmfdb/number_fields/web_number_field.py b/lmfdb/number_fields/web_number_field.py
index 4d543b554e..4f9c6965cc 100644
--- a/lmfdb/number_fields/web_number_field.py
+++ b/lmfdb/number_fields/web_number_field.py
@@ -179,7 +179,7 @@
for n in [1,3,4]:
rcyclolookup[n] = '1.1.1.1'
for n in [5,8,12]:
- rcyclolookup[n] = '2.2.%s.1'%n
+ rcyclolookup[n] = '2.2.%s.1' % n
for n, label in list(rcyclolookup.items()):
if n % 2:
rcyclolookup[2 * n] = label
@@ -220,13 +220,13 @@ def field_pretty(label):
# Don't prettify invalid quadratic field labels
if not is_fundamental_discriminant(D):
return label
- return r'\(\Q(\sqrt{' + str(D if D%4 else D/4) + r'}) \)'
+ return r'\(\Q(\sqrt{' + str(D if D % 4 else D/4) + r'}) \)'
if label in cycloinfo:
return r'\(\Q(\zeta_{%d})\)' % cycloinfo[label]
if d == '4':
wnf = WebNumberField(label)
subs = wnf.subfields()
- if len(subs)==3: # only for V_4 fields
+ if len(subs) == 3: # only for V_4 fields
subs = [wnf.from_coeffs(string2list(str(z[0]))) for z in subs]
# Abort if we don't know one of these fields
if not any(z._data is None for z in subs):
@@ -236,14 +236,14 @@ def field_pretty(label):
labels = sorted([[integer_squarefree_part(ZZ(z[2])), - int(z[1])] for z in labels])
# put in +/- sign
labels = [z[0]*(-1)**(1+z[1]/2) for z in labels]
- labels = ['i' if z == -1 else r'\sqrt{%d}'% z for z in labels]
- return r'\(\Q(%s, %s)\)'%(labels[0],labels[1])
+ labels = ['i' if z == -1 else r'\sqrt{%d}' % z for z in labels]
+ return r'\(\Q(%s, %s)\)' % (labels[0],labels[1])
if label in rcycloinfo:
return r'\(\Q(\zeta_{%d})^+\)' % rcycloinfo[label]
return label
def psum(val, li):
- tot=0
+ tot = 0
for j in range(len(li)):
tot += li[j]*val**j
return tot
@@ -307,7 +307,7 @@ def modules2string(n, t, modlist):
ans = modlist[0][0]
modlist[0][1] -= 1
for j in range(len(modlist)):
- while modlist[j][1]>0:
+ while modlist[j][1] > 0:
ans += r' $\oplus$ '+modlist[j][0]
modlist[j][1] -= 1
return ans
@@ -348,8 +348,8 @@ def nf_knowl_guts(label):
if 'gal' in res:
galstring = formatfield(string2list(res['gal'][0]))
else:
- galord = db.gps_transitive.lookup('%dT%d'%(wnf.degree(), wnf.galois_t()), 'order')
- galstring = r'degree %d extension of $\Q$ is not in the database'%galord
+ galord = db.gps_transitive.lookup('%dT%d' % (wnf.degree(), wnf.galois_t()), 'order')
+ galstring = r'degree %d extension of $\Q$ is not in the database' % galord
out += ' Galois closure: ' + galstring
out += ''
out += ''
@@ -391,7 +391,7 @@ def fakenf(cls, coeffs):
coefstr = string2list(coeffs)
n = len(coefstr)-1
data = {'coeffs': coeffs, 'degree': n}
- return cls('Degree %d field'%n, data)
+ return cls('Degree %d field' % n, data)
@classmethod
def from_polredabs(cls, pol):
@@ -537,10 +537,10 @@ def degree(self):
return self._data['degree']
def is_real_quadratic(self):
- return self.signature()==[2,0]
+ return self.signature() == [2,0]
def is_imag_quadratic(self):
- return self.signature()==[0,1]
+ return self.signature() == [0,1]
def poly(self, var="x"):
return coeff_to_poly(self._data['coeffs'], var=var)
@@ -549,10 +549,10 @@ def haskey(self, key):
return self._data and self._data.get(key) is not None
def discrootfieldcoeffs(self):
- factored= factor_base_factor(self.disc(),self.ramified_primes())
+ factored = factor_base_factor(self.disc(),self.ramified_primes())
if self.disc() < 0:
factored += [[-1,1]]
- factored=[[z[0], z[1] % 2] for z in factored]
+ factored = [[z[0], z[1] % 2] for z in factored]
newd = prod([z[0]**z[1] for z in factored])
if newd == 1:
return ([0,1], 1)
@@ -563,7 +563,7 @@ def discrootfieldcoeffs(self):
def discrootfield(self):
(rfcoeffs, newd) = self.discrootfieldcoeffs()
- return formatfield(rfcoeffs, missing_text=r'$\Q(\sqrt{%s}$)'% compress_int(newd, sides=5)[0])
+ return formatfield(rfcoeffs, missing_text=r'$\Q(\sqrt{%s}$)' % compress_int(newd, sides=5)[0])
# Warning, this produces our preferred integral basis
# But, if you have the sage number field do computations,
@@ -586,7 +586,7 @@ def monogenic(self):
def index(self):
if self.haskey('index'):
- return r'$%d$'%self._data['index']
+ return r'$%d$' % self._data['index']
return 'Not computed'
def inessentialp(self):
@@ -630,11 +630,11 @@ def galois_sib_data(self):
for s in sibcnts:
repcounts[s[0][0]] += s[1]
gc = 0
- if galord<48:
+ if galord < 48:
del repcounts[galord]
if self.degree() < galord:
gc = 1
- if numae>0:
+ if numae > 0:
repcounts[self.degree()] -= numae
if repcounts[self.degree()] == 0:
del repcounts[self.degree()]
@@ -656,7 +656,7 @@ def siblings(self):
helpout = [[len(string2list(a))-1,formatfield(a)] for a in resall['sib']]
else:
helpout = []
- degsiblist = [[d, cnts[d], [dd[1] for dd in helpout if dd[0]==d] ] for d in sorted(cnts)]
+ degsiblist = [[d, cnts[d], [dd[1] for dd in helpout if dd[0] == d] ] for d in sorted(cnts)]
return [degsiblist, self.sibling_labels()]
def sextic_twin(self):
@@ -677,7 +677,7 @@ def galois_closure(self):
resall = self.resolvents()
cnt = self.galois_sib_data()[2]
if 'gal' in resall:
- knowls= [formatfield(a) for a in resall['gal']]
+ knowls = [formatfield(a) for a in resall['gal']]
gal = [self.from_coeffs(str(a)) for a in resall['gal']]
labs = [a.label for a in gal if a._data is not None]
return [cnt, knowls, labs]
@@ -709,7 +709,7 @@ def subfields_show(self):
def unit_galois_action(self):
if not self.haskey('unitsGmodule'):
- if self.signature()==[0,2] and self.galois_t() ==2:
+ if self.signature() == [0,2] and self.galois_t() == 2:
return [[1,1]]
# We don't have C_4 classification yet
#if self.signature()==[2,0] or self.signature()==[0,2]:
@@ -756,7 +756,7 @@ def gpK(self):
def generator_name(self):
#Add special case code for the generator if desired:
- if self.gen_name=='phi':
+ if self.gen_name == 'phi':
return r'\phi'
else:
return web_latex(self.gen_name)
@@ -796,25 +796,25 @@ def units(self): # fundamental units
return na_text()
def cnf(self):
- if self.degree()==1:
+ if self.degree() == 1:
return r'=\mathstrut & \frac{2^1 (2\pi)^0 \cdot 1\cdot 1}{2\cdot\sqrt 1}' + r'\cr' + r'= \mathstrut & 1'
[r1,r2] = self.signature()
w = self.root_of_1_order()
- r1term= r'2^{%s}\cdot'% r1
- r2term= r'(2\pi)^{%s}\cdot'% r2
+ r1term = r'2^{%s}\cdot' % r1
+ r2term = r'(2\pi)^{%s}\cdot' % r2
disc = ZZ(self._data['disc_abs'])
approx1 = r'= \mathstrut &'
if not self.haskey('class_group'):
- ltx = r'%s\frac{%s%s %s \cdot %s}{%s\cdot\sqrt{%s}}'%(approx1,r1term,r2term,'R','h',w,disc)
+ ltx = r'%s\frac{%s%s %s \cdot %s}{%s\cdot\sqrt{%s}}' % (approx1,r1term,r2term,'R','h',w,disc)
return ltx+r'\cr\mathstrut & \text{
some values not computed }'
# Otherwise we should have what we need
reg = self.regulator()
h = self.class_number()
- approx1 = r'\approx' if self.unit_rank()>0 else r'='
+ approx1 = r'\approx' if self.unit_rank() > 0 else r'='
approx1 += r"\mathstrut &"
- ltx = r'%s\frac{%s%s %s \cdot %s}{%s\cdot\sqrt{%s}}'%(approx1,r1term,r2term,str(reg),h,w,disc)
+ ltx = r'%s\frac{%s%s %s \cdot %s}{%s\cdot\sqrt{%s}}' % (approx1,r1term,r2term,str(reg),h,w,disc)
ltx += "\\cr"
- ltx += r'\approx \mathstrut & %s'%(2**r1*(2*RR(pi))**r2*reg*h/(w*sqrt(RR(disc))))
+ ltx += r'\approx \mathstrut & %s' % (2**r1*(2*RR(pi))**r2*reg*h/(w*sqrt(RR(disc))))
return ltx
def is_cm_field(self):
@@ -851,7 +851,7 @@ def class_group(self):
return 'Trivial group, which has order $1$'
cg_list = [r'C_{%s}' % z for z in cg_list]
cg_string = r'\times '.join(cg_list)
- return '$%s$, which has order %s'%(cg_string, self.class_number_latex())
+ return '$%s$, which has order %s' % (cg_string, self.class_number_latex())
return na_text()
def class_number(self):
@@ -861,7 +861,7 @@ def class_number(self):
def class_number_latex(self):
if self.haskey('class_number'):
- return '$%s$'%str(self._data['class_number'])
+ return '$%s$' % str(self._data['class_number'])
return na_text()
def can_class_number(self):
diff --git a/lmfdb/sato_tate_groups/main.py b/lmfdb/sato_tate_groups/main.py
index db29657df9..8a522f252f 100644
--- a/lmfdb/sato_tate_groups/main.py
+++ b/lmfdb/sato_tate_groups/main.py
@@ -307,32 +307,32 @@ def convert_label(label):
def st_name(label):
label = convert_label(label)
if re.match(MU_LABEL_RE, label):
- name = r'\mu(%s)'%label.split('.')[2]
+ name = r'\mu(%s)' % label.split('.')[2]
elif re.match(NU1_MU_LABEL_RE, label):
if label.split('.')[3] == 'd1':
if label.split('.')[0] == '1':
label = '1.2.B.2.1a'
name = r'N(\mathrm{U}(1))'
else:
- name = r'\mathrm{U}(1)[D_{%s}]'%label.split('.')[3][1:]
+ name = r'\mathrm{U}(1)[D_{%s}]' % label.split('.')[3][1:]
elif re.match(SU2_MU_LABEL_RE, label):
if label.split('.')[3] == 'c1':
if label.split('.')[0] == '1':
label = '1.2.A.1.1a'
name = r'\mathrm{SU}(2)'
else:
- name = r'\mathrm{SU}(2)[C_{%s}]'%label.split('.')[3][1:]
+ name = r'\mathrm{SU}(2)[C_{%s}]' % label.split('.')[3][1:]
else:
data = db.gps_st.lookup(label,projection=["name","pretty"])
name = (data['pretty'] if data['pretty'] else data['name']) if data else None
return name, label
def st_ambient(weight, degree):
- return '\\mathrm{USp}(%d)'%degree if weight%2 == 1 else '\\mathrm{O}(%d)'%degree
+ return '\\mathrm{USp}(%d)' % degree if weight % 2 == 1 else '\\mathrm{O}(%d)' % degree
def trace_moments(moments):
for m in moments:
- if m[0] == 'a_1'or m[0] == 's_1':
+ if m[0] == 'a_1' or m[0] == 's_1':
return m[1:10]
return ''
@@ -365,20 +365,20 @@ def st_pretty(st_name):
def st_link(label,name=None):
if not name:
name, label = st_name(label)
- return '%s ' % (url_for('st.by_label', label=label), "$%s$"%name if (name and name != label) else label)
+ return '%s ' % (url_for('st.by_label', label=label), "$%s$" % name if (name and name != label) else label)
def st_link_by_name(weight,degree,name):
- return '$%s$ ' % (url_for('st.by_label', label="%s.%s.%s"%(weight,degree,name)), st_pretty(name))
+ return '$%s$ ' % (url_for('st.by_label', label="%s.%s.%s" % (weight,degree,name)), st_pretty(name))
def st_anchor(label):
if label in st_latex_dict:
- return r"$%s$"%st_latex_dict[label]
+ return r"$%s$" % st_latex_dict[label]
elif re.match(MU_LABEL_RE, label):
- return r"$\mu(%s)$"%label.split('.')[2]
+ return r"$\mu(%s)$" % label.split('.')[2]
elif re.match(NU1_MU_LABEL_RE, label):
- return r"$N(\mathrm{U}(1))$" if label.split('.')[3] == 'd1' else r"$\mathrm{U}(1)[D_{%s}]$"%label.split('.')[3][1:]
+ return r"$N(\mathrm{U}(1))$" if label.split('.')[3] == 'd1' else r"$\mathrm{U}(1)[D_{%s}]$" % label.split('.')[3][1:]
elif re.match(SU2_MU_LABEL_RE, label):
- return r"$\mathrm{SU}(2)$" if label.split('.')[3] == 'c1' else r"$\mathrm{SU}(2)[C_{%s}]$"%label.split('.')[3][1:]
+ return r"$\mathrm{SU}(2)$" if label.split('.')[3] == 'c1' else r"$\mathrm{SU}(2)[C_{%s}]$" % label.split('.')[3][1:]
else:
return label
@@ -407,9 +407,9 @@ def st_knowl(label):
return "Unable to locate data for Sato-Tate group with label %s" % label
label = data['label'] # label might have been converted
def row_wrap(cap, val): return " %s: %s \n" % (cap, val)
- def math_mode(s): return '$%s$'%s
+ def math_mode(s): return '$%s$' % s
info = '
\n'
- info += row_wrap('Sato-Tate group %s '%label, math_mode(data['pretty']))
+ info += row_wrap('Sato-Tate group %s ' % label, math_mode(data['pretty']))
info += " \n"
info += row_wrap(display_knowl('st_group.weight','Weight'), math_mode(data['weight']))
info += row_wrap(display_knowl('st_group.degree','Degree'), math_mode(data['degree']))
@@ -423,7 +423,7 @@ def math_mode(s): return '$%s$'%s
if data.get('character_diagonal'):
info += row_wrap(display_knowl('st_group.moment_matrix','Character diagonal'), math_mode(data['character_diagonal']))
info += "
\n"
- info += '
Sato-Tate group %s home page
'%st_link(label,name=label)
+ info += '
Sato-Tate group %s home page
' % st_link(label,name=label)
return info
def st_display_knowl(label):
@@ -524,7 +524,7 @@ def index():
info = to_dict(request.args, search_array=STSearchArray(), stats=STStats())
if request.args:
return sato_tate_search(info)
- weight_list= [0, 1]
+ weight_list = [0, 1]
degree_list = list(range(1, 7, 1))
for key, val in [('weight_list', weight_list),
@@ -695,14 +695,14 @@ def mu_data(n):
rec['components'] = int(n)
rec['component_group'] = db.gps_special_names.lucky({'family':'C','parameters':{'n':n}},projection='label')
if rec['component_group'] is None:
- rec['component_group'] = 'ab/%s'%n
+ rec['component_group'] = 'ab/%s' % n
else:
rec['component_group_number'] = int(rec['component_group'].split('.')[1])
rec['st0_label'] = '0.1.A'
rec['identity_component'] = 'SO(1)'
- rec['trace_zero_density']='0'
- rec['gens'] = [[[r"\zeta_{%d}"%n]]]
- rec['subgroups'] = ["0.1.%d"%(n/p) for p in n.prime_factors()]
+ rec['trace_zero_density'] = '0'
+ rec['gens'] = [[[r"\zeta_{%d}" % n]]]
+ rec['subgroups'] = ["0.1.%d" % (n/p) for p in n.prime_factors()]
rec['subgroup_multiplicities'] = [1 for p in n.prime_factors()]
# only list supgroups with the same ambient (i.e.if mu(n) lies in O(1) don't list supgroups that are not)
if n == 1:
@@ -713,12 +713,12 @@ def mu_data(n):
rec['maximal'] = True
elif n > 2:
if n <= 200000:
- rec['supgroups'] = ["0.1.%d"%(p*n) for p in [2,3,5]]
+ rec['supgroups'] = ["0.1.%d" % (p*n) for p in [2,3,5]]
rec['maximal'] = False
rec['moments'] = [['a_1'] + [1 if m % n == 0 else 0 for m in range(13)]]
rec['second_trace_moment'] = 1 if 2 % n == 0 else 0
rec['fourth_trace_moment'] = 1 if 4 % n == 0 else 0
- rec['counts'] = [['a_1', [[t,1] for t in ([1] if n%2 else [1,-1])]]]
+ rec['counts'] = [['a_1', [[t,1] for t in ([1] if n % 2 else [1,-1])]]]
rec['zvector'] = []
return rec
@@ -742,33 +742,33 @@ def su2_mu_data(w, n):
if w == 1 and n == 1:
return db.gps_st.lookup('1.2.A.1.1a')
rec = {}
- rec['label'] = "%d.2.3.c%d"%(w,n)
+ rec['label'] = "%d.2.3.c%d" % (w,n)
rec['weight'] = w
rec['degree'] = 2
rec['rational'] = bool(n <= 2)
- rec['name'] = 'SU(2)[C%d]'%n if n > 1 else 'SU(2)'
- rec['pretty'] = r'\mathrm{SU}(2)[C_{%d}]'%n if n > 1 else r'\mathrm{SU}(2)'
+ rec['name'] = 'SU(2)[C%d]' % n if n > 1 else 'SU(2)'
+ rec['pretty'] = r'\mathrm{SU}(2)[C_{%d}]' % n if n > 1 else r'\mathrm{SU}(2)'
rec['real_dimension'] = 3
rec['components'] = int(n)
rec['component_group'] = db.gps_special_names.lucky({'family':'C','parameters':{'n':n}},projection='label')
if rec['component_group'] is None:
- rec['component_group'] = 'ab/%s'%n
+ rec['component_group'] = 'ab/%s' % n
else:
rec['component_group_number'] = int(rec['component_group'].split('.')[1])
- rec['st0_label'] = '%d.2.A'%w
+ rec['st0_label'] = '%d.2.A' % w
rec['identity_component'] = 'SU(2)'
- rec['trace_zero_density']='0'
- rec['gens'] = [[['1','0'],['0',r'\zeta_{%d}'%n]]]
- rec['subgroups'] = ["%d.2.A.c%d"%(w,n/p) for p in n.prime_factors()]
+ rec['trace_zero_density'] = '0'
+ rec['gens'] = [[['1','0'],['0',r'\zeta_{%d}' % n]]]
+ rec['subgroups'] = ["%d.2.A.c%d" % (w,n/p) for p in n.prime_factors()]
rec['subgroup_multiplicities'] = [1 for p in n.prime_factors()]
if n == 1:
rec['supgroups'] = []
rec['maximal'] = True
else:
- rec['supgroups'] = ["%d.2.A.c%d"%(w,p*n) for p in [2,3,5]]
+ rec['supgroups'] = ["%d.2.A.c%d" % (w,p*n) for p in [2,3,5]]
rec['maximal'] = False
su2_moments = [1, 0, 1, 0, 2, 0, 5, 0, 14, 0, 42, 0, 132]
- rec['moments'] = [['a_1'] + [su2_moments[m] if m%n == 0 else 0 for m in range(13)]]
+ rec['moments'] = [['a_1'] + [su2_moments[m] if m % n == 0 else 0 for m in range(13)]]
rec['second_trace_moment'] = 1 if 2 % n == 0 else 0
rec['fourth_trace_moment'] = 2 if 4 % n == 0 else 0
rec['counts'] = []
@@ -797,32 +797,32 @@ def nu1_mu_data(w,n):
if w == 1 and n == 1:
return db.gps_st.lookup('1.2.B.2.1a')
rec = {}
- rec['label'] = "%d.2.1.d%d"%(w,n)
+ rec['label'] = "%d.2.1.d%d" % (w,n)
rec['weight'] = w
rec['degree'] = 2
rec['rational'] = bool(n <= 2)
- rec['name'] = 'U(1)[C%d]'%n if n > 1 else 'N(U(1))'
- rec['pretty'] = r'\mathrm{U}(1)[D_{%d}]'%n if n > 1 else r'N(\mathrm{U}(1))'
+ rec['name'] = 'U(1)[C%d]' % n if n > 1 else 'N(U(1))'
+ rec['pretty'] = r'\mathrm{U}(1)[D_{%d}]' % n if n > 1 else r'N(\mathrm{U}(1))'
rec['real_dimension'] = 1
rec['components'] = int(2*n)
rec['component_group'] = '4.2' if n == 2 else db.gps_special_names.lucky({'family':'D','parameters':{'n':n}},projection='label')
if rec['component_group'] is None:
return None
rec['component_group_number'] = int(rec['component_group'].split('.')[1])
- rec['st0_label'] = '%d.2.B'%w
+ rec['st0_label'] = '%d.2.B' % w
rec['identity_component'] = 'U(1)'
- rec['trace_zero_density']='1/2'
- rec['gens'] = [[['0','1'],['-1','0']],[['1','0'],['0',r'\zeta_{%d}'%n]]]
- rec['subgroups'] = ["%d.2.B.D%d"%(w,n/p) for p in n.prime_factors()]
+ rec['trace_zero_density'] = '1/2'
+ rec['gens'] = [[['0','1'],['-1','0']],[['1','0'],['0',r'\zeta_{%d}' % n]]]
+ rec['subgroups'] = ["%d.2.B.D%d" % (w,n/p) for p in n.prime_factors()]
rec['subgroup_multiplicities'] = [1 for p in n.prime_factors()]
if n == 1:
rec['supgroups'] = []
rec['maximal'] = True
else:
- rec['supgroups'] = ["%d.2.B.D%d"%(w,p*n) for p in [2,3,5]]
+ rec['supgroups'] = ["%d.2.B.D%d" % (w,p*n) for p in [2,3,5]]
rec['maximal'] = False
nu1_moments = [1, 0, 1, 0, 3, 0, 10, 0, 35, 0, 126, 0, 462]
- rec['moments'] = [['a_1'] + [nu1_moments[m] if m%n == 0 else 0 for m in range(13)]]
+ rec['moments'] = [['a_1'] + [nu1_moments[m] if m % n == 0 else 0 for m in range(13)]]
rec['second_trace_moment'] = 1 if 2 % n == 0 else 0
rec['fourth_trace_moment'] = 3 if 4 % n == 0 else 0
rec['counts'] = [['a_1', [[0,n]]]]
@@ -864,31 +864,31 @@ def render_by_label(label):
for attr in ['label','weight','degree','name','pretty','real_dimension','components']:
info[attr] = data[attr]
info['ambient'] = st_ambient(info['weight'],info['degree'])
- info['connected']=boolean_name(info['components'] == 1)
- info['rational']=boolean_name(info.get('rational',True))
+ info['connected'] = boolean_name(info['components'] == 1)
+ info['rational'] = boolean_name(info.get('rational',True))
st0 = db.gps_st0.lucky({'name':data['identity_component']})
if not st0:
flash_error ("%s is not the label of a Sato-Tate identity component currently in the database.", data['identity_component'])
return redirect(url_for(".index"))
info['symplectic_form'] = st0.get('symplectic_form')
info['hodge_circle'] = st0.get('hodge_circle')
- info['st0_name']=st0['name']
- info['identity_component']=st0['pretty']
- info['st0_description']=st0['description']
+ info['st0_name'] = st0['name']
+ info['identity_component'] = st0['pretty']
+ info['st0_description'] = st0['description']
if data['component_group'][:2] == "ab":
- info['component_group'] = r"C_{%s}"%info['components']
- info['cyclic']=boolean_name(True)
- info['abelian']=boolean_name(True)
- info['solvable']=boolean_name(True)
+ info['component_group'] = r"C_{%s}" % info['components']
+ info['cyclic'] = boolean_name(True)
+ info['abelian'] = boolean_name(True)
+ info['solvable'] = boolean_name(True)
else:
G = db.gps_groups.lookup(data['component_group'])
if not G:
flash_error ("%s is not the label of a Sato-Tate component group currently in the database.", data['component_group'])
return redirect(url_for(".index"))
- info['component_group']=G['tex_name']
- info['cyclic']=boolean_name(G['cyclic'])
- info['abelian']=boolean_name(G['abelian'])
- info['solvable']=boolean_name(G['solvable'])
+ info['component_group'] = G['tex_name']
+ info['cyclic'] = boolean_name(G['cyclic'])
+ info['abelian'] = boolean_name(G['abelian'])
+ info['solvable'] = boolean_name(G['solvable'])
if data.get('gens'):
info['gens'] = comma_separated_list([string_matrix(m) for m in data['gens']]) if isinstance(data['gens'], list) else data['gens']
info['numgens'] = len(info['gens'])
@@ -896,13 +896,13 @@ def render_by_label(label):
info['numgens'] = 0
if data.get('subgroups'):
if data.get('subgroup_multiplicities') and len(data["subgroup_multiplicities"]) == len(data['subgroups']):
- mults = ["${}^{\\times %d}$"%m if m >1 else "" for m in data['subgroup_multiplicities']]
+ mults = ["${}^{\\times %d}$" % m if m > 1 else "" for m in data['subgroup_multiplicities']]
else:
mults = ["" for s in data['subgroups']]
info['subgroups'] = comma_separated_list([st_link(data['subgroups'][i]) + mults[i] for i in range(len(mults))])
if data.get('supgroups'):
if data.get('supgroup_multiplicities') and len(data["supgroup_multiplicities"]) == len(data['supgroups']):
- mults = ["${}^{\\times %d}$"%m if m >1 else "" for m in data['supgroup_multiplicities']]
+ mults = ["${}^{\\times %d}$" % m if m > 1 else "" for m in data['supgroup_multiplicities']]
else:
mults = ["" for s in data['supgroups']]
info['supgroups'] = comma_separated_list([st_link(data['supgroups'][i]) + mults[i] for i in range(len(mults))])
@@ -912,18 +912,18 @@ def render_by_label(label):
else:
info['supgroups'] = "$\\cdots$"
if data.get('moments'):
- info['moments'] = [['x'] + [ '\\mathrm{E}[x^{%d}]'%m for m in range(len(data['moments'][0])-1)]]
+ info['moments'] = [['x'] + [ '\\mathrm{E}[x^{%d}]' % m for m in range(len(data['moments'][0])-1)]]
info['moments'] += data['moments']
if data.get('simplex'):
if data['degree'] == 4:
s = data['simplex']
- if len(s)>= 27:
+ if len(s) >= 27:
info['simplex'] = [s[0:2],s[2:5],s[5:9],s[9:14],s[14:20],s[20:27]]
elif len(s) >= 20:
info['simplex'] = [s[0:2],s[2:5],s[5:9],s[9:14],s[14:20]]
elif len(s) >= 14:
info['simplex'] = [s[0:2],s[2:5],s[5:9],s[9:14],s[14:20]]
- info['simplex_header'] = [r"\left(\mathrm{E}\left[a_1^{e_1}a_2^{e_2}\right]:\sum ie_i=%d\right)\colon"%(2*d+2) for d in range(len(info['simplex']))]
+ info['simplex_header'] = [r"\left(\mathrm{E}\left[a_1^{e_1}a_2^{e_2}\right]:\sum ie_i=%d\right)\colon" % (2*d+2) for d in range(len(info['simplex']))]
elif data['degree'] == 6:
s = data['simplex']
if len(s) >= 56:
@@ -932,7 +932,7 @@ def render_by_label(label):
info['simplex'] = [s[0:2],s[2:6],s[6:13],s[13:23],s[23:37]]
elif len(s) >= 23:
info['simplex'] = [s[0:2],s[2:6],s[6:13],s[13:23]]
- info['simplex_header'] = [r"\left(\mathrm{E}\left[a_1^{e_1}a_2^{e_2}a_3^{e_3}\right]:\sum ie_i=%d\right)\colon"%(2*d+2) for d in range(len(info['simplex']))]
+ info['simplex_header'] = [r"\left(\mathrm{E}\left[a_1^{e_1}a_2^{e_2}a_3^{e_3}\right]:\sum ie_i=%d\right)\colon" % (2*d+2) for d in range(len(info['simplex']))]
if len(s) >= 56:
info['simplex_header'][-1] = ""
if data.get('character_matrix'):
@@ -973,35 +973,35 @@ def render_by_label(label):
s += "
"
info['probabilities'] = s
elif data.get('counts'):
- c=data['counts']
- T = [['$\\mathrm{Pr}[%s=%s]=%s$'%(c[i][0],c[i][1][j][0],c[i][1][j][1]/n) for j in range(len(c[i][1]))] for i in range(len(c))]
+ c = data['counts']
+ T = [['$\\mathrm{Pr}[%s=%s]=%s$' % (c[i][0],c[i][1][j][0],c[i][1][j][1]/n) for j in range(len(c[i][1]))] for i in range(len(c))]
info['probabilities'] = "" + " ".join(["" + " " for r in T]) + "
"
return render_st_group(info, portrait=data.get('trace_histogram'), in_database=in_database)
def render_st_group(info, portrait=None, in_database=False):
""" render html page for Sato-Tate group described by info """
- prop = [('Label', '%s'%info['label'])]
+ prop = [('Label', '%s' % info['label'])]
if portrait is None:
portrait = st_portrait(info['label'])
if portrait:
prop += [(None, ' ' % portrait)]
prop += [
- ('Name', r'\(%s\)'%info['pretty']),
+ ('Name', r'\(%s\)' % info['pretty']),
('Weight', prop_int_pretty(info['weight'])),
('Degree', prop_int_pretty(info['degree'])),
('Real dimension', prop_int_pretty(info['real_dimension'])),
('Components', prop_int_pretty(info['components'])),
- ('Contained in',r'\(%s\)'%info['ambient']),
- ('Identity component', r'\(%s\)'%info['identity_component']),
- ('Component group', r'\(%s\)'%info['component_group']),
+ ('Contained in',r'\(%s\)' % info['ambient']),
+ ('Identity component', r'\(%s\)' % info['identity_component']),
+ ('Component group', r'\(%s\)' % info['component_group']),
]
downloads = [("Underlying data", url_for(".st_data", label=info['label']))] if in_database else []
bread = get_bread([
- ('Weight %d'% info['weight'], url_for('.index')+'?weight='+str(info['weight'])),
- ('Degree %d'% info['degree'], url_for('.index')+'?weight='+str(info['weight'])+'°ree='+str(info['degree'])),
+ ('Weight %d' % info['weight'], url_for('.index')+'?weight='+str(info['weight'])),
+ ('Degree %d' % info['degree'], url_for('.index')+'?weight='+str(info['weight'])+'°ree='+str(info['degree'])),
(info['name'], '')
])
- title = r'Sato-Tate group \(' + info['pretty'] + r'\) of weight %d'% info['weight'] + ' and degree %d'% info['degree']
+ title = r'Sato-Tate group \(' + info['pretty'] + r'\) of weight %d' % info['weight'] + ' and degree %d' % info['degree']
return render_template('st_display.html',
properties=prop,
downloads=downloads,
@@ -1009,7 +1009,7 @@ def render_st_group(info, portrait=None, in_database=False):
bread=bread,
learnmore=learnmore_list(),
title=title,
- KNOWL_ID='st_group.%s'%(info['label']))
+ KNOWL_ID='st_group.%s' % (info['label']))
@st_page.route("/data/")
def st_data(label):
diff --git a/lmfdb/siegel_modular_forms/siegel_modular_form.py b/lmfdb/siegel_modular_forms/siegel_modular_form.py
index 758d36d5ff..70e2f8b361 100644
--- a/lmfdb/siegel_modular_forms/siegel_modular_form.py
+++ b/lmfdb/siegel_modular_forms/siegel_modular_form.py
@@ -81,15 +81,15 @@ def Sp4Z_j_space(k,j):
bread = [("Modular forms", url_for('modular_forms')),
('Siegel', url_for('.index')),
(r'$M_{k,j}(\mathrm{Sp}(4, \mathbb{Z})$', url_for('.Sp4Z_j')),
- (r'$M_{%s,%s}(\mathrm{Sp}(4, \mathbb{Z}))$'%(k,j), '')]
- if j%2:
+ (r'$M_{%s,%s}(\mathrm{Sp}(4, \mathbb{Z}))$' % (k,j), '')]
+ if j % 2:
# redirect to general page for Sp4Z_j which will display an error message
return redirect(url_for(".Sp4Z_j",k=str(k),j=str(j)))
info = { 'args':{'k':str(k),'j':str(j)} }
try:
if j in [0,2]:
headers, table = dimensions._dimension_Sp4Z([k])
- info['samples'] = find_samples('Sp4Z' if j==0 else 'Sp4Z_2', k)
+ info['samples'] = find_samples('Sp4Z' if j == 0 else 'Sp4Z_2', k)
else:
headers, table = dimensions._dimension_Gamma_2([k], j, group='Sp4(Z)')
info['headers'] = headers
@@ -98,7 +98,7 @@ def Sp4Z_j_space(k,j):
# redirect to general page for Sp4Z_j which will display an error message
return redirect(url_for(".Sp4Z_j",k=str(k),j=str(j)))
return render_template('ModularForm_GSp4_Q_full_level_space.html',
- title=r'$M_{%s, %s}(\mathrm{Sp}(4, \mathbb{Z}))$'%(k, j),
+ title=r'$M_{%s, %s}(\mathrm{Sp}(4, \mathbb{Z}))$' % (k, j),
bread=bread,
info=info)
@@ -126,7 +126,7 @@ def Sp4Z_j():
bread = [("Modular forms", url_for('modular_forms')),
('Siegel', url_for('.index')),
(r'$M_{k,j}(\mathrm{Sp}(4, \mathbb{Z}))$', '')]
- info={'args': request.args}
+ info = {'args': request.args}
try:
dim_args = dimensions.parse_dim_args(request.args, {'k':'10-20','j':'0-30'})
except ValueError:
@@ -163,7 +163,7 @@ def build_dimension_table(info, fam, args):
info['error'] = True
if not info.get('error'):
info['dim_args'] = dim_args
- kwargs={}
+ kwargs = {}
try:
for arg in fam.dimension_desc()['args']:
if (arg == 'wt_range' or arg == 'k_range') and 'k_range' in dim_args:
@@ -253,7 +253,7 @@ def render_sample_page(family, sam, args, bread):
info['space'] = '$'+family.latex_name.replace('k', '{' + str(sam.weight()) + '}')+'$'
if 'space_url' in info:
bread.append((info['space'], info['space_url']))
- info['space_href'] = '%s'%(info['space_url'],info['space']) if 'space_url' in info else info['space']
+ info['space_href'] = ' %s' % (info['space_url'],info['space']) if 'space_url' in info else info['space']
if info['field_poly'].disc() < 10**10:
label = poly_to_field_label(info['field_poly'])
if label:
diff --git a/lmfdb/siegel_modular_forms/smf_test_pages.py b/lmfdb/siegel_modular_forms/smf_test_pages.py
index 6d541d14bf..115cca9dd8 100644
--- a/lmfdb/siegel_modular_forms/smf_test_pages.py
+++ b/lmfdb/siegel_modular_forms/smf_test_pages.py
@@ -28,6 +28,6 @@ def test_all_pages(self):
if not errors:
print("Tested %s pages with no errors" % n)
else:
- print("Tested %d pages with %d errors occurring on the following pages:" %(n,len(errors)))
+ print("Tested %d pages with %d errors occurring on the following pages:" % (n,len(errors)))
for url in errors:
print(url)
diff --git a/lmfdb/tensor_products/galois_reps.py b/lmfdb/tensor_products/galois_reps.py
index 98c85bda23..3ff4413a6a 100644
--- a/lmfdb/tensor_products/galois_reps.py
+++ b/lmfdb/tensor_products/galois_reps.py
@@ -137,7 +137,7 @@ def __init__(self, thingy):
self.init_tensor_product(thingy[0], thingy[1])
else:
- raise ValueError("GaloisRepresentations are currently not implemented for that type (%s) of objects"%type(thingy))
+ raise ValueError("GaloisRepresentations are currently not implemented for that type (%s) of objects" % type(thingy))
# set a few common variables
self.level = self.conductor
@@ -159,7 +159,7 @@ def init_elliptic_curve(self, E):
self.dim = 2
self.motivic_weight = 1
self.conductor = E.conductor()
- self.bad_semistable_primes = [ fa[0] for fa in self.conductor.factor() if fa[1]==1 ]
+ self.bad_semistable_primes = [ fa[0] for fa in self.conductor.factor() if fa[1] == 1 ]
self.bad_pot_good = [p for p in self.conductor.prime_factors() if E.j_invariant().valuation(p) > 0 ]
self.sign = E.root_number()
self.mu_fe = []
@@ -302,7 +302,7 @@ def init_elliptic_modular_form(self, F, number):
self.weight = ZZ(F.weight)
self.motivic_weight = ZZ(F.weight) - 1
self.conductor = ZZ(F.level)
- self.bad_semistable_primes = [fa[0] for fa in self.conductor.factor() if fa[1]==1 ]
+ self.bad_semistable_primes = [fa[0] for fa in self.conductor.factor() if fa[1] == 1 ]
# should be including primes of bad red that are pot good
# however I don't know how to recognise them
self.bad_pot_good = []
@@ -507,7 +507,7 @@ def set_number_of_coefficients(self):
self.set_dokchitser_Lfunction()
# note the following line only sets all the variables in the
# gp session of Dokchitser
- self.ld._gp_eval("MaxImaginaryPart = %s"%self.max_imaginary_part)
+ self.ld._gp_eval("MaxImaginaryPart = %s" % self.max_imaginary_part)
self.numcoeff = self.ld.num_coeffs()
# to be on the safe side, we make sure to have a min of terms
if self.numcoeff < 50:
@@ -632,9 +632,9 @@ def tensor_get_an(L1, L2, d1, d2, BadPrimeInfo):
other as 1-t. If one of L1 and L2 is deg 1, then this calls
a special function, with a different BadPrime methodology.
"""
- if d1==1:
+ if d1 == 1:
return tensor_get_an_deg1(L2,L1,[[bpi[0],tensor_local_factors(bpi[1],bpi[2],d1*d2)] for bpi in BadPrimeInfo])
- if d2==1:
+ if d2 == 1:
return tensor_get_an_deg1(L1,L2,[[bpi[0],tensor_local_factors(bpi[1],bpi[2],d1*d2)] for bpi in BadPrimeInfo])
return tensor_get_an_no_deg1(L1,L2,d1,d2,BadPrimeInfo)
@@ -643,7 +643,7 @@ def tensor_get_an_no_deg1(L1, L2, d1, d2, BadPrimeInfo):
"""
Same as the above in the case no dimension is 1
"""
- if d1==1 or d2==1:
+ if d1 == 1 or d2 == 1:
raise ValueError('min(d1,d2) should not be 1, use direct method then')
s1 = len(L1)
s2 = len(L2)
@@ -662,7 +662,7 @@ def tensor_get_an_no_deg1(L1, L2, d1, d2, BadPrimeInfo):
E2 = []
if p not in BadPrimes:
for i in range(f):
- q=q*p
+ q = q*p
E1.append(L1[q-1])
E2.append(L2[q-1])
e1 = list_to_euler_factor(E1,f+1)
@@ -686,7 +686,7 @@ def tensor_get_an_no_deg1(L1, L2, d1, d2, BadPrimeInfo):
q = 1
for i in range(f):
q = q*p
- Z[q-1]=A[i]
+ Z[q-1] = A[i]
all_an_from_prime_powers(Z)
return Z
@@ -745,7 +745,7 @@ def all_an_from_prime_powers(L):
for _ in range(f):
q = q*p
for m in range(2, 1+(S//q)):
- if (m%p) != 0:
+ if (m % p) != 0:
L[m*q-1] = L[m*q-1] * L[q-1]
@@ -815,7 +815,7 @@ def tensor_local_factors(f1, f2, d):
raise ValueError
f1 = R(f1)
f2 = R(f2)
- if f1==1 or f2==1:
+ if f1 == 1 or f2 == 1:
f = R(1)
f = f.add_bigoh(d+1)
return f
@@ -840,7 +840,7 @@ def tensor_local_factors(f1, f2, d):
## test functions to check if the above agrees with magma
def test_tensprod_121_chi():
- C121=[1,2,-1,2,1,-2,2,0,-2,2,0,-2,-4,4,-1,-4,2,-4,0,2,-2,0,
+ C121 = [1,2,-1,2,1,-2,2,0,-2,2,0,-2,-4,4,-1,-4,2,-4,0,2,-2,0,
-1,0,-4,-8,5,4,0,-2,7,-8,0,4,2,-4,3,0,4,0,8,-4,6,0,-2,-2,
8,4,-3,-8,-2,-8,-6,10,0,0,0,0,5,-2,-12,14,-4,-8,-4,0,-7,4,
1,4,-3,0,-4,6,4,0,0,8,10,-4,1,16,6,-4,2,12,0,0,15,-4,-8,
@@ -849,7 +849,7 @@ def test_tensprod_121_chi():
-14,5,0,-7,2,-10,4,-8,-6,0,8,0,-8,3,6,10,8,-2,0,-4,0,7,8,
-7,20,6,-8,-2,2,4,16,0,12,12,0,3,4,0,12,6,0,-8,0,-5,30,
-15,-4,7,-16,12,0,3,-14,0,16,10,0,17,8,-4,-14,4,-6,2,0,0,0]
- chi=[1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,
+ chi = [1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,
1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,
-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,
1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,
@@ -858,7 +858,7 @@ def test_tensprod_121_chi():
-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,
-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1,1,1,1,-1,-1,
-1,1,-1,0,1,-1,1,1,1,-1,-1,-1,1,-1,0,1,-1]
- ANS=[1,-2,-1,2,1,2,-2,0,-2,-2,1,-2,4,4,-1,-4,-2,4,0,2,2,-2,
+ ANS = [1,-2,-1,2,1,2,-2,0,-2,-2,1,-2,4,4,-1,-4,-2,4,0,2,2,-2,
-1,0,-4,-8,5,-4,0,2,7,8,-1,4,-2,-4,3,0,-4,0,-8,-4,-6,2,-2,
2,8,4,-3,8,2,8,-6,-10,1,0,0,0,5,-2,12,-14,4,-8,4,2,-7,-4,
1,4,-3,0,4,-6,4,0,-2,8,-10,-4,1,16,-6,4,-2,12,0,0,15,4,-8,
@@ -869,14 +869,14 @@ def test_tensprod_121_chi():
-15,-4,7,16,-12,0,3,14,-2,16,-10,0,17,8,4,14,-4,-6,-2,4,0,0]
R = PowerSeriesRing(ZZ, "T")
T = R.gens()[0]
- assert ANS==tensor_get_an_deg1(C121,chi,[[11,1-T]])
- assert ANS==tensor_get_an(C121,chi,2,1,[[11,1-T,1-T]])
- assert get_euler_factor(ANS,2)==(1+2*T+2*T**2+O(T**8))
- assert get_euler_factor(ANS,3)==(1+T+3*T**2+O(T**5))
- assert get_euler_factor(ANS,5)==(1-T+5*T**2+O(T**4))
+ assert ANS == tensor_get_an_deg1(C121,chi,[[11,1-T]])
+ assert ANS == tensor_get_an(C121,chi,2,1,[[11,1-T,1-T]])
+ assert get_euler_factor(ANS,2) == (1+2*T+2*T**2+O(T**8))
+ assert get_euler_factor(ANS,3) == (1+T+3*T**2+O(T**5))
+ assert get_euler_factor(ANS,5) == (1-T+5*T**2+O(T**4))
def test_tensprod_11a_17a():
- C11=[1,-2,-1,2,1,2,-2,0,-2,-2,1,-2,4,4,-1,-4,-2,4,0,2,2,-2,
+ C11 = [1,-2,-1,2,1,2,-2,0,-2,-2,1,-2,4,4,-1,-4,-2,4,0,2,2,-2,
-1,0,-4,-8,5,-4,0,2,7,8,-1,4,-2,-4,3,0,-4,0,-8,-4,-6,2,-2,
2,8,4,-3,8,2,8,-6,-10,1,0,0,0,5,-2,12,-14,4,-8,4,2,-7,-4,
1,4,-3,0,4,-6,4,0,-2,8,-10,-4,1,16,-6,4,-2,12,0,0,15,4,-8,
@@ -885,7 +885,7 @@ def test_tensprod_11a_17a():
5,0,-7,-2,10,-4,-8,6,4,8,0,-8,3,6,-10,-8,2,0,4,4,7,-8,-7,
20,6,8,2,-2,4,-16,-1,12,-12,0,3,4,0,-12,-6,0,8,-4,-5,-30,
-15,-4,7,16,-12,0,3,14,-2,16,-10,0,17,8,4,14,-4,-6,-2,4,0,0]
- C17=[1,-1,0,-1,-2,0,4,3,-3,2,0,0,-2,-4,0,-1,1,3,-4,2,0,0,4,
+ C17 = [1,-1,0,-1,-2,0,4,3,-3,2,0,0,-2,-4,0,-1,1,3,-4,2,0,0,4,
0,-1,2,0,-4,6,0,4,-5,0,-1,-8,3,-2,4,0,-6,-6,0,4,0,6,-4,0,
0,9,1,0,2,6,0,0,12,0,-6,-12,0,-10,-4,-12,7,4,0,4,-1,0,8,
-4,-9,-6,2,0,4,0,0,12,2,9,6,-4,0,-2,-4,0,0,10,-6,-8,-4,0,
@@ -894,7 +894,7 @@ def test_tensprod_11a_17a():
-8,8,0,4,0,3,-12,6,0,2,-10,0,-16,-12,-3,0,-8,0,-2,-12,0,10,
16,-9,24,6,0,4,-4,0,-9,2,12,-4,22,0,-4,0,0,-10,12,-6,-2,8,
0,12,4,0,0,0,0,-8,-16,0,2,-2,0,-9,-18,0,-20,-3]
- ANS=[1,2,0,2,-2,0,-8,8,15,-4,0,0,-8,-16,0,12,-2,30,0,-4,0,0,
+ ANS = [1,2,0,2,-2,0,-8,8,15,-4,0,0,-8,-16,0,12,-2,30,0,-4,0,0,
-4,0,29,-16,0,-16,0,0,28,-8,0,-4,16,30,-6,0,0,-16,48,0,-24,
0,-30,-8,0,0,22,58,0,-16,-36,0,0,-64,0,0,-60,0,-120,56,-120,
-8,16,0,-28,-4,0,32,12,120,-24,-12,0,0,0,0,-120,-24,144,96,
@@ -906,9 +906,9 @@ def test_tensprod_11a_17a():
-14,128,0,-32,12,0,0,0,0,0,-272,0,8,-28,0,44,36,0,0,232]
R = PowerSeriesRing(ZZ, "T")
T = R.gens()[0]
- B11=[11,1-T,1+11*T**2]
- B17=[17,1+2*T+17*T**2,1-T]
- assert ANS==tensor_get_an_no_deg1(C11,C17,2,2,[B11,B17])
+ B11 = [11,1-T,1+11*T**2]
+ B17 = [17,1+2*T+17*T**2,1-T]
+ assert ANS == tensor_get_an_no_deg1(C11,C17,2,2,[B11,B17])
### comparison with previous implementation.
diff --git a/lmfdb/tensor_products/main.py b/lmfdb/tensor_products/main.py
index 8f67d62162..5c3f849c10 100644
--- a/lmfdb/tensor_products/main.py
+++ b/lmfdb/tensor_products/main.py
@@ -51,7 +51,7 @@ def show():
for p in objPaths:
galoisRepObjs.append(galois_rep_from_path(p))
- if len(galoisRepObjs)==1:
+ if len(galoisRepObjs) == 1:
gr = galoisRepObjs[0]
gr.lfunction()
@@ -65,7 +65,7 @@ def show():
return render_template('Lfunction.html', **info)
# currently only implemented tp of two things
- if len(galoisRepObjs)==2:
+ if len(galoisRepObjs) == 2:
try:
tp = GaloisRepresentation([galoisRepObjs[0], galoisRepObjs[1]])
@@ -83,7 +83,7 @@ def show():
info['properties'] = properties
if (tp.numcoeff > len(tp.dirichlet_coefficients)+10):
- info['zeroswarning'] = 'These zeros may be inaccurate because we use only %s terms rather than the theoretically required %s terms' %(len(tp.dirichlet_coefficients), tp.numcoeff)
+ info['zeroswarning'] = 'These zeros may be inaccurate because we use only %s terms rather than the theoretically required %s terms' % (len(tp.dirichlet_coefficients), tp.numcoeff)
info['svwarning'] = 'These special values may also be inaccurate, for the same reason.'
else:
info['zeroswarning'] = ''
@@ -132,18 +132,18 @@ def zeros(L):
negativeZeros[1:len(negativeZeros) - 1], positiveZeros[1:len(positiveZeros) - 1])
def galois_rep_from_path(p):
- if p[0]=='EllipticCurve':
+ if p[0] == 'EllipticCurve':
# create the sage elliptic curve then create Galois rep object
ainvs = db.ec_curvedata.lucky({'lmfdb_label':p[2]+"."+p[3]+p[4]}, 'ainvs')
E = EllipticCurve(ainvs)
return GaloisRepresentation(E)
- elif (p[0]=='Character' and p[1]=='Dirichlet'):
+ elif (p[0] == 'Character' and p[1] == 'Dirichlet'):
dirichletArgs = {'type':'Dirichlet', 'modulus':int(p[2]), 'number':int(p[3])}
chi = WebSmallDirichletCharacter(**dirichletArgs)
return GaloisRepresentation(chi)
- elif (p[0]=='ModularForm'):
+ elif (p[0] == 'ModularForm'):
level = int(p[4])
weight = int(p[5])
conrey_label = p[6] # this should be zero; TODO check this is the case
@@ -153,7 +153,7 @@ def galois_rep_from_path(p):
form = WebNewform(label)
return GaloisRepresentation([form, ZZ(embedding)])
- elif (p[0]=='ArtinRepresentation'):
+ elif (p[0] == 'ArtinRepresentation'):
dim = p[1]
conductor = p[2]
index = p[3]
diff --git a/lmfdb/users/main.py b/lmfdb/users/main.py
index 52df5b49c2..079c0c6830 100644
--- a/lmfdb/users/main.py
+++ b/lmfdb/users/main.py
@@ -97,8 +97,8 @@ def list():
users = userdb.get_user_list()
# attempt to sort by last name
users = sorted(users, key=lambda x: x[1].strip().split(" ")[-1].lower())
- if len(users)%COLS:
- users += [{} for i in range(COLS-len(users)%COLS)]
+ if len(users) % COLS:
+ users += [{} for i in range(COLS-len(users) % COLS)]
n = len(users)//COLS
user_rows = tuple(zip(*[users[i*n: (i + 1)*n] for i in range(COLS)]))
bread = base_bread()
diff --git a/lmfdb/utils/color.py b/lmfdb/utils/color.py
index dac4e275fe..07810f6a25 100644
--- a/lmfdb/utils/color.py
+++ b/lmfdb/utils/color.py
@@ -265,8 +265,8 @@ def get(key):
elif default in self.colors:
return get(default)
else:
- raise ValueError("Unrecognized color %s"%default)
- raise ValueError("No value for %s specified"%key)
+ raise ValueError("Unrecognized color %s" % default)
+ raise ValueError("No value for %s specified" % key)
scheme = {}
for std_color in c:
val = getattr(self, std_color, None)
diff --git a/lmfdb/utils/display_stats.py b/lmfdb/utils/display_stats.py
index 9a49aaf4e7..f557b8c64d 100644
--- a/lmfdb/utils/display_stats.py
+++ b/lmfdb/utils/display_stats.py
@@ -570,7 +570,7 @@ def display_data(self, cols, table=None, constraint=None, avg=None,
if avg is False: # Want to show avg even if 0
total['value'] = 'Total'
else:
- total['value'] = r'\(\mathrm{avg}\ %.2f\)'%avg
+ total['value'] = r'\(\mathrm{avg}\ %.2f\)' % avg
counts.append(total)
return {'counts': counts}
elif len(cols) == 2:
@@ -737,7 +737,7 @@ def dynamic_setup(self, info):
raise
info["d"] = self.prep(attr)
info["stats"] = self
- info["get_bucket"] = (lambda i: info.get("buckets%s"%i, ""))
- info["get_col"] = (lambda i: info.get("col%s"%i, "none"))
- info["get_total"] = (lambda i: info.get("totals%s"%i, False))
+ info["get_bucket"] = (lambda i: info.get("buckets%s" % i, ""))
+ info["get_col"] = (lambda i: info.get("col%s" % i, "none"))
+ info["get_total"] = (lambda i: info.get("totals%s" % i, False))
info["search_type"] = "DynStats"
diff --git a/lmfdb/utils/downloader.py b/lmfdb/utils/downloader.py
index f2d2766843..7f4481192b 100644
--- a/lmfdb/utils/downloader.py
+++ b/lmfdb/utils/downloader.py
@@ -766,7 +766,7 @@ def make_download():
num_res_disp = pluralize(num_results, self.short_name)
else:
num_res_disp = pluralize(limit, self.short_name, denom=num_results, offset=offset)
- yield lang.comment(' Query "%s" %s %s%s.\n\n' %(
+ yield lang.comment(' Query "%s" %s %s%s.\n\n' % (
str(info.get('query')),
"returned" if limit is None else "was limited to",
num_res_disp,
diff --git a/lmfdb/utils/search_boxes.py b/lmfdb/utils/search_boxes.py
index 5e4c4583de..031cb19c8d 100644
--- a/lmfdb/utils/search_boxes.py
+++ b/lmfdb/utils/search_boxes.py
@@ -520,7 +520,7 @@ def _input(self, info):
'''oninput="control_columns(this);"''',
'''id="column-selector"''',
]
- style="position: absolute; z-index: 9999;"
+ style = "position: absolute; z-index: 9999;"
if self.short_width is not None:
style += f'width: {self.short_width}px;'
keys.append(f'style="{style}"')
@@ -755,7 +755,7 @@ def dynstats_array(self, info):
label="",
width=150,
options=info["stats"]._dynamic_cols,
- extra=['onchange="set_buckets(this, \'buckets%s\')"'%i])
+ extra=['onchange="set_buckets(this, \'buckets%s\')"' % i])
buckets = TextBox(
name="buckets%s" % i,
id="buckets%s" % i,
diff --git a/lmfdb/utils/search_parsing.py b/lmfdb/utils/search_parsing.py
index b7f42e01c1..4fd71b5674 100644
--- a/lmfdb/utils/search_parsing.py
+++ b/lmfdb/utils/search_parsing.py
@@ -1049,7 +1049,7 @@ def parse_group_label_or_order(inp, query, qfield, regex):
raise SearchParsingError("Group label(s) do not match the required form")
if inporders:
if inplabels:
- query[qfield] = {"$or": inporders +[labelquery]}
+ query[qfield] = {"$or": inporders + [labelquery]}
else:
query[qfield] = {"$or": inporders}
else:
diff --git a/lmfdb/utils/trace_hash.py b/lmfdb/utils/trace_hash.py
index ad3dea76a1..6388014988 100644
--- a/lmfdb/utils/trace_hash.py
+++ b/lmfdb/utils/trace_hash.py
@@ -118,7 +118,7 @@ def TraceHash(E):
return TraceHash_from_ap([E_pari.ellap(p) for p in TH_P])
if K not in TH_P_cache:
- TH_P_cache[K] = {p: [P for P in K.primes_above(p) if P.norm()==p] for p in TH_P}
+ TH_P_cache[K] = {p: [P for P in K.primes_above(p) if P.norm() == p] for p in TH_P}
def ap(p):
return sum([E.reduction(P).trace_of_frobenius() for P in TH_P_cache[K][p]], 0)
diff --git a/lmfdb/utils/utilities.py b/lmfdb/utils/utilities.py
index cfbf7fabfa..421512789c 100644
--- a/lmfdb/utils/utilities.py
+++ b/lmfdb/utils/utilities.py
@@ -60,7 +60,7 @@ def integer_prime_divisors(n):
def integer_squarefree_part(n):
""" returns the squarefree part of the integer n (uses factor rather than calling pari like sage 9.3+ does) """
- return sign(n)*prod([p**(e%2) for p, e in ZZ(n).factor()])
+ return sign(n)*prod([p**(e % 2) for p, e in ZZ(n).factor()])
def integer_is_squarefree(n):
@@ -289,7 +289,7 @@ def display_multiset(mset, formatter=str, *args):
>>> display_multiset([["a", 5], [1, 3], ["cat", 2]])
'a x5, 1 x3, cat x2'
"""
- return ', '.join([formatter(pair[0], *args)+(' x%d'% pair[1] if pair[1]>1 else '') for pair in mset])
+ return ', '.join([formatter(pair[0], *args)+(' x%d' % pair[1] if pair[1] > 1 else '') for pair in mset])
def pair2complex(pair):
@@ -372,7 +372,7 @@ def str_to_CBF(s):
if a:
res += CBF(a)
if b:
- res += sign * CBF(b)* CBF.gens()[0]
+ res += sign * CBF(b) * CBF.gens()[0]
return res
# Conversion from numbers to letters and back
@@ -393,7 +393,7 @@ def num2letters(n):
if n <= 26:
return chr(96+n)
else:
- return num2letters(int((n-1)/26))+chr(97+(n-1)%26)
+ return num2letters(int((n-1)/26))+chr(97+(n-1) % 26)
def to_dict(args, exclude=[], **kwds):
@@ -594,7 +594,7 @@ def latex_comma(x):
def format_percentage(num, denom):
if denom == 0:
return 'NaN'
- return "%10.2f"%((100.0*num)/denom)
+ return "%10.2f" % ((100.0*num)/denom)
def signtocolour(sign):
diff --git a/lmfdb/utils/web_display.py b/lmfdb/utils/web_display.py
index 9fe4305aa2..3bc9977a56 100644
--- a/lmfdb/utils/web_display.py
+++ b/lmfdb/utils/web_display.py
@@ -133,7 +133,7 @@ def bigint_knowl(n, cutoff=20, max_width=70, sides=2):
short, shortened = compress_int(n, cutoff=cutoff, sides=sides)
if shortened:
lng = r"%s
" % n
- return r' \(%s\) '%(lng, short)
+ return r'\(%s\) ' % (lng, short)
else:
return r'\(%s\)' % n
@@ -190,7 +190,7 @@ def bigpoly_knowl(f, nterms_cutoff=8, bigint_cutoff=12, var='x'):
else:
short += r" - \cdots"
# return r'\(%s\) '%(lng, short)
- return r'\(%s\) '%(lng,short)
+ return r'\(%s\) ' % (lng,short)
else:
return lng
@@ -231,7 +231,7 @@ def pos_int_and_factor(n, factor_base=None):
n = ZZ(n)
if factor_base:
factors = [(p, ZZ(n).valuation(p)) for p in factor_base]
- factors = [(z[0],z[1]) for z in factors if z[1]>0]
+ factors = [(z[0],z[1]) for z in factors if z[1] > 0]
def power_prime(p, exponent):
if exponent == 1:
@@ -241,7 +241,7 @@ def power_prime(p, exponent):
latexfactors = r" \cdot ".join(power_prime(p, val) for (p, val) in factors)
else:
factors = n.factor()
- latexfactors=latex(factors)
+ latexfactors = latex(factors)
if len(factors) == 1 and factors[0][1] == 1:
return bigint_knowl(n, sides=3)
else:
@@ -258,14 +258,14 @@ def polyquo_knowl(f, disc=None, unit=1, cutoff=None):
quo += r" + \cdots"
else:
quo += r" - \cdots"
- short = r'\mathbb{Q}[x]/(%s)'%(quo)
+ short = r'\mathbb{Q}[x]/(%s)' % (quo)
long = r'Defining polynomial: %s' % escape(raw_typeset_poly(f))
if disc is not None:
if isinstance(disc, list):
long += '\n \nDiscriminant: \\(%s\\)' % (factor_base_factorization_latex(disc))
else:
long += '\n \nDiscriminant: \\(%s\\)' % (Factorization(disc, unit=unit)._latex_())
- return r'\(%s\) '%(long, short)
+ return r'\(%s\) ' % (long, short)
def web_latex_factored_integer(x, enclose=True, equals=False):
@@ -683,9 +683,9 @@ def compress_poly_Q(rawpoly,
d = len(coefflist)
def frac_string(frac):
- if frac.denominator()==1:
+ if frac.denominator() == 1:
return compress_int(frac.numerator())[0]
- return r'\frac{%s}{%s}'%(compress_int(frac.numerator())[0], compress_int(frac.denominator())[0])
+ return r'\frac{%s}{%s}' % (compress_int(frac.numerator())[0], compress_int(frac.denominator())[0])
tset = ''
for j in range(1, d + 1):
diff --git a/lmfdb/verify/gps/gps_gl2zhat_fine.py b/lmfdb/verify/gps/gps_gl2zhat_fine.py
index 6361a703d6..eca683276d 100644
--- a/lmfdb/verify/gps/gps_gl2zhat_fine.py
+++ b/lmfdb/verify/gps/gps_gl2zhat_fine.py
@@ -11,7 +11,7 @@ def bkm_const(p,d):
return 8 + 2 * valuation(d,p)
elif p == 3:
return 5 + 2 * valuation(d,p)
- elif (p >= 5) and ((2*d)%(p-1) == 0):
+ elif (p >= 5) and ((2*d) % (p-1) == 0):
return 4 + 2 * valuation(d,p)
else:
return 2
diff --git a/lmfdb/verify/mf/mf_hecke_nf.py b/lmfdb/verify/mf/mf_hecke_nf.py
index 2e56004d17..f530910e74 100644
--- a/lmfdb/verify/mf/mf_hecke_nf.py
+++ b/lmfdb/verify/mf/mf_hecke_nf.py
@@ -126,13 +126,13 @@ def check_val(val):
if verbose:
for n, a in enumerate(an, 1):
if not check_val(a):
- print("Check an failure (m=%s, d=%s)"%(m, d), n, a)
+ print("Check an failure (m=%s, d=%s)" % (m, d), n, a)
return False
if not all(check_val(a) for a in ap):
if verbose:
for p, a in zip(prime_range(maxp), ap):
if not check_val(a):
- print("Check ap failure (m=%s, d=%s)"%(m, d), p, a)
+ print("Check ap failure (m=%s, d=%s)" % (m, d), p, a)
return False
for p, a in zip(prime_range(100), ap):
if a != an[p-1]:
@@ -150,7 +150,7 @@ def check_val(val):
total_order *= mod(g, N).multiplicative_order()
if not check_val(val):
if verbose:
- print("Bad character val (m=%s, d=%s)"%(m, d), g, val)
+ print("Bad character val (m=%s, d=%s)" % (m, d), g, val)
return False
success = (total_order == euler_phi(N))
if not success and verbose:
diff --git a/lmfdb/verify/mf/mf_newforms.py b/lmfdb/verify/mf/mf_newforms.py
index 32689dd882..c2c2179f0f 100644
--- a/lmfdb/verify/mf/mf_newforms.py
+++ b/lmfdb/verify/mf/mf_newforms.py
@@ -72,7 +72,7 @@ def check_newspaces_overlap(self):
bad_labels.extend([label + " (count)" for label in labels])
for col in ['Nk2', 'analytic_conductor', 'char_conductor', 'char_degree', 'char_is_real', 'char_orbit_index', 'char_orbit_label', 'char_order', 'char_parity', 'char_values', 'conrey_index', 'level', 'level_is_prime', 'level_is_prime_power', 'level_is_square', 'level_is_squarefree', 'level_primes', 'level_radical', 'prim_orbit_index', 'weight', 'weight_parity']:
labels = self.check_crosstable('mf_newspaces', col, 'space_label', col, 'label')
- bad_labels.extend([label + " (%s)"%col for label in labels])
+ bad_labels.extend([label + " (%s)" % col for label in labels])
return bad_labels
@overall
diff --git a/lmfdb/verify/verification.py b/lmfdb/verify/verification.py
index 2add91887d..cc0c4bf36b 100644
--- a/lmfdb/verify/verification.py
+++ b/lmfdb/verify/verification.py
@@ -127,7 +127,7 @@ def speedtype(typ):
elif isinstance(typ, type) and issubclass(typ, speed_decorator):
return typ
else:
- raise ValueError("Unrecognized speed type %s"%typ)
+ raise ValueError("Unrecognized speed type %s" % typ)
@staticmethod
def all_types():
@@ -187,7 +187,7 @@ def _report_error(self, msg, log, prog, err):
def _run_check(self, check, typ, label, file_handles, ratio=None):
start = time.time()
prog, log, err = file_handles
- name = "%s.%s"%(self.__class__.__name__, check.__name__)
+ name = "%s.%s" % (self.__class__.__name__, check.__name__)
if label is not None:
name += "[%s]" % label
self._cur_label = label
@@ -210,18 +210,18 @@ def _run_check(self, check, typ, label, file_handles, ratio=None):
else:
for rec_no, rec in enumerate(search_iter, 1):
if rec_no % progress_interval == 0:
- prog.write('%d/%d in %.2fs\n'%(rec_no, total, time.time() - start))
+ prog.write('%d/%d in %.2fs\n' % (rec_no, total, time.time() - start))
prog.flush()
row_start = time.time()
check_success = check(rec)
row_time = time.time() - row_start
if not check_success:
- log.write('%s: %s failed test\n'%(name, rec[self.label_col]))
+ log.write('%s: %s failed test\n' % (name, rec[self.label_col]))
check_failures += 1
if check_failures >= check.max_failures:
raise TooManyFailures
if row_time >= check.report_slow:
- log.write('%s: %s (%d/%d) ok but took %.2fs\n'%(name, rec[self.label_col], rec_no, total, row_time))
+ log.write('%s: %s (%d/%d) ok but took %.2fs\n' % (name, rec[self.label_col], rec_no, total, row_time))
check_slow += 1
if check_slow >= check.max_slow:
raise TimeoutError
@@ -233,28 +233,28 @@ def _run_check(self, check, typ, label, file_handles, ratio=None):
bad_labels = check()
if bad_labels:
for label in bad_labels:
- log.write('%s: %s failed test\n'%(name, label))
+ log.write('%s: %s failed test\n' % (name, label))
check_failures = len(bad_labels)
except TimeoutError:
check_timeouts += 1
- msg = '%s timed out after %.2fs\n'%(name, time.time() - start)
+ msg = '%s timed out after %.2fs\n' % (name, time.time() - start)
log.write(msg)
if log != prog:
prog.write(msg)
except TooManyFailures:
check_aborts += 1
- msg = '%s aborted after %.2fs (too many failures)\n'%(name, time.time() - start)
+ msg = '%s aborted after %.2fs (too many failures)\n' % (name, time.time() - start)
log.write(msg)
if log != prog:
prog.write(msg)
except Exception:
if issubclass(typ, per_row):
- msg = 'Exception in %s (%s):\n'%(name, rec.get(self.label_col, ''))
+ msg = 'Exception in %s (%s):\n' % (name, rec.get(self.label_col, ''))
else:
- msg = 'Exception in %s\n'%(name)
+ msg = 'Exception in %s\n' % (name)
check_errors = self._report_error(msg, log, prog, err)
else:
- prog.write('%s finished after %.2fs\n'%(name, time.time() - start))
+ prog.write('%s finished after %.2fs\n' % (name, time.time() - start))
finally:
log.flush()
prog.flush()
@@ -283,18 +283,18 @@ def run(self, typ, logdir, label=None):
status = vector(ZZ, 4) # excludes disabled
disabled = 0
with open(startfile, 'w') as startf:
- startf.write("%s.%s started (pid %s)\n"%(self.__class__.__name__, typ.__name__, os.getpid()))
+ startf.write("%s.%s started (pid %s)\n" % (self.__class__.__name__, typ.__name__, os.getpid()))
with open(logfile, 'a') as log:
with open(progfile, 'a') as prog:
with open(errfile, 'a') as err:
start = time.time()
for check_num, check in enumerate(checks, 1):
- name = "%s.%s"%(self.__class__.__name__, check.__name__)
+ name = "%s.%s" % (self.__class__.__name__, check.__name__)
if check.disabled:
- prog.write('%s (check %s/%s) disabled\n'%(name, check_num, len(checks)))
+ prog.write('%s (check %s/%s) disabled\n' % (name, check_num, len(checks)))
disabled += 1
continue
- prog.write('%s (check %s/%s) started at %s\n'%(name, check_num, len(checks), datetime.now()))
+ prog.write('%s (check %s/%s) started at %s\n' % (name, check_num, len(checks), datetime.now()))
prog.flush()
status += self._run_check(check, typ, label, (prog, log, err))
with open(donefile, 'a') as done:
@@ -303,9 +303,9 @@ def run(self, typ, logdir, label=None):
if scount:
reports.append(pluralize(scount, sname))
if disabled:
- reports.append("%s disabled"%disabled)
+ reports.append("%s disabled" % disabled)
status = "FAILED with " + ", ".join(reports) if reports else "PASSED"
- done.write("%s.%s %s in %.2fs\n"%(self.__class__.__name__, typ.__name__, status, time.time() - start))
+ done.write("%s.%s %s in %.2fs\n" % (self.__class__.__name__, typ.__name__, status, time.time() - start))
os.remove(startfile)
#####################
@@ -452,8 +452,8 @@ def _check_arith(self, a_columns, b_columns, constraint, op):
if isinstance(b_columns, str):
b_columns = [b_columns]
return self._run_query(SQL(" != ").join([
- SQL(" %s "%op).join(map(Identifier, a_columns)),
- SQL(" %s "%op).join(map(Identifier, b_columns))]), constraint)
+ SQL(" %s " % op).join(map(Identifier, a_columns)),
+ SQL(" %s " % op).join(map(Identifier, b_columns))]), constraint)
def check_sum(self, a_columns, b_columns, constraint={}):
return self._check_arith(a_columns, b_columns, constraint, '+')
@@ -589,7 +589,7 @@ def check_string_concatenation(self,
#intertwine the separator
if isinstance(sep, str):
sep = [sep] * (len(oc_converted) - 1)
- oc = [oc_converted[i//2] if i%2 == 0 else Literal(sep[i//2]) for i in range(2*len(oc_converted)-1)]
+ oc = [oc_converted[i//2] if i % 2 == 0 else Literal(sep[i//2]) for i in range(2*len(oc_converted)-1)]
return self._run_query(SQL(" != ").join([SQL(" || ").join(oc), Identifier(label_col)]), constraint)
@@ -656,7 +656,7 @@ def check_crosstable_aggregate(self, other_table, col1, join1, col2=None, join2=
if col2 is None:
col2 = col1
if truncate is not None:
- col1 = SQL("t1.{0}[:%s]"%(int(truncate))).format(Identifier(col1))
+ col1 = SQL("t1.{0}[:%s]" % (int(truncate))).format(Identifier(col1))
if sort is None:
sort = SQL(" ORDER BY t2.{0}").format(Identifier(col2))
else: