@@ -317,7 +317,7 @@ def ChainComplex(data=None, base_ring=None, grading_group=None,
317317
318318class Chain_class (ModuleElement ):
319319
320- def __init__ (self , parent , vectors , check = True ):
320+ def __init__ (self , parent , vectors , check = True ) -> None :
321321 r"""
322322 A Chain in a Chain Complex.
323323
@@ -370,7 +370,7 @@ def vector(self, degree):
370370 except KeyError :
371371 return self .parent ().free_module (degree ).zero ()
372372
373- def _repr_ (self ):
373+ def _repr_ (self ) -> str :
374374 """
375375 Print representation.
376376
@@ -510,7 +510,7 @@ def vector_art(d):
510510 concatenated += UnicodeArt ([' ... ' ]) + r
511511 return concatenated
512512
513- def is_cycle (self ):
513+ def is_cycle (self ) -> bool :
514514 """
515515 Return whether the chain is a cycle.
516516
@@ -531,7 +531,7 @@ def is_cycle(self):
531531 return False
532532 return True
533533
534- def is_boundary (self ):
534+ def is_boundary (self ) -> bool :
535535 """
536536 Return whether the chain is a boundary.
537537
@@ -607,7 +607,7 @@ def _lmul_(self, scalar):
607607 parent = self .parent ()
608608 return parent .element_class (parent , vectors )
609609
610- def __eq__ (self , other ):
610+ def __eq__ (self , other ) -> bool :
611611 """
612612 Return ``True`` if this chain is equal to ``other``.
613613
@@ -624,7 +624,7 @@ def __eq__(self, other):
624624 return False
625625 return self ._vec == other ._vec
626626
627- def __ne__ (self , other ):
627+ def __ne__ (self , other ) -> bool :
628628 """
629629 Return ``True`` if this chain is not equal to ``other``.
630630
@@ -666,7 +666,8 @@ class ChainComplex_class(Parent):
666666 sage: D
667667 Chain complex with at most 2 nonzero terms over Integer Ring
668668 """
669- def __init__ (self , grading_group , degree_of_differential , base_ring , differentials ):
669+ def __init__ (self , grading_group , degree_of_differential , base_ring ,
670+ differentials ) -> None :
670671 """
671672 Initialize ``self``.
672673
@@ -690,7 +691,8 @@ def __init__(self, grading_group, degree_of_differential, base_ring, differentia
690691 if any (dim + degree_of_differential not in differentials and d .nrows () != 0
691692 for dim , d in differentials .items ()):
692693 raise ValueError ('invalid differentials' )
693- if any (dim - degree_of_differential not in differentials and d .ncols () != 0
694+ if any (dim - degree_of_differential not in differentials
695+ and d .ncols () != 0
694696 for dim , d in differentials .items ()):
695697 raise ValueError ('invalid differentials' )
696698 self ._grading_group = grading_group
@@ -1059,7 +1061,7 @@ def free_module(self, degree=None):
10591061 rank = self .free_module_rank (degree )
10601062 return FreeModule (self .base_ring (), rank )
10611063
1062- def __hash__ (self ):
1064+ def __hash__ (self ) -> int :
10631065 """
10641066 The hash is formed by combining the hashes of.
10651067
@@ -1078,7 +1080,7 @@ def __hash__(self):
10781080 ^ hash (tuple (self .differential ().items ()))
10791081 ^ hash (self .degree_of_differential ()))
10801082
1081- def __eq__ (self , other ):
1083+ def __eq__ (self , other ) -> bool :
10821084 """
10831085 Return ``True`` iff this chain complex is the same as other: that
10841086 is, if the base rings and the matrices of the two are the
@@ -1109,7 +1111,7 @@ def __eq__(self, other):
11091111 equal = equal and mat .ncols () == 0 and mat .nrows () == 0
11101112 return equal
11111113
1112- def __ne__ (self , other ):
1114+ def __ne__ (self , other ) -> bool :
11131115 """
11141116 Return ``True`` iff this chain complex is not the same as other.
11151117
@@ -1607,7 +1609,7 @@ def shift(self, n=1):
16071609 return ChainComplex ({k - shift : sgn * self ._diff [k ] for k in self ._diff },
16081610 degree_of_differential = deg )
16091611
1610- def _repr_ (self ):
1612+ def _repr_ (self ) -> str :
16111613 """
16121614 Print representation.
16131615
@@ -1622,7 +1624,7 @@ def _repr_(self):
16221624 s = 'Trivial chain complex'
16231625 else :
16241626 s = 'Chain complex with at most {0} nonzero terms' .format (len (diffs )- 1 )
1625- s += ' over {0}' . format ( self .base_ring ())
1627+ s += f ' over { self .base_ring ()} '
16261628 return s
16271629
16281630 def _ascii_art_ (self ):
0 commit comments