Skip to content

Commit 4595a86

Browse files
authored
Merge pull request #6625 from LMFDB/autopep8-patches
Fixes by autopep8 action
2 parents 8b493b6 + 606dfaa commit 4595a86

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

lmfdb/groups/abstract/web_groups.py

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2922,7 +2922,7 @@ def code_snippets(self):
29222922
'LZsplit': LZsplit, 'LZNsplit': LZNsplit, 'LZqsplit': LZqsplit,
29232923
'LFpsplit': LFpsplit, 'LFqsplit': LFqsplit, # add for GLFq GAP
29242924
# Adding the Sage versions of the matrix group code snippets:
2925-
'LZsage': LZsage, 'LFpsage': LFpsage, 'LZNsage': LZNsage, 'LZqsage': LZqsage, 'LFqsage': LFqsage,
2925+
'LZsage': LZsage, 'LFpsage': LFpsage, 'LZNsage': LZNsage, 'LZqsage': LZqsage, 'LFqsage': LFqsage,
29262926
}
29272927

29282928
# Here, we add the (perhaps subjectively?) "best" implementation of this group as a code snippet in Magma/GAP/SageMath,
@@ -2936,12 +2936,12 @@ def code_snippets(self):
29362936
self_families = []
29372937
# Highest priority: check if group is cyclic
29382938
if self.cyclic:
2939-
for lang in ['magma', 'gap']:
2939+
for lang in ['magma', 'gap']:
29402940
code['code_description'][lang] = "G := CyclicGroup("+str(self.order)+");"
29412941
code['code_description']['sage'] = "G = CyclicPermutationGroup("+str(self.order)+")"
29422942
# Check if symmetric
2943-
elif self.name[0]=='S' and self.name[1:].isdigit():
2944-
for lang in ['magma', 'gap']:
2943+
elif self.name[0] == 'S' and self.name[1:].isdigit():
2944+
for lang in ['magma', 'gap']:
29452945
code['code_description'][lang] = "G := SymmetricGroup("+self.name[1:]+");"
29462946
code['code_description']['sage'] = "G = SymmetricGroup("+self.name[1:]+")"
29472947
# Check if dihedral
@@ -2950,8 +2950,8 @@ def code_snippets(self):
29502950
code['code_description']['gap'] = "G := DihedralGroup("+str(self.order)+");" # GAP D(n) has order n
29512951
code['code_description']['sage'] = "G = DihedralGroup("+str(self.order/2)+")" # Sage D(n) has order 2n
29522952
# Check if alternating
2953-
elif self.name[0]=='A' and self.name[1:].isdigit():
2954-
for lang in ['magma', 'gap']:
2953+
elif self.name[0] == 'A' and self.name[1:].isdigit():
2954+
for lang in ['magma', 'gap']:
29552955
code['code_description'][lang] = "G := AlternatingGroup("+self.name[1:]+");"
29562956
code['code_description']['sage'] = "G = AlternatingGroup("+self.name[1:]+")"
29572957
else:
@@ -2997,8 +2997,9 @@ def code_snippets(self):
29972997
gap_id = self.label.split('.')
29982998
for lang in ['magma', 'gap']:
29992999
if lang not in code['code_description']:
3000-
code['code_description'][lang] = 'G := SmallGroup('+gap_id[0]+', '+gap_id[1]+');'
3001-
if 'sage_gap' not in code['code_description']: code['code_description']['sage_gap'] = 'G = gap.SmallGroup('+gap_id[0]+', '+gap_id[1]+')'
3000+
code['code_description'][lang] = 'G := SmallGroup('+gap_id[0]+', '+gap_id[1]+');'
3001+
if 'sage_gap' not in code['code_description']:
3002+
code['code_description']['sage_gap'] = 'G = gap.SmallGroup('+gap_id[0]+', '+gap_id[1]+')'
30023003
# Otherwise, check if group is abelian (then can define as product of cyclic groups from its primary decomposition)
30033004
if self.abelian:
30043005
for lang in ['magma', 'gap']:
@@ -3011,44 +3012,50 @@ def code_snippets(self):
30113012
for rep in ["Perm", "PC", "GLZ", "GLFp", "GLZN", "GLZq", "GLFq"]:
30123013
if rep in self.representations:
30133014
# Get the corresponding name of the code snippet in the code.yaml file, for this representation
3014-
if rep == "Perm": code_rep = "permutation"
3015-
elif rep == "PC": code_rep = "presentation"
3016-
else: code_rep = rep
3015+
if rep == "Perm":
3016+
code_rep = "permutation"
3017+
elif rep == "PC":
3018+
code_rep = "presentation"
3019+
else:
3020+
code_rep = rep
30173021
for lang in code[code_rep]:
30183022
if lang not in code['code_description']:
30193023
code['code_description'][lang] = code[code_rep][lang]
30203024
# Otherwise, if absolutely all else fails, we display no code snippet at the top :(
3021-
3025+
30223026
# If no Sage top code snippet, then we resort to implementing the group G using the GAP interface in Sage
30233027
if ('sage' in code['code_description']) and ("gap" not in code['code_description']['sage']):
30243028
code['prompt'].pop('sage_gap', None)
3025-
else: code['prompt'].pop('sage', None)
3029+
else:
3030+
code['prompt'].pop('sage', None)
30263031

30273032
# If our implementation of G is either as a matrix group or abelian group,
30283033
# then unfortunately not all the default code snippets in Sage and Magma will work correctly!
30293034
# As a (hopefully temporary) solution, we hide the code snippets which will not work with our implemention of G in the top code snippet
30303035
# TODO: Find a better solution for this (would it be worth converting G to a permutation group within the top code snippet?)
30313036
if ("MatrixGroup" in code['code_description']['sage']) and ("permutation" not in code['code_description']['sage']):
3032-
# Must disable all code snippets which do not work with MatrixGroup in Sage
3037+
# Must disable all code snippets which do not work with MatrixGroup in Sage
30333038
for c in ['composition_factors', 'is_cyclic', 'is_elementary_abelian', 'is_pgroup', 'abelianization', 'schur_multiplier',
30343039
'commutator', 'frattini_subgroup', 'fitting_subgroup', 'socle', 'derived_series', 'lower_central_series', 'upper_central_series']:
3035-
if c in code: code[c].pop('sage', None)
3040+
if c in code:
3041+
code[c].pop('sage', None)
30363042
if ("AbelianGroup" in code['code_description']['sage']) and ("permutation" not in code['code_description']['sage']):
3037-
# Must disable all code snippets which do not work with AbelianGroup in Sage
3043+
# Must disable all code snippets which do not work with AbelianGroup in Sage
30383044
for c in ['composition_factors', 'is_elementary_abelian', 'is_nilpotent', 'is_perfect', 'is_pgroup', 'is_polycyclic', 'is_solvable', 'is_supersolvable',
30393045
'abelianization', 'schur_multiplier', 'center', 'commutator', 'frattini_subgroup', 'fitting_subgroup', 'socle',
30403046
'derived_series', 'lower_central_series', 'upper_central_series']:
3041-
if c in code: code[c].pop('sage', None)
3047+
if c in code:
3048+
code[c].pop('sage', None)
30423049
if ("MatrixGroup" in code['code_description']['magma']) and ("permutation" not in code['code_description']['magma']):
30433050
# Must disable all code snippets which do not work with MatrixGroup in Magma
30443051
for c in ['socle']:
3045-
if c in code: code[c].pop('magma', None)
3052+
if c in code:
3053+
code[c].pop('magma', None)
30463054
if ("AbelianGroup" in code['code_description']['magma']) and ("permutation" not in code['code_description']['magma']):
30473055
# Must disable all code snippets which do not work with AbelianGroup in Magma
30483056
for c in ['radical', 'socle']:
3049-
if c in code: code[c].pop('magma', None)
3050-
3051-
3057+
if c in code:
3058+
code[c].pop('magma', None)
30523059

30533060
for prop in code:
30543061
for lang in code[prop]:

lmfdb/utils/place_code.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@ def place_code(self, is_top_snippet=False):
5454
prompt = code['prompt'][L] if 'prompt' in code and L in code['prompt'] else L
5555
class_str = " ".join([L,'nodisplay','codebox'])
5656
sep = "\n"
57-
57+
5858
# If is_top_snippet is True, then code snippet appears near top of page,
5959
# This means we should set max-width to be smaller than usual
6060
# Todo: make this decision uniform for all code snippets
61-
if is_top_snippet: max_width_style = " max-width: 50%;"
62-
else: max_width_style = " max-width: 1200px;"
61+
if is_top_snippet:
62+
max_width_style = " max-width: 50%;"
63+
else:
64+
max_width_style = " max-width: 1200px;"
6365

6466
snippet_str += f"""
6567
<div class="{class_str}" style="user-select: none; margin-bottom: 12px; align-items: baseline; {max_width_style}">

0 commit comments

Comments
 (0)