Skip to content

Commit 911c9bc

Browse files
committed
pep8 fixes
1 parent 09fa791 commit 911c9bc

16 files changed

+331
-290
lines changed

agregation-option-calcul-formel/media/GroupeSymetrique-correction.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from sage.misc.misc_c import prod
1111

12+
1213
def p(k, poids):
1314
r"""
1415
Calcule `p_k` à partir de la liste des poids des éléments de `F`.
@@ -24,6 +25,7 @@ def p(k, poids):
2425
"""
2526
return sum(w**k for w in poids)
2627

28+
2729
def type_cyclique(sigma):
2830
r"""
2931
Renvoie le type cyclique de la permutation sigma
@@ -62,8 +64,8 @@ def type_cyclique(sigma):
6264

6365

6466
def Polya(G, poids):
65-
"""
66-
Implantation de la formule d'énumération de Pòlya
67+
r"""
68+
Implémentation de la formule d'énumération de Pòlya
6769
6870
INPUT:
6971
@@ -91,9 +93,10 @@ def Polya(G, poids):
9193
.. TODO:: Rajouter ici les autres exemples!
9294
9395
"""
94-
return sum(prod( p(k, poids) for k in type_cyclique(sigma))
96+
return sum(prod(p(k, poids) for k in type_cyclique(sigma))
9597
for sigma in G) / G.cardinality()
9698

99+
97100
def taille_groupe(sgf):
98101
r"""
99102
Renvoie la taille d'un groupe de permutations
@@ -115,6 +118,7 @@ def taille_groupe(sgf):
115118
"""
116119
return prod(len(transversal) for transversal in sgf)
117120

121+
118122
def liste_groupe(sgf):
119123
r"""
120124
Renvoie la liste des éléments d'un groupe de permutations
@@ -136,10 +140,11 @@ def liste_groupe(sgf):
136140
"""
137141
if len(sgf) == 1:
138142
return sgf[0].values()
139-
else:
140-
rec = liste_groupe(sgf[:-1])
141-
transversal = sgf[-1].values()
142-
return list( r * t for r in rec for t in transversal )
143+
144+
rec = liste_groupe(sgf[:-1])
145+
transversal = sgf[-1].values()
146+
return [r * t for r in rec for t in transversal]
147+
143148

144149
def est_dans_groupe(sigma, sgf):
145150
r"""
@@ -166,6 +171,6 @@ def est_dans_groupe(sigma, sgf):
166171
i = len(sgf)
167172
if i == 0:
168173
return sigma.is_one()
169-
else:
170-
sigma = sigma * sgf[i-1][sigma(i)]
171-
return est_dans_groupe(sigma, sgf[:-1])
174+
175+
sigma = sigma * sgf[i - 1][sigma(i)]
176+
return est_dans_groupe(sigma, sgf[:-1])

agregation-option-calcul-formel/media/GroupeSymetrique.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
88
"""
99

10-
from sage.misc.misc_c import prod
1110

1211
def p(k, poids):
1312
r"""
@@ -23,6 +22,7 @@ def p(k, poids):
2322
0
2423
"""
2524

25+
2626
def type_cyclique(sigma):
2727
r"""
2828
Renvoie le type cyclique de la permutation sigma
@@ -47,8 +47,8 @@ def type_cyclique(sigma):
4747

4848

4949
def Polya(G, poids):
50-
"""
51-
Implantation de la formule d'énumération de Pòlya
50+
r"""
51+
Implémentation de la formule d'énumération de Pòlya
5252
5353
INPUT:
5454
@@ -77,6 +77,7 @@ def Polya(G, poids):
7777
7878
"""
7979

80+
8081
def taille_groupe(sgf):
8182
r"""
8283
Renvoie la taille d'un groupe de permutations
@@ -97,6 +98,7 @@ def taille_groupe(sgf):
9798
.. TODO:: rajouter d'autres exemples
9899
"""
99100

101+
100102
def liste_groupe(sgf):
101103
r"""
102104
Renvoie la liste des éléments d'un groupe de permutations
@@ -117,6 +119,7 @@ def liste_groupe(sgf):
117119
.. TODO:: rajouter d'autres exemples
118120
"""
119121

122+
120123
def est_dans_groupe(sigma, sgf):
121124
r"""
122125
Test d'appartenance à un groupe de permutations

agregation-option-calcul-formel/media/algebre_lineaire_anneaux.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
Utilities to find interesting examples for the Smith form
33
"""
4+
from sage.all import ZZ, matrix, random_matrix
5+
46

57
def nb_steps(A):
68
"""
@@ -32,7 +34,8 @@ def nb_steps(A):
3234
newA = echelon_droite(A)
3335
return s
3436

35-
def find_matrix_with_large_nb_stepsf(n,m, l, nb_matrices):
37+
38+
def find_matrix_with_large_nb_stepsf(n, m, l, nb_matrices):
3639
"""
3740
Search for a matrix with large nb_steps by starting from a diagonal
3841
matrix and multiplying it by two random matrices on the left and on
@@ -51,7 +54,7 @@ def find_matrix_with_large_nb_stepsf(n,m, l, nb_matrices):
5154
"""
5255
M = matrix(ZZ, n, m)
5356
for i in range(len(l)):
54-
M[i,i]=l[i]
57+
M[i, i] = l[i]
5558
max_s = 0
5659
max_A = None
5760
for j in range(nb_matrices):

0 commit comments

Comments
 (0)