Skip to content

Commit

Permalink
Merge pull request #6302 from fchapoton/fix_E211_warnings
Browse files Browse the repository at this point in the history
add check for E211 (fixed here)
  • Loading branch information
roed314 authored Dec 13, 2024
2 parents 43460d3 + d3c57bd commit c0a39e0
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 37 deletions.
6 changes: 3 additions & 3 deletions lmfdb/abvar/fq/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,15 +616,15 @@ def jump(info):
if deg % 2 == 1:
raise ValueError
except Exception:
flash_error ("%s is not valid input. Expected a label or Weil polynomial.", jump_box)
flash_error("%s is not valid input. Expected a label or Weil polynomial.", jump_box)
return redirect(url_for(".abelian_varieties"))
g = deg//2
lead = cdict[deg]
if lead == 1: # accept monic normalization
lead = cdict[0]
cdict = {deg-exp: coeff for (exp, coeff) in cdict.items()}
if cdict.get(0) != 1:
flash_error ("%s is not valid input. Polynomial must have constant or leading coefficient 1", jump_box)
flash_error("%s is not valid input. Polynomial must have constant or leading coefficient 1", jump_box)
return redirect(url_for(".abelian_varieties"))
try:
q = lead.nth_root(g)
Expand All @@ -634,7 +634,7 @@ def jump(info):
if cdict.get(2*g-i, 0) != q**(g-i) * cdict.get(i, 0):
raise ValueError
except ValueError:
flash_error ("%s is not valid input. Expected a label or Weil polynomial.", jump_box)
flash_error("%s is not valid input. Expected a label or Weil polynomial.", jump_box)
return redirect(url_for(".abelian_varieties"))

def extended_code(c):
Expand Down
8 changes: 4 additions & 4 deletions lmfdb/characters/web_character.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,13 @@ def jacobi_sum(self, val):
try:
val = int(val)
except ValueError:
raise Warning ("n must be a positive integer coprime to the modulus {} and no greater than it".format(mod))
raise Warning("n must be a positive integer coprime to the modulus {} and no greater than it".format(mod))
if gcd(mod, val) > 1:
raise Warning ("n must be coprime to the modulus : %s" % mod)
raise Warning("n must be coprime to the modulus : %s" % mod)
if val > mod:
raise Warning ("n must be less than the modulus : %s" % mod)
raise Warning("n must be less than the modulus : %s" % mod)
if val < 0:
raise Warning ("n must be positive")
raise Warning("n must be positive")

chi_valuepairs = [[k, chi.conreyangle(k) * chi.order] for k in self.gens]
chi_genvalues = [int(v) for g, v in chi_valuepairs]
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/classical_modular_forms/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def url_for_label(label):
return abort(404, "Invalid label")
keys = ['level', 'weight', 'char_orbit_label', 'hecke_orbit', 'conrey_index', 'embedding']
keytypes = [POSINT_RE, POSINT_RE, ALPHA_RE, ALPHA_RE, POSINT_RE, POSINT_RE]
for i in range (len(slabel)):
for i in range(len(slabel)):
if not keytypes[i].match(slabel[i]):
raise ValueError("Invalid label")
kwds = {keys[i]: val for i, val in enumerate(slabel)}
Expand Down
6 changes: 3 additions & 3 deletions lmfdb/ecnf/WebEllipticCurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_nf_info(lab):
r""" extract number field label from string and pretty"""
try:
label = nf_string_to_label(lab)
pretty = field_pretty (label)
pretty = field_pretty(label)
except ValueError as err:
raise ValueError(Markup("<span style='color:black'>%s</span> is not a valid number field label. %s" % (escape(lab),err)))
return label, pretty
Expand Down Expand Up @@ -652,7 +652,7 @@ def make_E(self):
BSDsha_denominator = BSDReg * BSDomega * BSDprodcp
BSDsha_from_formula = BSDLvalue * BSDsha_numerator / BSDsha_denominator
BSDsha_from_formula_rounded = BSDsha_from_formula.round()
BSDok = (BSDsha_from_formula_rounded == BSDsha) and ((BSDsha_from_formula_rounded -BSDsha_from_formula).abs() < 0.001)
BSDok = (BSDsha_from_formula_rounded == BSDsha) and ((BSDsha_from_formula_rounded - BSDsha_from_formula).abs() < 0.001)
#print(f"{BSDsha_from_formula=}")
#print(f"{BSDsha_from_formula_rounded=}")
#print(f"{BSDsha=}")
Expand Down Expand Up @@ -686,7 +686,7 @@ def make_E(self):
tors2 = '\\#E(K)_{\\mathrm{tor}}^2'
rootD = '\\left|d_K\\right|^{1/2}'

lder_name = rf"L^{{({r})}}(E/K,1)/{r}!" if r>=2 else "L'(E/K,1)" if r else "L(E/K,1)"
lder_name = rf"L^{{({r})}}(E/K,1)/{r}!" if r >= 2 else "L'(E/K,1)" if r else "L(E/K,1)"
lhs_num = rf'{Sha} {dot} {Om} {dot} {Reg} {dot} {prodcp}'
lhs_den = rf'{tors2} {dot} {rootD}'
lhs = rf'{frac}{{ {lhs_num} }} {{ {lhs_den} }}'
Expand Down
6 changes: 3 additions & 3 deletions lmfdb/ecnf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def show_ecnf1(nf):
if len(request.args) > 0:
# if requested field differs from nf, redirect to general search
if 'field' in request.args and request.args['field'] != nf_label:
return redirect (url_for(".index", **request.args), 307)
return redirect(url_for(".index", **request.args), 307)
info['title'] += ' Search results'
info['bread'].append(('Search results',''))
info['field'] = nf_label
Expand All @@ -223,7 +223,7 @@ def show_ecnf_conductor(nf, conductor_label):
# if requested field or conductor norm differs from nf or conductor_lable, redirect to general search
if ('field' in request.args and request.args['field'] != nf_label) or \
('conductor_norm' in request.args and request.args['conductor_norm'] != conductor_norm):
return redirect (url_for(".index", **request.args), 307)
return redirect(url_for(".index", **request.args), 307)
info['title'] += ' Search results'
info['bread'].append(('Search results',''))
info['field'] = nf_label
Expand Down Expand Up @@ -386,7 +386,7 @@ def parse_cm_list(inp, query, qfield):
short_title="nonmaximal primes", default=lambda info: info.get("nonmax_primes"), mathmode=True, align="center"),
ProcessedCol("galois_images", "ec.galois_rep_modell_image", r"mod-$\ell$ images",
lambda v: ", ".join(display_knowl('gl2.subgroup_data', title=s, kwargs={'label':s}) for s in v),
short_title="mod-ℓ images", default=lambda info: info.get ("nonmax_primes") or info.get("galois_image"), align="center"),
short_title="mod-ℓ images", default=lambda info: info.get("nonmax_primes") or info.get("galois_image"), align="center"),
MathCol("sha", "ec.analytic_sha_order", r"$Ш_{\textrm{an}}$", short_title="analytic Ш", default=False),
ProcessedCol("tamagawa_product", "ec.tamagawa_number", "Tamagawa", lambda v: web_latex(factor(v)), short_title="Tamagawa product", align="center", default=False),
ProcessedCol("reg", "ec.regulator", "Regulator", lambda v: str(v)[:11], mathmode=True, align="left", default=False),
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/elliptic_curves/elliptic_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def by_conductor(conductor):
if request.args:
# if conductor changed, fall back to a general search
if 'conductor' in request.args and request.args['conductor'] != str(conductor):
return redirect (url_for(".rational_elliptic_curves", **request.args), 307)
return redirect(url_for(".rational_elliptic_curves", **request.args), 307)
info['title'] += ' Search results'
info['bread'].append(('Search results',''))
info['conductor'] = conductor
Expand Down
6 changes: 3 additions & 3 deletions lmfdb/genus2_curves/web_g2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,11 +898,11 @@ def make_object(self, curve, endo, tama, ratpts, clus, galrep, nonsurj, is_curve
else:
data['mw_group'] = r'\(' + r' \oplus '.join((r'\Z' if n == 0 else r'\Z/{%s}\Z' % n) for n in invs) + r'\)'
if lower >= upper:
data['mw_gens_table'] = mw_gens_table (ratpts['mw_invs'], ratpts['mw_gens'], ratpts['mw_heights'], ratpts['rat_pts'])
data['mw_gens_simple_table'] = mw_gens_simple_table (ratpts['mw_invs'], ratpts['mw_gens'], ratpts['mw_heights'], ratpts['rat_pts'], data['min_eqn'])
data['mw_gens_table'] = mw_gens_table(ratpts['mw_invs'], ratpts['mw_gens'], ratpts['mw_heights'], ratpts['rat_pts'])
data['mw_gens_simple_table'] = mw_gens_simple_table(ratpts['mw_invs'], ratpts['mw_gens'], ratpts['mw_heights'], ratpts['rat_pts'], data['min_eqn'])

if curve['two_torsion_field'][0]:
data['two_torsion_field_knowl'] = nf_display_knowl (curve['two_torsion_field'][0], field_pretty(curve['two_torsion_field'][0]))
data['two_torsion_field_knowl'] = nf_display_knowl(curve['two_torsion_field'][0], field_pretty(curve['two_torsion_field'][0]))
else:
t = curve['two_torsion_field']
data['two_torsion_field_knowl'] = r"splitting field of \(%s\) with Galois group %s" % (intlist_to_poly(t[1]),transitive_group_display_knowl(f"{t[2][0]}T{t[2][1]}"))
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/higher_genus_w_automorphisms/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def decjac_format(decjac_list):
entry = entry + "^{" + str(ints[1]) + "}"
entries.append(entry)
latex = "\\times ".join(entries)
ccClasses = cc_display ([ints[2] for ints in decjac_list])
ccClasses = cc_display([ints[2] for ints in decjac_list])
return latex, ccClasses

# Turn 'i.j' in the total label in to cc displayed in mongo
Expand Down
12 changes: 6 additions & 6 deletions lmfdb/lfunctions/Lfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,10 @@ def __init__(self, **args):

# Check for compulsory arguments
if self.fromDB:
validate_required_args ('Unable to construct L-function of Maass form.',
validate_required_args('Unable to construct L-function of Maass form.',
args, 'group', 'level', 'char', 'R', 'ap_id')
else:
validate_required_args ('Unable to construct L-function of Maass form.',
validate_required_args('Unable to construct L-function of Maass form.',
args, 'maass_id')

self._Ltype = "maass"
Expand Down Expand Up @@ -848,9 +848,9 @@ def __init__(self, **args):
constructor_logger(self, args)

# Check for compulsory arguments
validate_required_args ('Unable to construct Hilbert modular form '
validate_required_args('Unable to construct Hilbert modular form '
+ 'L-function.', args, 'label', 'number', 'character')
validate_integer_args ('Unable to construct Hilbert modular form L-function.',
validate_integer_args('Unable to construct Hilbert modular form L-function.',
args, 'character','number')

self._Ltype = "hilbertmodularform"
Expand Down Expand Up @@ -1125,7 +1125,7 @@ def __init__(self, **args):
constructor_logger(self, args)

# Check for compulsory arguments
validate_required_args ('Unable to construct Dedekind zeta function.', args, 'label')
validate_required_args('Unable to construct Dedekind zeta function.', args, 'label')
self._Ltype = "dedekindzeta"

# Put the arguments into the object dictionary
Expand Down Expand Up @@ -1434,7 +1434,7 @@ def __init__(self, **args):
validate_required_args('Unable to construct symmetric power L-function.',
args, 'power', 'underlying_type', 'field',
'conductor', 'isogeny')
validate_integer_args ('The power has to be an integer.',
validate_integer_args('The power has to be an integer.',
args, 'power', 'conductor')
self._Ltype = "SymmetricPower"

Expand Down
6 changes: 3 additions & 3 deletions lmfdb/sato_tate_groups/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ def render_by_label(label):
data, in_database = st_lookup(label)
info = {}
if data is None:
flash_error ("%s is not the label of a Sato-Tate group currently in the database.", label)
flash_error("%s is not the label of a Sato-Tate group currently in the database.", label)
return redirect(url_for(".index"))
for attr in ['label','weight','degree','name','pretty','real_dimension','components']:
info[attr] = data[attr]
Expand All @@ -868,7 +868,7 @@ def render_by_label(label):
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'])
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')
Expand All @@ -883,7 +883,7 @@ def render_by_label(label):
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'])
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'])
Expand Down
12 changes: 6 additions & 6 deletions lmfdb/siegel_modular_forms/siegel_modular_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def by_label(label):
bread = [("Modular forms", url_for('modular_forms')),
('Siegel', url_for('.index'))]
slabel = label.split('.')
family = get_smf_family (slabel[0])
family = get_smf_family(slabel[0])
if family:
if len(slabel) == 1:
return render_family_page(family, request.args, bread)
Expand Down Expand Up @@ -197,7 +197,7 @@ def render_family_page(family, args, bread):
forms = [ (k, [(f.name(), f.degree_of_field()) for f in sams if k == f.weight()]) for k in Set(f.weight() for f in sams)]
info = { 'family': family, 'forms': forms, 'args': to_dict(args) }
if family.computes_dimensions():
build_dimension_table (info, family, args)
build_dimension_table(info, family, args)
bread.append(('$'+family.latex_name+'$', ''))
return render_template("ModularForm_GSp4_Q_family.html", title='Siegel modular forms for $'+family.latex_name+'$', bread=bread, info=info)

Expand All @@ -209,9 +209,9 @@ def render_search_results_page(args, bread):
info = { 'args': to_dict(args) }
query = {}
try:
parse_ints (info['args'], query, 'deg', 'degree', qfield="degree")
parse_ints (info['args'], query, 'wt', '$k$', qfield="weight")
parse_ints (info['args'], query, 'fdeg', 'field degree')
parse_ints(info['args'], query, 'deg', 'degree', qfield="degree")
parse_ints(info['args'], query, 'wt', '$k$', qfield="weight")
parse_ints(info['args'], query, 'fdeg', 'field degree')
except ValueError:
info['error'] = True
if not info.get('error'):
Expand All @@ -237,7 +237,7 @@ def render_dimension_table_page(args, bread):
if 'j' not in family.latex_name and 'j' in info['args'] and info['args']['j'] != '0':
flash_error("$j$ = %s should not be specified for the selected space %s", info['args']['j'], '$'+family.latex_name+'$')
else:
build_dimension_table (info, family, info['args'])
build_dimension_table(info, family, info['args'])
bread.append(('Dimensions', 'dimensions'))
return render_template("ModularForm_GSp4_Q_dimensions.html", title='Siegel modular forms dimension tables', bread=bread, info=info)

Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ commands =
pyflakes start-lmfdb.py user-manager.py lmfdb/
pylint --score=no -d C,R,E,W -e W0129,W0108 start-lmfdb.py user-manager.py lmfdb/
# see https://pycodequ.al/docs/pylint-messages/Warnings.html
# E722 do not use bare except, specify exception instead
# E111 indentation is not a multiple of four
# E211 whitespace before '('
# E702 multiple statements on one line (semicolon)
# W391 blank line at end of file
pycodestyle --select=E111,E722,E711,E702 lmfdb/
# E711 Comparison to None should be 'cond is None:'
# E722 do not use bare except, specify exception instead
pycodestyle --select=E111,E211,E702,E711,E722 lmfdb/

0 comments on commit c0a39e0

Please sign in to comment.