Skip to content

Commit 17d2e17

Browse files
author
Release Manager
committed
gh-35421: `WordMorphism`: remove keyword deprecated in #26307 <!-- Please provide a concise, informative and self-explanatory title. --> <!-- Don't put issue numbers in the title. Put it in the Description below. --> <!-- For example, instead of "Fixes #12345", use "Add a new method to multiply two integers" --> ### 📚 Description Remove the deprecated `datatype` argument in word morphisms introduced in #26307 <!-- Describe your changes here in detail. --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x ]`. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [x] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35421 Reported by: Frédéric Chapoton Reviewer(s): Sébastien Labbé, Travis Scrimshaw
2 parents 78c8896 + 3f142c3 commit 17d2e17

File tree

1 file changed

+6
-53
lines changed

1 file changed

+6
-53
lines changed

src/sage/combinat/words/morphism.py

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ def __ne__(self, other):
568568
"""
569569
return not self == other
570570

571-
def __repr__(self):
571+
def __repr__(self) -> str:
572572
r"""
573573
Return the string representation of the morphism.
574574
@@ -587,7 +587,7 @@ def __repr__(self):
587587
"""
588588
return "WordMorphism: %s" % str(self)
589589

590-
def __str__(self):
590+
def __str__(self) -> str:
591591
r"""
592592
Return the morphism in str.
593593
@@ -625,7 +625,7 @@ def __str__(self):
625625
for lettre, image in self._morph.items()]
626626
return ', '.join(sorted(L))
627627

628-
def __call__(self, w, order=1, datatype=None):
628+
def __call__(self, w, order=1):
629629
r"""
630630
Return the image of ``w`` under self to the given order.
631631
@@ -635,8 +635,6 @@ def __call__(self, w, order=1, datatype=None):
635635
636636
- ``order`` - integer or plus ``Infinity`` (default: 1)
637637
638-
- ``datatype`` - deprecated
639-
640638
OUTPUT:
641639
642640
- ``word`` - order-th iterated image under self of ``w``
@@ -752,7 +750,7 @@ def __call__(self, w, order=1, datatype=None):
752750
sage: m('')
753751
word:
754752
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
756754
finite word::
757755
758756
sage: w = m('aabb')
@@ -764,49 +762,7 @@ def __call__(self, w, order=1, datatype=None):
764762
sage: import tempfile
765763
sage: with tempfile.NamedTemporaryFile(suffix=".sobj") as f:
766764
....: 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'>
805765
"""
806-
if datatype is not None:
807-
from sage.misc.superseded import deprecation
808-
deprecation(26307, 'the "datatype" argument is deprecated')
809-
810766
if order == 1:
811767
D = self.domain()
812768
C = self.codomain()
@@ -817,10 +773,7 @@ def __call__(self, w, order=1, datatype=None):
817773
im = C()
818774
for a in w:
819775
im += self._morph[a]
820-
if datatype is not None:
821-
return C(im, datatype=datatype)
822-
else:
823-
return im
776+
return im
824777

825778
if isinstance(w, Iterable):
826779
pass
@@ -853,7 +806,7 @@ def __call__(self, w, order=1, datatype=None):
853806
return self.fixed_point(letter=letter)
854807

855808
elif isinstance(order, (int, Integer)) and order > 1:
856-
return self(self(w, order - 1), datatype=datatype)
809+
return self(self(w, order - 1))
857810

858811
elif order == 0:
859812
return self._domain(w)

0 commit comments

Comments
 (0)