@@ -568,7 +568,7 @@ def __ne__(self, other):
568
568
"""
569
569
return not self == other
570
570
571
- def __repr__ (self ):
571
+ def __repr__ (self ) -> str :
572
572
r"""
573
573
Return the string representation of the morphism.
574
574
@@ -587,7 +587,7 @@ def __repr__(self):
587
587
"""
588
588
return "WordMorphism: %s" % str (self )
589
589
590
- def __str__ (self ):
590
+ def __str__ (self ) -> str :
591
591
r"""
592
592
Return the morphism in str.
593
593
@@ -625,7 +625,7 @@ def __str__(self):
625
625
for lettre , image in self ._morph .items ()]
626
626
return ', ' .join (sorted (L ))
627
627
628
- def __call__ (self , w , order = 1 , datatype = None ):
628
+ def __call__ (self , w , order = 1 ):
629
629
r"""
630
630
Return the image of ``w`` under self to the given order.
631
631
@@ -635,8 +635,6 @@ def __call__(self, w, order=1, datatype=None):
635
635
636
636
- ``order`` - integer or plus ``Infinity`` (default: 1)
637
637
638
- - ``datatype`` - deprecated
639
-
640
638
OUTPUT:
641
639
642
640
- ``word`` - order-th iterated image under self of ``w``
@@ -752,7 +750,7 @@ def __call__(self, w, order=1, datatype=None):
752
750
sage: m('')
753
751
word:
754
752
755
- The default datatype when the input is a finite word is another
753
+ When the input is a finite word, the output is another
756
754
finite word::
757
755
758
756
sage: w = m('aabb')
@@ -764,49 +762,7 @@ def __call__(self, w, order=1, datatype=None):
764
762
sage: import tempfile
765
763
sage: with tempfile.NamedTemporaryFile(suffix=".sobj") as f:
766
764
....: save(w, filename=f.name)
767
-
768
- The ``datatype`` argument is deprecated::
769
-
770
- sage: m = WordMorphism('a->ab,b->ba')
771
- sage: w = m('aaab',datatype='list')
772
- doctest:warning
773
- ...
774
- DeprecationWarning: the "datatype" argument is deprecated
775
- See https://github.com/sagemath/sage/issues/26307 for details.
776
-
777
- sage: type(w)
778
- <class 'sage.combinat.words.word.FiniteWord_list'>
779
- sage: w = m('aaab',datatype='str')
780
- sage: type(w)
781
- <class 'sage.combinat.words.word.FiniteWord_str'>
782
- sage: w = m('aaab',datatype='tuple')
783
- sage: type(w)
784
- <class 'sage.combinat.words.word.FiniteWord_tuple'>
785
-
786
- To use str datatype for the output word, the domain and codomain
787
- alphabet must consist of str objects::
788
-
789
- sage: m = WordMorphism({0:[0,1],1:[1,0]})
790
- sage: w = m([0],4); type(w)
791
- <class 'sage.combinat.words.word.FiniteWord_char'>
792
- sage: w = m([0],4,datatype='list')
793
- doctest:warning
794
- ...
795
- DeprecationWarning: the "datatype" argument is deprecated
796
- See https://github.com/sagemath/sage/issues/26307 for details.
797
- sage: type(w)
798
- <class 'sage.combinat.words.word.FiniteWord_list'>
799
- sage: w = m([0],4,datatype='str')
800
- Traceback (most recent call last):
801
- ...
802
- ValueError: 0 not in alphabet
803
- sage: w = m([0],4,datatype='tuple'); type(w)
804
- <class 'sage.combinat.words.word.FiniteWord_tuple'>
805
765
"""
806
- if datatype is not None :
807
- from sage .misc .superseded import deprecation
808
- deprecation (26307 , 'the "datatype" argument is deprecated' )
809
-
810
766
if order == 1 :
811
767
D = self .domain ()
812
768
C = self .codomain ()
@@ -817,10 +773,7 @@ def __call__(self, w, order=1, datatype=None):
817
773
im = C ()
818
774
for a in w :
819
775
im += self ._morph [a ]
820
- if datatype is not None :
821
- return C (im , datatype = datatype )
822
- else :
823
- return im
776
+ return im
824
777
825
778
if isinstance (w , Iterable ):
826
779
pass
@@ -853,7 +806,7 @@ def __call__(self, w, order=1, datatype=None):
853
806
return self .fixed_point (letter = letter )
854
807
855
808
elif isinstance (order , (int , Integer )) and order > 1 :
856
- return self (self (w , order - 1 ), datatype = datatype )
809
+ return self (self (w , order - 1 ))
857
810
858
811
elif order == 0 :
859
812
return self ._domain (w )
0 commit comments