Skip to content

Commit a3763f5

Browse files
committed
let shorthands be tuple and immutable
1 parent 11baeed commit a3763f5

File tree

11 files changed

+26
-24
lines changed

11 files changed

+26
-24
lines changed

src/sage/algebras/iwahori_hecke_algebra.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,16 +481,17 @@ def __init__(self, W, q1, q2, base_ring):
481481
# Attach the generic Hecke algebra and the basis change maps
482482
self._root = root
483483
self._generic_iwahori_hecke_algebra = IwahoriHeckeAlgebra_nonstandard(W)
484-
self._shorthands = ['C', 'Cp', 'T']
484+
self._shorthands = ('C', 'Cp', 'T')
485485
else:
486486
# Can we actually remove the bases C and Cp in this case?
487487
self._root = None
488-
self._shorthands = ['T']
488+
self._shorthands = ('T',)
489489

490490
# if 2 is a unit in the base ring then add th A and B bases
491491
try:
492492
base_ring(base_ring.one() / 2)
493-
self._shorthands.extend(['A', 'B'])
493+
sh = self._shorthands
494+
self._shorthands = (*sh, 'A', 'B')
494495
except (TypeError, ZeroDivisionError):
495496
pass
496497

@@ -2785,7 +2786,7 @@ def __init__(self, W):
27852786
self.u_inv = normalized_laurent_polynomial(base_ring, u**-1)
27862787
self.v_inv = normalized_laurent_polynomial(base_ring, v**-1)
27872788

2788-
self._shorthands = ['C', 'Cp', 'T']
2789+
self._shorthands = ('C', 'Cp', 'T',)
27892790

27902791
if W.is_finite():
27912792
self._category = FiniteDimensionalAlgebrasWithBasis(base_ring)

src/sage/categories/examples/with_realizations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def __init__(self, R, S):
197197
F_to_Out .register_as_coercion()
198198
(~F_to_Out).register_as_coercion()
199199

200-
_shorthands = ["F", "In", "Out"]
200+
_shorthands = ("F", "In", "Out")
201201

202202
def a_realization(self):
203203
r"""

src/sage/combinat/chas/fsym.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def __init__(self, base_ring):
495495
cat = HopfAlgebras(base_ring).Graded().Connected()
496496
Parent.__init__(self, base=base_ring, category=cat.WithRealizations())
497497

498-
_shorthands = ['G']
498+
_shorthands = ('G',)
499499

500500
def a_realization(self):
501501
r"""
@@ -790,7 +790,7 @@ class FreeSymmetricFunctions_Dual(UniqueRepresentation, Parent):
790790
sage: TF(F[[5, 1, 4, 2, 3]])
791791
F[135|2|4]
792792
"""
793-
def __init__(self, base_ring):
793+
def __init__(self, base_ring) -> None:
794794
r"""
795795
Initialize ``self``.
796796
@@ -802,7 +802,7 @@ def __init__(self, base_ring):
802802
cat = HopfAlgebras(base_ring).Graded().Connected()
803803
Parent.__init__(self, base=base_ring, category=cat.WithRealizations())
804804

805-
_shorthands = ['F']
805+
_shorthands = ('F',)
806806

807807
def a_realization(self):
808808
r"""

src/sage/combinat/chas/wqsym.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ def a_realization(self):
498498
"""
499499
return self.M()
500500

501-
_shorthands = tuple(['M', 'X', 'C', 'Q', 'Phi'])
501+
_shorthands = ('M', 'X', 'C', 'Q', 'Phi')
502502

503503
# add options to class
504504
class options(GlobalOptions):

src/sage/combinat/fqsym.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def a_realization(self):
400400
"""
401401
return self.F()
402402

403-
_shorthands = tuple(['F', 'G', 'M'])
403+
_shorthands = ('F', 'G', 'M')
404404

405405
class F(FQSymBasis_abstract):
406406
r"""

src/sage/combinat/ncsf_qsym/ncsf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ class NonCommutativeSymmetricFunctions(UniqueRepresentation, Parent):
403403
sage: TestSuite(complete).run()
404404
"""
405405

406-
def __init__(self, R):
406+
def __init__(self, R) -> None:
407407
r"""
408408
TESTS::
409409
@@ -445,7 +445,7 @@ def __init__(self, R):
445445
Phi.algebra_morphism(Phi._to_complete_on_generators,
446446
codomain=complete).register_as_coercion()
447447

448-
def _repr_(self): # could be taken care of by the category
448+
def _repr_(self) -> str: # could be taken care of by the category
449449
r"""
450450
EXAMPLES::
451451
@@ -472,7 +472,8 @@ def a_realization(self):
472472
"""
473473
return self.complete()
474474

475-
_shorthands = tuple(['S', 'R', 'L', 'Phi', 'Psi', 'nM', 'I', 'dQS', 'dYQS', 'ZL', 'ZR'])
475+
_shorthands = ('S', 'R', 'L', 'Phi', 'Psi', 'nM', 'I',
476+
'dQS', 'dYQS', 'ZL', 'ZR')
476477

477478
def dual(self):
478479
r"""

src/sage/combinat/ncsf_qsym/qsym.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ class QuasiSymmetricFunctions(UniqueRepresentation, Parent):
546546
True
547547
"""
548548

549-
def __init__(self, R):
549+
def __init__(self, R) -> None:
550550
"""
551551
The Hopf algebra of quasi-symmetric functions.
552552
See ``QuasiSymmetricFunctions`` for full documentation.
@@ -609,7 +609,7 @@ def __init__(self, R):
609609
codomain=Fundamental, category=category)
610610
Sym_s_to_F.register_as_coercion()
611611

612-
def _repr_(self):
612+
def _repr_(self) -> str:
613613
r"""
614614
EXAMPLES::
615615
@@ -632,7 +632,7 @@ def a_realization(self):
632632
"""
633633
return self.Monomial()
634634

635-
_shorthands = tuple(['M', 'F', 'E', 'dI', 'QS', 'YQS', 'phi', 'psi'])
635+
_shorthands = ('M', 'F', 'E', 'dI', 'QS', 'YQS', 'phi', 'psi')
636636

637637
def dual(self):
638638
r"""

src/sage/combinat/ncsym/ncsym.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class SymmetricFunctionsNonCommutingVariables(UniqueRepresentation, Parent):
293293
-4*p[] + 2*p[1] + p[2, 2]
294294
"""
295295

296-
def __init__(self, R):
296+
def __init__(self, R) -> None:
297297
"""
298298
Initialize ``self``.
299299
@@ -309,7 +309,7 @@ def __init__(self, R):
309309
category = GradedHopfAlgebras(R).Cocommutative()
310310
Parent.__init__(self, category=category.WithRealizations())
311311

312-
def _repr_(self):
312+
def _repr_(self) -> str:
313313
r"""
314314
EXAMPLES::
315315
@@ -331,7 +331,7 @@ def a_realization(self):
331331
"""
332332
return self.powersum()
333333

334-
_shorthands = tuple(['chi', 'cp', 'm', 'e', 'h', 'p', 'rho', 'x'])
334+
_shorthands = ('chi', 'cp', 'm', 'e', 'h', 'p', 'rho', 'x')
335335

336336
def dual(self):
337337
r"""

src/sage/combinat/sf/sf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,8 +1430,8 @@ def register_isomorphism(self, morphism, only_conversion=False):
14301430
else:
14311431
morphism.codomain().register_coercion(morphism)
14321432

1433-
_shorthands = ['e', 'f', 'h', 'm', 'p', 's']
1434-
_shorthands_all = sorted(_shorthands + ['ht', 'o', 'sp', 'st', 'w'])
1433+
_shorthands = ('e', 'f', 'h', 'm', 'p', 's')
1434+
_shorthands_all = tuple(sorted(_shorthands + ('ht', 'o', 'sp', 'st', 'w')))
14351435

14361436
def __init_extra__(self):
14371437
"""

src/sage/rings/polynomial/integer_valued_polynomials.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class IntegerValuedPolynomialRing(UniqueRepresentation, Parent):
7575
...
7676
TypeError: argument R must be a commutative ring
7777
"""
78-
def __init__(self, R):
78+
def __init__(self, R) -> None:
7979
"""
8080
TESTS::
8181
@@ -88,7 +88,7 @@ def __init__(self, R):
8888
cat = Algebras(R).Commutative().WithBasis()
8989
Parent.__init__(self, base=R, category=cat.WithRealizations())
9090

91-
_shorthands = ["B", "S"]
91+
_shorthands = ("B", "S")
9292

9393
def _repr_(self) -> str:
9494
r"""

0 commit comments

Comments
 (0)