180
180
# ***************************************************************************
181
181
182
182
import operator
183
+
183
184
from sage .misc .latex import latex
184
185
from sage .misc .latex import latex_variable_name
185
186
from sage .structure .sequence import Sequence
@@ -360,7 +361,7 @@ def __classcall_private__(cls, mat, twist, names=None, category=None):
360
361
names = normalize_names (names , rank )
361
362
return cls .__classcall__ (cls , mat , category ._ore , names , category )
362
363
363
- def __init__ (self , mat , ore , names , category ):
364
+ def __init__ (self , mat , ore , names , category ) -> None :
364
365
r"""
365
366
Initialize this Ore module.
366
367
@@ -399,7 +400,7 @@ def __init__(self, mat, ore, names, category):
399
400
self ._quotientModule_class = OreQuotientModule
400
401
self ._pseudohom = FreeModule_ambient .pseudohom (self , mat , ore , codomain = self )
401
402
402
- def _repr_ (self ):
403
+ def _repr_ (self ) -> str :
403
404
r"""
404
405
Return a string representation of this Ore module.
405
406
@@ -430,7 +431,7 @@ def _repr_(self):
430
431
s += "over %s %s" % (self .base_ring (), self ._ore ._repr_twist ())
431
432
return s
432
433
433
- def _latex_ (self ):
434
+ def _latex_ (self ) -> str :
434
435
r"""
435
436
Return a LaTeX representation of this Ore module.
436
437
@@ -470,7 +471,7 @@ def _latex_(self):
470
471
s += "}"
471
472
return s
472
473
473
- def _repr_element (self , x ):
474
+ def _repr_element (self , x ) -> str :
474
475
r"""
475
476
Return a string representation of the element `x` in
476
477
this Ore module.
@@ -485,7 +486,7 @@ def _repr_element(self, x):
485
486
"""
486
487
return FreeModuleElement_generic_dense ._repr_ (x )
487
488
488
- def _latex_element (self , x ):
489
+ def _latex_element (self , x ) -> str :
489
490
r"""
490
491
Return a LaTeX representation of the element `x` in
491
492
this Ore module.
@@ -783,7 +784,7 @@ def matrix(self):
783
784
"""
784
785
return self ._pseudohom .matrix ()
785
786
786
- def basis (self ):
787
+ def basis (self ) -> list :
787
788
r"""
788
789
Return the canonical basis of this Ore module.
789
790
@@ -799,14 +800,14 @@ def basis(self):
799
800
zero = self .base_ring ().zero ()
800
801
one = self .base_ring ().one ()
801
802
coeffs = [zero ] * rank
802
- B = [ ]
803
+ B = []
803
804
for i in range (rank ):
804
805
coeffs [i ] = one
805
806
B .append (self (coeffs ))
806
807
coeffs [i ] = zero
807
808
return B
808
809
809
- def gens (self ):
810
+ def gens (self ) -> list :
810
811
r"""
811
812
Return the canonical basis of this Ore module.
812
813
@@ -850,7 +851,7 @@ def gen(self, i):
850
851
coeffs [i ] = one
851
852
return self (coeffs )
852
853
853
- def an_element (self ):
854
+ def _an_element_ (self ):
854
855
r"""
855
856
Return an element of this Ore module.
856
857
@@ -876,8 +877,7 @@ def an_element(self):
876
877
"""
877
878
if self .rank () > 0 :
878
879
return self .gen (0 )
879
- else :
880
- return self .zero ()
880
+ return self .zero ()
881
881
882
882
def random_element (self , * args , ** kwds ):
883
883
r"""
@@ -1237,7 +1237,7 @@ def _span(self, gens):
1237
1237
v = f (v )
1238
1238
v = v .list ()
1239
1239
for j in range (rank ):
1240
- M [i + r ,j ] = v [j ]
1240
+ M [i + r , j ] = v [j ]
1241
1241
M .echelonize ()
1242
1242
oldr = r
1243
1243
r = M .rank ()
@@ -1406,7 +1406,7 @@ def quotient(self, sub, names=None, check=True):
1406
1406
1407
1407
quo = quotient
1408
1408
1409
- def __eq__ (self , other ):
1409
+ def __eq__ (self , other ) -> bool :
1410
1410
r"""
1411
1411
Return ``True`` if this Ore module is the same than ``other``.
1412
1412
@@ -1430,7 +1430,7 @@ def __eq__(self, other):
1430
1430
"""
1431
1431
return self is other
1432
1432
1433
- def __hash__ (self ):
1433
+ def __hash__ (self ) -> int :
1434
1434
r"""
1435
1435
Return a hash of this Ore module.
1436
1436
@@ -1503,7 +1503,7 @@ def __classcall_private__(cls, ambient, gens, names):
1503
1503
names = normalize_names (names , rank )
1504
1504
return cls .__classcall__ (cls , ambient , basis , names )
1505
1505
1506
- def __init__ (self , ambient , basis , names ):
1506
+ def __init__ (self , ambient , basis , names ) -> None :
1507
1507
r"""
1508
1508
Initialize this Ore submodule.
1509
1509
@@ -1541,7 +1541,7 @@ def __init__(self, ambient, basis, names):
1541
1541
self ._inject = coerce .__copy__ ()
1542
1542
self .register_conversion (OreModuleRetraction (ambient , self ))
1543
1543
1544
- def _repr_element (self , x ):
1544
+ def _repr_element (self , x ) -> str :
1545
1545
r"""
1546
1546
Return a string representation of ``x``.
1547
1547
@@ -1559,7 +1559,7 @@ def _repr_element(self, x):
1559
1559
"""
1560
1560
return self ._ambient (x )._repr_ ()
1561
1561
1562
- def _latex_element (self , x ):
1562
+ def _latex_element (self , x ) -> str :
1563
1563
r"""
1564
1564
Return a LaTeX representation of ``x``.
1565
1565
@@ -1850,7 +1850,7 @@ def __classcall_private__(cls, cover, gens, names):
1850
1850
names = normalize_names (names , cover .rank () - rank )
1851
1851
return cls .__classcall__ (cls , cover , basis , names )
1852
1852
1853
- def __init__ (self , cover , basis , names ):
1853
+ def __init__ (self , cover , basis , names ) -> None :
1854
1854
r"""
1855
1855
Initialize this Ore quotient.
1856
1856
@@ -1891,10 +1891,10 @@ def __init__(self, cover, basis, names):
1891
1891
i += 1
1892
1892
else :
1893
1893
indices .append (j )
1894
- coerce [j ,j - i ] = base .one ()
1894
+ coerce [j , j - i ] = base .one ()
1895
1895
for i in range (r ):
1896
1896
for j in range (d - r ):
1897
- coerce [pivots [i ],j ] = - basis [i ,indices [j ]]
1897
+ coerce [pivots [i ], j ] = - basis [i , indices [j ]]
1898
1898
rows = [cover .gen (i ).image () * coerce for i in indices ]
1899
1899
OreModule .__init__ (self , matrix (base , rows ),
1900
1900
cover .ore_ring (action = False ),
@@ -1904,7 +1904,7 @@ def __init__(self, cover, basis, names):
1904
1904
self .register_coercion (coerce )
1905
1905
cover .register_conversion (OreModuleSection (self , cover ))
1906
1906
1907
- def _repr_element (self , x ):
1907
+ def _repr_element (self , x ) -> str :
1908
1908
r"""
1909
1909
Return a string representation of `x`.
1910
1910
@@ -1928,7 +1928,7 @@ def _repr_element(self, x):
1928
1928
coords [indices [i ]] = x [i ]
1929
1929
return M (coords )._repr_ ()
1930
1930
1931
- def _latex_element (self , x ):
1931
+ def _latex_element (self , x ) -> str :
1932
1932
r"""
1933
1933
Return a LaTeX representation of `x`.
1934
1934
0 commit comments