Skip to content

Commit e3ababd

Browse files
author
Release Manager
committed
Trac #34144: modernize super in combinat (step one)
using the short syntax `super()` URL: https://trac.sagemath.org/34144 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Matthias Koeppe
2 parents d22a144 + 87140db commit e3ababd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+115
-119
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=b5a2cfbb85e9d1afd3c151429525944f1e0ca84f
3-
md5=8cf9a8e717fe11a7c6fb7aa41975a7a1
4-
cksum=2226307451
2+
sha1=7f35111c9a2aeb985580f13c2f1f72b2219ffcb1
3+
md5=30cf7cce73540a45384762cea5da5f62
4+
cksum=2110985588
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
413ff13c54c4738b14d64eb7e7e6b2d06439d12c
1+
b393ee3e8e5501fd7e9101d884c743567df1816d

src/sage/combinat/abstract_tree.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,15 +2085,15 @@ def __init__(self, parent, children, label=None, check=True):
20852085
"""
20862086
# We must initialize the label before the subtrees to allows rooted
20872087
# trees canonization. Indeed it needs that ``self``._hash_() is working
2088-
# at the end of the call super(..., self).__init__(...)
2088+
# at the end of the call super().__init__(...)
20892089
if isinstance(children, AbstractLabelledTree):
20902090
if label is None:
20912091
self._label = children._label
20922092
else:
20932093
self._label = label
20942094
else:
20952095
self._label = label
2096-
super(AbstractLabelledTree, self).__init__(parent, children, check=check)
2096+
super().__init__(parent, children, check=check)
20972097

20982098
def _repr_(self):
20992099
"""
@@ -2211,8 +2211,7 @@ def __eq__(self, other):
22112211
sage: t1 == t2
22122212
False
22132213
"""
2214-
return (super(AbstractLabelledTree, self).__eq__(other) and
2215-
self._label == other._label)
2214+
return super().__eq__(other) and self._label == other._label
22162215

22172216
def _hash_(self):
22182217
"""

src/sage/combinat/baxter_permutations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(self, n):
8181
self.element_class = Permutations(n).element_class
8282
self._n = ZZ(n)
8383
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
84-
super(BaxterPermutations_size, self).__init__(category=FiniteEnumeratedSets())
84+
super().__init__(category=FiniteEnumeratedSets())
8585

8686
def _repr_(self):
8787
"""

src/sage/combinat/blob_algebra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def __classcall_private__(cls, k, q1, q2, q3, base_ring=None, prefix='B'):
429429
q1 = base_ring(q1)
430430
q2 = base_ring(q2)
431431
q3 = base_ring(q3)
432-
return super(BlobAlgebra, cls).__classcall__(cls, k, q1, q2, q3, base_ring, prefix)
432+
return super().__classcall__(cls, k, q1, q2, q3, base_ring, prefix)
433433

434434
def __init__(self, k, q1, q2, q3, base_ring, prefix):
435435
r"""

src/sage/combinat/chas/fsym.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def coerce_base_ring(self, x):
158158
# Otherwise lift that basis up and then coerce over
159159
target = getattr(FSym, R._realization_name())()
160160
return self._coerce_map_via([target], R)
161-
return super(FSymBasis_abstract, self)._coerce_map_from_(R)
161+
return super()._coerce_map_from_(R)
162162

163163
def some_elements(self):
164164
r"""
@@ -633,7 +633,7 @@ def R_to_G_on_basis(alpha):
633633
if descent_composition(t) == alpha)
634634
return ribbon.module_morphism(R_to_G_on_basis, codomain=self)
635635
return self._coerce_map_via([ribbon], R)
636-
return super(FreeSymmetricFunctions.Fundamental, self)._coerce_map_from_(R)
636+
return super()._coerce_map_from_(R)
637637

638638
def dual_basis(self):
639639
r"""
@@ -963,7 +963,7 @@ def s_to_F_on_basis(mu):
963963
return self.sum_of_monomials(StandardTableaux(mu))
964964
return s.module_morphism(s_to_F_on_basis, codomain=self)
965965
return self._coerce_map_via([s], R)
966-
return super(FreeSymmetricFunctions_Dual.FundamentalDual, self)._coerce_map_from_(R)
966+
return super()._coerce_map_from_(R)
967967

968968
def dual_basis(self):
969969
r"""

src/sage/combinat/chas/wqsym.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def coerce_base_ring(self, x):
233233
# Otherwise lift that basis up and then coerce over
234234
target = getattr(self.realization_of(), R._basis_name)()
235235
return self._coerce_map_via([target], R)
236-
return super(WQSymBasis_abstract, self)._coerce_map_from_(R)
236+
return super()._coerce_map_from_(R)
237237

238238
@cached_method
239239
def an_element(self):

src/sage/combinat/colored_permutations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,13 +727,13 @@ def _coerce_map_from_(self, C):
727727
False
728728
"""
729729
if isinstance(C, Permutations) and C.n == self._n:
730-
return lambda P, x: P.element_class(P, [P._C.zero()]*P._n, x)
730+
return lambda P, x: P.element_class(P, [P._C.zero()] * P._n, x)
731731
if self._m == 2 and isinstance(C, SignedPermutations) and C._n == self._n:
732732
return lambda P, x: P.element_class(P,
733733
[P._C.zero() if v == 1 else P._C.one()
734734
for v in x._colors],
735735
x._perm)
736-
return super(ColoredPermutations, self)._coerce_map_from_(C)
736+
return super()._coerce_map_from_(C)
737737

738738
def __iter__(self):
739739
"""

src/sage/combinat/combinat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ def __init__(self, parent, *args, **kwds):
15721572
L, = kwds.values()
15731573
else:
15741574
raise TypeError("__init__() takes exactly 2 arguments ({} given)".format(1 + len(args) + len(kwds)))
1575-
super(CombinatorialElement, self).__init__(L)
1575+
super().__init__(L)
15761576
super(CombinatorialObject, self).__init__(parent)
15771577

15781578

src/sage/combinat/composition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@ def __classcall_private__(cls, n):
19071907
sage: C is C3
19081908
True
19091909
"""
1910-
return super(Compositions_n, cls).__classcall__(cls, Integer(n))
1910+
return super().__classcall__(cls, Integer(n))
19111911

19121912
def __init__(self, n):
19131913
"""

0 commit comments

Comments
 (0)