Skip to content

Commit 4cc25f1

Browse files
committed
Some reviewer changes.
1 parent 2c7f4cd commit 4cc25f1

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/sage/algebras/quantum_oscillator.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from sage.sets.family import Family
2727
from sage.sets.non_negative_integers import NonNegativeIntegers
2828

29+
2930
class QuantumOscillatorAlgebra(CombinatorialFreeModule):
3031
r"""
3132
The quantum oscillator algebra.
@@ -159,7 +160,7 @@ def __init__(self, q, R):
159160
CombinatorialFreeModule.__init__(self, R, indices, category=cat)
160161
self._assign_names(('ap', 'am', 'k', 'ki'))
161162

162-
def _repr_(self):
163+
def _repr_(self) -> str:
163164
r"""
164165
Return a string representation of ``self``.
165166
@@ -217,7 +218,7 @@ def algebra_generators(self):
217218
return Family(d)
218219

219220
@cached_method
220-
def gens(self):
221+
def gens(self) -> tuple:
221222
r"""
222223
Return the generators of ``self``.
223224
@@ -230,7 +231,7 @@ def gens(self):
230231
return tuple(self.algebra_generators())
231232

232233
@cached_method
233-
def one_basis(self):
234+
def one_basis(self) -> tuple:
234235
r"""
235236
Return the index of the basis element of `1`.
236237
@@ -242,7 +243,7 @@ def one_basis(self):
242243
"""
243244
return (ZZ.zero(), ZZ.zero())
244245

245-
def some_elements(self):
246+
def some_elements(self) -> tuple:
246247
r"""
247248
Return some elements of ``self``.
248249
@@ -275,7 +276,7 @@ def fock_space_representation(self):
275276
"""
276277
return FockSpaceRepresentation(self)
277278

278-
def _repr_term(self, m):
279+
def _repr_term(self, m) -> str:
279280
r"""
280281
Return a string representation of the basis element indexed by ``m``.
281282
@@ -438,7 +439,7 @@ def product_on_basis(self, ml, mr):
438439
return self.element_class(self, {(a, kl+kr+i): c * coeff for i, c in enumerate(kp) if c})
439440

440441
class Element(CombinatorialFreeModule.Element):
441-
def inverse(self):
442+
def __invert__(self):
442443
r"""
443444
Return the inverse if ``self`` is a basis element.
444445
@@ -474,16 +475,14 @@ def inverse(self):
474475
O = self.parent()
475476
return O.element_class(O, {(a, -k): coeff.inverse_of_unit()})
476477

477-
__invert__ = inverse
478-
479478

480479
class FockSpaceRepresentation(CombinatorialFreeModule):
481-
"""
480+
r"""
482481
The unique Fock space representation of the
483482
:class:`~sage.algebras.quantum_oscillator.QuantumOscillatorAlgebra`.
484483
"""
485484
def __init__(self, O):
486-
"""
485+
r"""
487486
Initialize ``self``.
488487
489488
EXAMPLES::
@@ -498,7 +497,7 @@ def __init__(self, O):
498497
latex_bracket=[r'\lvert', r'\rangle'])
499498

500499
def _test_representation(self, **options):
501-
"""
500+
r"""
502501
Test that ``self`` is a representation of the quantum
503502
oscillator algebra.
504503
@@ -519,8 +518,8 @@ def _test_representation(self, **options):
519518
return
520519
tester.assertEqual((a*b)*elt, a*(b*elt))
521520

522-
def _repr_(self):
523-
"""
521+
def _repr_(self) -> str:
522+
r"""
524523
Return a string representation of ``self``.
525524
526525
EXAMPLES::
@@ -559,7 +558,7 @@ def vacuum(self):
559558
return self.basis()[0]
560559

561560
def some_elements(self):
562-
"""
561+
r"""
563562
Return some elements of ``self``.
564563
565564
EXAMPLES::
@@ -574,7 +573,7 @@ def some_elements(self):
574573

575574
class Element(CombinatorialFreeModule.Element):
576575
def _acted_upon_(self, scalar, self_on_left=True):
577-
"""
576+
r"""
578577
Return the action of ``scalar`` on ``self``.
579578
580579
EXAMPLES::

0 commit comments

Comments
 (0)