Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 16ab12b

Browse files
ruff encore
1 parent 5d4ac83 commit 16ab12b

File tree

7 files changed

+37
-34
lines changed

7 files changed

+37
-34
lines changed

‎2021年10月18日-CIMPA-Bobo/mots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def est_langage_préfixe(L):
5151
sage: est_langage_préfixe(['a', 'ab', 'a'])
5252
False
5353
"""
54-
return not any([u != v and est_préfixe(v, u)
54+
return not any(u != v and est_préfixe(v, u)
5555
for u in L
56-
for v in L])
56+
for v in L)
5757

5858

5959
def factorisations(u: str, L: List[str]) -> List[List[str]]:

‎agregation-option-calcul-formel/media/bleachermark.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,14 @@
5555
('stupid benchmark', 'zero', 1, 0.0, 0)]
5656
"""
5757

58-
from time import time as clock
59-
from copy import copy
60-
from functools import reduce
61-
6258
# This part handles the ctrl-c interruption.
6359
# class CTRLC(Exception):
6460
# def __init__(self):
6561
# pass
66-
6762
import signal
63+
from copy import copy
64+
from functools import reduce
65+
from time import time as clock
6866

6967

7068
def signal_ctrl_c(signal, frame):
@@ -176,9 +174,9 @@ def __init__(self, benchmarks):
176174
"""
177175
if isinstance(benchmarks, Benchmark):
178176
self._benchmarks = (benchmarks, )
179-
elif isinstance(benchmarks, (list, tuple)) and all([isinstance(i, Benchmark) for i in benchmarks]):
177+
elif isinstance(benchmarks, (list, tuple)) and all(isinstance(i, Benchmark) for i in benchmarks):
180178
self._benchmarks = tuple(benchmarks)
181-
elif isinstance(benchmarks, (list, tuple)) and all([isinstance(i, (list, tuple)) for i in benchmarks]):
179+
elif isinstance(benchmarks, (list, tuple)) and all(isinstance(i, (list, tuple)) for i in benchmarks):
182180
self._benchmarks = tuple(Benchmark(i) for i in benchmarks)
183181
else:
184182
self._benchmarks = (Benchmark(benchmarks),)
@@ -350,7 +348,7 @@ def averages(self):
350348
timings = self.timings(transposed=True)
351349
res = {}
352350
for bm in timings:
353-
totals = map(lambdaa: sum(a) / len(a), timings[bm])
351+
totals = (sum(a) / len(a)forain timings[bm])
354352
res[bm] = totals
355353
return res
356354

@@ -409,8 +407,8 @@ def __add__(self, other):
409407
"""
410408
raise NotImplementedError("Not verified since Runner system")
411409
import re
412-
my_labels = set(b.label() for b in self._benchmarks)
413-
ot_labels = set(b.label() for b in other._benchmarks)
410+
my_labels = {b.label() for b in self._benchmarks}
411+
ot_labels = {b.label() for b in other._benchmarks}
414412
collisions = my_labels.intersect(ot_labels)
415413
if collisions:
416414
autolabel = re.compile(_autolabel_regex)
@@ -677,8 +675,8 @@ class ParallelRunner:
677675
As input, it takes a list or tuple of the inputs that will be given to the benchmarks.
678676
"""
679677
def __init__(self, bleachermark, runs):
680-
from sage.parallel.decorate import parallel
681678
from sage.functions.other import ceil, floor
679+
from sage.parallel.decorate import parallel
682680
self._benchmarks = bleachermark._benchmarks
683681
# profiling we run each benchmark once
684682
self._totaltime = reduce(lambda a, b: a + b, [r[0] for bm in self._benchmarks for r in bm.run(runs[0])[1:]])

‎agregation-option-calcul-formel/media/codes_correcteurs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
1616
"""
1717
from sage.matrix.constructor import matrix
18+
from sage.modules.free_module_element import vector
1819
from sage.plot.colors import rainbow
1920
from sage.plot.plot3d.platonic import cube
20-
from sage.symbolic.constants import pi
2121
from sage.plot.point import point
22-
from sage.modules.free_module_element import vector
2322
from sage.rings.rational_field import QQ
23+
from sage.symbolic.constants import pi
2424

2525

2626
def distance_hamming(c1, c2):

‎agregation-option-calcul-formel/media/gauss.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import time
21
import copy
3-
from sage.rings.rational_field import QQ
2+
import time
3+
44
from sage.matrix.constructor import random_matrix
5+
from sage.rings.rational_field import QQ
56

67

78
def gauss(m, k=None):

‎agregation-option-calcul-formel/media/programmation_lineaire.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from copy import copy
22

3-
from sage.rings.integer_ring import ZZ
43
from sage.matrix.constructor import matrix
54
from sage.matrix.special import block_matrix
65
from sage.modules.free_module_element import vector
6+
from sage.rings.integer_ring import ZZ
77
from sage.symbolic.ring import SR
88

9-
109
NonNegative = "NonNegative"
1110

1211

‎setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from setuptools import setup, find_packages
21
from codecs import open # To open the README file with proper encoding
32

3+
from setuptools import find_packages, setup
4+
45
description = 'More SageMath Thematic Tutorials'
56
version = "0.0.1"
67
author = 'The SageMath community'

‎tutorial-symmetric-functions-purgatory.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,26 @@
1919
#
2020
# http://www.gnu.org/licenses/
2121
# ****************************************************************************
22-
from sage.structure.parent import Parent
23-
from sage.structure.unique_representation import UniqueRepresentation
24-
from sage.categories.graded_hopf_algebras import GradedHopfAlgebras
2522
from sage.categories.fields import Fields
23+
from sage.categories.graded_hopf_algebras import GradedHopfAlgebras
2624
from sage.categories.rings import Rings
27-
from sage.combinat.partition import Partitions
2825
from sage.combinat.free_module import CombinatorialFreeModule
26+
from sage.combinat.partition import Partitions
2927
from sage.rings.rational_field import QQ
28+
from sage.structure.parent import Parent
29+
from sage.structure.unique_representation import UniqueRepresentation
3030

31-
from . import schur
32-
from . import monomial
33-
from . import powersum
34-
from . import elementary
35-
from . import homogeneous
36-
from . import hall_littlewood
37-
from . import jack
38-
from . import macdonald
39-
from . import llt
31+
from . import (
32+
elementary,
33+
hall_littlewood,
34+
homogeneous,
35+
jack,
36+
llt,
37+
macdonald,
38+
monomial,
39+
powersum,
40+
schur,
41+
)
4042

4143

4244
class SymmetricFunctions(UniqueRepresentation, Parent):
@@ -1030,7 +1032,7 @@ def register_isomorphism(self, morphism, only_conversion=False):
10301032
else:
10311033
morphism.codomain().register_coercion(morphism)
10321034

1033-
_shorthands = set(['e', 'h', 'm', 'p', 's'])
1035+
_shorthands = {'e', 'h', 'm', 'p', 's'}
10341036

10351037
def inject_shorthands(self, shorthands=_shorthands):
10361038
"""
@@ -1272,6 +1274,8 @@ def __init__(self, t, domain, codomain):
12721274

12731275
def __call__(self, partition):
12741276
"""
1277+
EXAMPLES::
1278+
12751279
sage: Sym = SymmetricFunctions(QQ['x'])
12761280
sage: p = Sym.p(); s = Sym.s()
12771281
sage: p[1] + s[1] # indirect doctest

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /