Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #21203 review issue 7: proper punctuation, empty lines, etc in d…
Browse files Browse the repository at this point in the history
…ocstrings
  • Loading branch information
dkrenn committed May 6, 2021
1 parent 96c1874 commit 9e82a65
Showing 1 changed file with 13 additions and 36 deletions.
49 changes: 13 additions & 36 deletions src/sage/combinat/k_regular_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,19 @@


class kRegularSequence(RecognizableSeries):

def __init__(self, parent, mu, left=None, right=None):
r"""
A `k`-regular sequence.
INPUT:
- ``parent`` -- an instance of :class:`kRegularSequenceSpace`.
- ``parent`` -- an instance of :class:`kRegularSequenceSpace`
- ``mu`` -- a family of square matrices, all of which have the
same dimension. The indices of this family are `0,...,k-1`.
``mu`` may be a list or tuple of cardinality `k`
as well. See
:meth:`~sage.combinat.recognizable_series.RecognizableSeries.mu`
for more details.
as well. See also
:meth:`~sage.combinat.recognizable_series.RecognizableSeries.mu`.
- ``left`` -- (default: ``None``) a vector.
When evaluating the sequence, this vector is multiplied
Expand All @@ -122,19 +120,6 @@ def __init__(self, parent, mu, left=None, right=None):
from the right to the matrix product. If ``None``, then this
multiplication is skipped.
When created via the parent :class:`kRegularSequenceSpace`, then
the following option is available.
- ``transpose`` -- (default: ``False``) a boolean. If set, then
each of the matrices in
:meth:`mu <sage.combinat.recognizable_series.RecognizableSeries.mu>`
is transposed. Additionally the vectors
:meth:`left <sage.combinat.recognizable_series.RecognizableSeries.left>`
and
:meth:`right <sage.combinat.recognizable_series.RecognizableSeries.right>`
are switched.
(This is done by calling :meth:`~sage.combinat.recognizable_series.RecognizableSeries.transposed`.)
EXAMPLES::
sage: Seq2 = kRegularSequenceSpace(2, ZZ)
Expand All @@ -150,14 +135,13 @@ def __init__(self, parent, mu, left=None, right=None):
super(kRegularSequence, self).__init__(
parent=parent, mu=mu, left=left, right=right)


def _repr_(self):
r"""
Return a representation string of this `k`-regular sequence.
OUTPUT:
A string.
A string
TESTS::
Expand All @@ -174,19 +158,18 @@ def _repr_(self):
opening_delimiter='', closing_delimiter='',
preview=10)


@cached_method
def __getitem__(self, n, **kwds):
r"""
Return the `n`th entry of this sequence.
INPUT:
- ``n`` -- a nonnegative integer.
- ``n`` -- a nonnegative integer
OUTPUT:
An element of the universe of the sequence.
An element of the universe of the sequence
EXAMPLES::
Expand Down Expand Up @@ -219,10 +202,9 @@ def __getitem__(self, n, **kwds):
"""
return self.coefficient_of_word(self.parent()._n_to_index_(n), **kwds)


def __iter__(self):
r"""
Return an iterator.
Return an iterator over the coefficients of this sequence.
EXAMPLES::
Expand Down Expand Up @@ -251,13 +233,13 @@ class kRegularSequenceSpace(RecognizableSeriesSpace):
INPUT:
- ``k`` -- an integer at least `2` specifying the base.
- ``k`` -- an integer at least `2` specifying the base
- ``coefficients`` -- a (semi-)ring. If not specified (``None``),
then the integer ring is used.
- ``category`` -- (default: ``None``) the category of this
space.
space
EXAMPLES::
Expand All @@ -271,10 +253,8 @@ class kRegularSequenceSpace(RecognizableSeriesSpace):
:doc:`k-regular sequence <k_regular_sequence>`,
:class:`kRegularSequence`.
"""

Element = kRegularSequence


@classmethod
def __normalize__(cls, k, coefficients=None, **kwds):
r"""
Expand Down Expand Up @@ -302,14 +282,13 @@ def __normalize__(cls, k, coefficients=None, **kwds):
coefficients, alphabet=srange(k), **kwds)
return (k,) + nargs


def __init__(self, k, *args, **kwds):
r"""
See :class:`kRegularSequenceSpace` for details.
INPUT:
- ``k`` -- an integer at least `2` specifying the base.
- ``k`` -- an integer at least `2` specifying the base
Other input arguments are passed on to
:meth:`~sage.combinat.recognizable_series.RecognizableSeriesSpace.__init__`.
Expand All @@ -329,14 +308,13 @@ def __init__(self, k, *args, **kwds):
self.k = k
super(kRegularSequenceSpace, self).__init__(*args, **kwds)


def _repr_(self):
r"""
Return a representation string of this `k`-regular sequence space.
OUTPUT:
A string.
A string
TESTS::
Expand All @@ -345,19 +323,18 @@ def _repr_(self):
"""
return 'Space of {}-regular sequences over {}'.format(self.k, self.base())


def _n_to_index_(self, n):
r"""
Convert `n` to an index usable by the underlying
recognizable series.
INPUT:
- ``n`` -- a nonnegative integer.
- ``n`` -- a nonnegative integer
OUTPUT:
A word.
A word
TESTS::
Expand Down

0 comments on commit 9e82a65

Please sign in to comment.