From c9f44924ffea27f8cd05e28824ec864ac100e2fc Mon Sep 17 00:00:00 2001 From: gmou3 Date: Sun, 9 Jun 2024 21:12:44 +0300 Subject: [PATCH] Docstring edits "" to '', remove indefinite articles and trailing dots, one-line outputs, etc. --- src/sage/algebras/commutative_dga.py | 2 +- src/sage/algebras/finite_gca.py | 2 +- .../algebras/fusion_rings/shm_managers.pyx | 2 +- .../affine_lie_conformal_algebra.py | 4 +- .../bosonic_ghosts_lie_conformal_algebra.py | 2 +- .../fermionic_ghosts_lie_conformal_algebra.py | 2 +- .../free_bosons_lie_conformal_algebra.py | 2 +- ..._conformal_algebra_with_structure_coefs.py | 2 +- .../n2_lie_conformal_algebra.py | 2 +- .../neveu_schwarz_lie_conformal_algebra.py | 2 +- .../virasoro_lie_conformal_algebra.py | 2 +- .../weyl_lie_conformal_algebra.py | 10 +- .../algebras/quatalg/quaternion_algebra.py | 6 +- .../algebras/steenrod/steenrod_algebra.py | 4 +- src/sage/arith/functions.pyx | 2 +- src/sage/arith/misc.py | 4 +- src/sage/calculus/desolvers.py | 11 +- src/sage/calculus/interpolators.pyx | 16 +-- src/sage/calculus/riemann.pyx | 4 +- src/sage/calculus/transforms/fft.pyx | 4 +- src/sage/categories/category.py | 2 +- src/sage/categories/category_cy_helper.pyx | 6 +- src/sage/categories/crystals.py | 6 +- .../examples/finite_coxeter_groups.py | 2 +- .../categories/examples/finite_semigroups.py | 2 +- .../categories/examples/finite_weyl_groups.py | 2 +- src/sage/categories/finite_coxeter_groups.py | 14 +-- .../finite_dimensional_algebras_with_basis.py | 4 +- ...ite_dimensional_lie_algebras_with_basis.py | 4 +- .../finite_dimensional_modules_with_basis.py | 18 +-- src/sage/categories/finite_enumerated_sets.py | 6 +- src/sage/categories/finite_monoids.py | 2 +- src/sage/categories/finite_posets.py | 37 +++--- src/sage/categories/finite_semigroups.py | 2 +- .../finitely_generated_semigroups.py | 12 +- src/sage/categories/groups.py | 4 +- src/sage/categories/homset.py | 2 +- src/sage/categories/lie_algebras.py | 4 +- src/sage/categories/lie_groups.py | 2 +- src/sage/categories/manifolds.py | 8 +- src/sage/categories/map.pyx | 2 +- src/sage/categories/modules_with_basis.py | 30 ++--- src/sage/categories/monoids.py | 2 +- src/sage/categories/morphism.pyx | 4 +- src/sage/categories/number_fields.py | 12 +- src/sage/categories/primer.py | 12 +- src/sage/categories/pushout.py | 6 +- src/sage/categories/regular_crystals.py | 6 +- src/sage/categories/rings.py | 14 +-- src/sage/categories/semigroups.py | 48 ++++---- src/sage/categories/sets_cat.py | 4 +- src/sage/categories/sets_with_grading.py | 2 +- src/sage/categories/supercrystals.py | 2 +- .../triangular_kac_moody_algebras.py | 2 +- src/sage/categories/vector_bundles.py | 4 +- src/sage/categories/weyl_groups.py | 18 +-- src/sage/coding/abstract_code.py | 16 +-- src/sage/coding/bch_code.py | 2 +- src/sage/coding/code_bounds.py | 26 ++--- src/sage/coding/code_constructions.py | 4 +- .../coding/codecan/autgroup_can_label.pyx | 10 +- src/sage/coding/codecan/codecan.pyx | 14 +-- src/sage/coding/databases.py | 8 +- src/sage/coding/delsarte_bounds.py | 10 +- src/sage/coding/extended_code.py | 2 +- src/sage/coding/gabidulin_code.py | 2 +- src/sage/coding/guava.py | 8 +- src/sage/coding/guruswami_sudan/gs_decoder.py | 20 ++-- src/sage/coding/guruswami_sudan/utils.py | 13 ++- src/sage/coding/information_set_decoder.py | 42 +++---- src/sage/coding/linear_code.py | 110 +++++++++--------- src/sage/coding/linear_code_no_metric.py | 2 +- src/sage/coding/linear_rank_metric.py | 2 +- src/sage/coding/punctured_code.py | 13 ++- src/sage/coding/reed_muller_code.py | 4 +- src/sage/coding/self_dual_codes.py | 12 +- src/sage/coding/source_coding/huffman.py | 12 +- src/sage/combinat/abstract_tree.py | 2 +- src/sage/combinat/affine_permutation.py | 4 +- src/sage/combinat/bijectionist.py | 22 ++-- src/sage/combinat/binary_tree.py | 26 ++--- src/sage/combinat/chas/fsym.py | 2 +- src/sage/combinat/chas/wqsym.py | 14 +-- src/sage/combinat/cluster_complex.py | 6 +- src/sage/combinat/combinat.py | 74 ++++++------ src/sage/combinat/combinatorial_map.py | 8 +- src/sage/combinat/composition.py | 26 ++--- src/sage/combinat/composition_tableau.py | 19 ++- src/sage/combinat/constellation.py | 27 +++-- src/sage/combinat/core.py | 5 +- .../combinat/cyclic_sieving_phenomenon.py | 4 +- src/sage/combinat/debruijn_sequence.pyx | 18 +-- src/sage/combinat/decorated_permutation.py | 2 +- src/sage/combinat/derangements.py | 2 +- src/sage/combinat/descent_algebra.py | 8 +- src/sage/combinat/diagram.py | 8 +- src/sage/combinat/diagram_algebras.py | 52 ++++----- src/sage/combinat/dyck_word.py | 38 +++--- src/sage/combinat/e_one_star.py | 2 +- src/sage/combinat/fast_vector_partitions.pyx | 26 ++--- .../finite_state_machine_generators.py | 108 ++++++++--------- 101 files changed, 595 insertions(+), 632 deletions(-) diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index 5c4d54d455d..e188c525c24 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -935,7 +935,7 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category= - ``base`` -- the base ring of the algebra - ``names`` -- the names of the variables; by default, set to ``x1``, - ``x2``, etc. + ``x2``, etc - ``degrees`` -- the degrees of the generators; by default, set to 1 diff --git a/src/sage/algebras/finite_gca.py b/src/sage/algebras/finite_gca.py index 148c1eb0db3..c9e5b9012a7 100644 --- a/src/sage/algebras/finite_gca.py +++ b/src/sage/algebras/finite_gca.py @@ -146,7 +146,7 @@ def __classcall_private__(cls, base, names=None, degrees=None, - ``base`` -- the base ring of the algebra - ``max_degree`` -- the maximal degree of the algebra - ``names`` -- the names of the variables; by default, set to ``x1``, - ``x2``, etc. + ``x2``, etc - ``degrees`` -- the degrees of the generators; by default, set to 1 TESTS:: diff --git a/src/sage/algebras/fusion_rings/shm_managers.pyx b/src/sage/algebras/fusion_rings/shm_managers.pyx index f346f211c13..05ae7dc66af 100644 --- a/src/sage/algebras/fusion_rings/shm_managers.pyx +++ b/src/sage/algebras/fusion_rings/shm_managers.pyx @@ -399,7 +399,7 @@ cdef class FvarsHandler: - ``init_data`` -- a dictionary or :class:`FvarsHandler` object containing known squares for initialization, e.g., from a solver checkpoint - ``use_mp`` -- integer indicating the number of child processes - used for multiprocessing; if running serially, use 0. + used for multiprocessing; if running serially, use 0 - ``pids_name`` -- the name of a ``ShareableList`` contaning the process ``pid``'s for every process in the pool (including the parent process) diff --git a/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py index d18817735cd..f4938a11e0c 100644 --- a/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py @@ -43,7 +43,7 @@ class AffineLieConformalAlgebra(GradedLieConformalAlgebra): INPUT: - ``R`` -- a commutative Ring; the base ring for this Lie - conformal algebra. + conformal algebra - ``ct`` -- a ``str`` or a :mod:`CartanType`; the Cartan Type for the corresponding finite dimensional Lie algebra. It must @@ -55,7 +55,7 @@ class AffineLieConformalAlgebra(GradedLieConformalAlgebra): - ``prefix`` -- a ``str``; parameter passed to :class:`IndexedGenerators` - ``bracket`` -- a ``str``; parameter passed to - :class:`IndexedGenerators`. + :class:`IndexedGenerators` EXAMPLES:: diff --git a/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py index 2284fa9e1be..3e66a771ee2 100644 --- a/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py @@ -48,7 +48,7 @@ class BosonicGhostsLieConformalAlgebra(GradedLieConformalAlgebra): - ``names`` -- list of ``str``; alternative names for the generators - ``index_set`` -- an enumerated set; An indexing set for the - generators. + generators OUTPUT: diff --git a/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py index 3a029ec96a5..08888274e45 100644 --- a/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py @@ -45,7 +45,7 @@ class FermionicGhostsLieConformalAlgebra(GradedLieConformalAlgebra): - ``names`` -- a tuple of ``str``; alternative names for the generators - ``index_set`` -- an enumerated set; alternative indexing - set for the generators. + set for the generators OUTPUT: diff --git a/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py index 11073bbd15c..910e3ddc39f 100644 --- a/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py @@ -52,7 +52,7 @@ class FreeBosonsLieConformalAlgebra(GradedLieConformalAlgebra): - ``names`` -- a tuple of ``str``; alternative names for the generators - ``index_set`` -- an enumerated set; alternative indexing set - for the generators. + for the generators OUTPUT: diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py index 18cb2ef0d1b..70d4395e067 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py @@ -122,7 +122,7 @@ def _standardize_s_coeff(s_coeff, index_set, ce, parity=None): INPUT: - ``s_coeff`` -- a dictionary as in - :class:`~sage.algebras.lie_conformal_algebras.lie_conformal_algebra_with_structure_coefficients.LieConformalAlgebraWithStructureCoefficients`. + :class:`~sage.algebras.lie_conformal_algebras.lie_conformal_algebra_with_structure_coefficients.LieConformalAlgebraWithStructureCoefficients` - ``index_set`` -- a finite enumerated set indexing the generators (not counting the central elements). - ``ce`` -- a tuple of ``str``; a list of names for the central diff --git a/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py index baf7a896144..6ff2e256e80 100644 --- a/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py @@ -40,7 +40,7 @@ class N2LieConformalAlgebra(GradedLieConformalAlgebra): INPUT: - ``R`` -- a commutative ring; the base ring of this super - Lie conformal algebra. + Lie conformal algebra EXAMPLES:: diff --git a/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py index 7bf03e30dea..706d062b658 100644 --- a/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py @@ -35,7 +35,7 @@ class NeveuSchwarzLieConformalAlgebra(GradedLieConformalAlgebra): INPUT: - ``R`` -- a commutative Ring; the base ring of this Lie - conformal algebra. + conformal algebra EXAMPLES:: diff --git a/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py index f0867dae808..ce16b4918eb 100644 --- a/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py @@ -36,7 +36,7 @@ class VirasoroLieConformalAlgebra(GradedLieConformalAlgebra): INPUT: - ``R`` -- a commutative ring; behaviour is undefined if `R` is - not a Field of characteristic zero. + not a Field of characteristic zero EXAMPLES:: diff --git a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py index d7c78db0793..be8b5c3e3ef 100644 --- a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py @@ -47,11 +47,11 @@ class WeylLieConformalAlgebra(LieConformalAlgebraWithStructureCoefficients): INPUT: - ``R`` -- a commutative ring; the base ring of this Lie - conformal algebra. - - ``ngens``: an even positive Integer (default: `2`); The number - of non-central generators of this Lie conformal algebra. - - ``gram_matrix``: a matrix (default: ``None``); A non-singular - skew-symmetric square matrix with coefficients in `R`. + conformal algebra + - ``ngens``: an even positive Integer (default: `2`); the number + of non-central generators of this Lie conformal algebra + - ``gram_matrix``: a matrix (default: ``None``); a non-singular + skew-symmetric square matrix with coefficients in `R` - ``names`` -- list or tuple of ``str``; alternative names for the generators - ``index_set`` -- an enumerated set; alternative indexing set diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index 0f220e815f1..ddd7c55483c 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -3704,10 +3704,10 @@ def is_principal(self, certificate=False): INPUT: - - ``certificate`` -- if ``True`` returns a generator alpha s.t. I = alpha*O - where O is the right order of I. + - ``certificate`` -- if ``True`` returns a generator alpha s.t. + `I = \alpha O` where `O` is the right order of `I` - OUTPUT: bool, or (bool, alpha) if ``certificate`` is ``True`` + OUTPUT: boolean, or (boolean, alpha) if ``certificate`` is ``True`` EXAMPLES:: diff --git a/src/sage/algebras/steenrod/steenrod_algebra.py b/src/sage/algebras/steenrod/steenrod_algebra.py index f6b86a90285..011f540959a 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra.py +++ b/src/sage/algebras/steenrod/steenrod_algebra.py @@ -4004,7 +4004,7 @@ def SteenrodAlgebra(p=2, basis='milnor', generic='auto', **kwds): - a function from positive integers to nonnegative integers (and `\infty`), e.g., ``lambda n: n+2``. - ``None`` or ``Infinity`` -- use this for the profile function for - the whole Steenrod algebra. + the whole Steenrod algebra In the first and third cases, ``precision`` is ignored. In the second case, this function is converted to a tuple of length one @@ -4082,7 +4082,7 @@ def SteenrodAlgebra(p=2, basis='milnor', generic='auto', **kwds): 1 if n<3 else 2)``. - ``None`` or ``Infinity`` -- use this for the profile function for - the whole Steenrod algebra. + the whole Steenrod algebra You can also mix and match the first two, passing a pair with first entry a list and second entry a function, for instance. The diff --git a/src/sage/arith/functions.pyx b/src/sage/arith/functions.pyx index 53d25f7ffbf..7cb428c2d0d 100644 --- a/src/sage/arith/functions.pyx +++ b/src/sage/arith/functions.pyx @@ -30,7 +30,7 @@ def lcm(a, b=None): - ``a``, ``b`` -- two elements of a ring with lcm or - - ``a`` -- list, tuple or iterable of elements of a ring with lcm + - ``a`` -- list; tuple or iterable of elements of a ring with lcm OUTPUT: diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py index 4f3b65f06c1..d4d20c2ccf4 100644 --- a/src/sage/arith/misc.py +++ b/src/sage/arith/misc.py @@ -2323,10 +2323,10 @@ def rational_reconstruction(a, m, algorithm='fast'): - ``m`` -- a modulus - - ``algorithm`` -- (default: 'fast') + - ``algorithm`` -- string (default: ``'fast'``s) - ``'fast'`` -- a fast implementation using direct GMP library calls - in Cython. + in Cython OUTPUT: diff --git a/src/sage/calculus/desolvers.py b/src/sage/calculus/desolvers.py index 2301d0aa6d6..2b8d5bf4689 100644 --- a/src/sage/calculus/desolvers.py +++ b/src/sage/calculus/desolvers.py @@ -1510,8 +1510,9 @@ def desolve_odeint(des, ics, times, dvars, ivar=None, compute_jac=False, args=() - ``ivar`` -- independent variable, optional - - ``compute_jac`` -- boolean. If True, the Jacobian of ``des`` is computed and - used during the integration of stiff systems. Default value is False. + - ``compute_jac`` -- boolean (default: ``False``); if ``True``, the + Jacobian of ``des`` is computed and used during the integration of stiff + systems Other Parameters (taken from the documentation of the :func:`~scipy:scipy.integrate.odeint` function from @@ -1694,8 +1695,8 @@ def desolve_mintides(f, ics, initial, final, delta, tolrel=1e-16, tolabs=1e-16): INPUT: - - ``f`` -- symbolic function. Its first argument will be the independent - variable. Its output should be de derivatives of the dependent variables. + - ``f`` -- symbolic function; its first argument will be the independent + variable, . Its output should be de derivatives of the dependent variables. - ``ics`` -- list or tuple with the initial conditions @@ -1783,7 +1784,7 @@ def desolve_tides_mpfr(f, ics, initial, final, delta, tolrel=1e-16, tolabs=1e-16 INPUT: - - ``f`` -- symbolic function. Its first argument will be the independent + - ``f`` -- symbolic function; its first argument will be the independent variable. Its output should be de derivatives of the dependent variables. - ``ics`` -- list or tuple with the initial conditions diff --git a/src/sage/calculus/interpolators.pyx b/src/sage/calculus/interpolators.pyx index d0ef172d1ff..b07de7e3dbc 100644 --- a/src/sage/calculus/interpolators.pyx +++ b/src/sage/calculus/interpolators.pyx @@ -105,8 +105,8 @@ cdef class PSpline: INPUT: - - ``t`` -- double, the parameter value for the parameterized curve, - between 0 and 2*pi. + - ``t`` -- double; the parameter value for the parameterized curve, + between 0 and 2*pi OUTPUT: @@ -138,8 +138,8 @@ cdef class PSpline: INPUT: - - ``t`` -- double, the parameter value for the parameterized curve, - between 0 and 2*pi. + - ``t`` -- double; the parameter value for the parameterized curve, + between 0 and 2*pi OUTPUT: @@ -262,8 +262,8 @@ cdef class CCSpline: INPUT: - - ``t`` -- double, the parameter value for the parameterized curve, - between 0 and 2*pi. + - ``t`` -- double; the parameter value for the parameterized curve, + between 0 and 2*pi OUTPUT: @@ -296,8 +296,8 @@ cdef class CCSpline: INPUT: - - ``t`` -- double, the parameter value for the parameterized curve, - between 0 and 2*pi. + - ``t`` -- double; the parameter value for the parameterized curve, + between 0 and 2*pi OUTPUT: diff --git a/src/sage/calculus/riemann.pyx b/src/sage/calculus/riemann.pyx index 4012b9cf387..9ecd8c4c56c 100644 --- a/src/sage/calculus/riemann.pyx +++ b/src/sage/calculus/riemann.pyx @@ -863,7 +863,7 @@ cdef class Riemann_Map: behavior of the radial lines near the boundaries. - only for simply connected domains - - ``linescale`` -- float between 0 and 1. Shrinks the radial lines + - ``linescale`` -- float between 0 and 1; shrinks the radial lines away from the boundary to reduce erratic behavior. - only for simply connected domains @@ -1435,7 +1435,7 @@ cpdef cauchy_kernel(t, args): - ``z`` -- complex; the point to be mapped - ``n`` -- integer; the number of terms to include - 10 is fairly accurate, 20 is very accurate. + (10 is fairly accurate, 20 is very accurate) - ``part`` -- will return the real ('r'), imaginary ('i') or complex ('c') value of the kernel diff --git a/src/sage/calculus/transforms/fft.pyx b/src/sage/calculus/transforms/fft.pyx index 917f2bc2fec..5b4526ea55a 100644 --- a/src/sage/calculus/transforms/fft.pyx +++ b/src/sage/calculus/transforms/fft.pyx @@ -299,9 +299,9 @@ cdef class FastFourierTransform_complex(FastFourierTransform_base): - ``style`` -- style of the plot, options are ``'rect'`` or ``'polar'`` - ``'rect'`` -- height represents real part, color represents - imaginary part. + imaginary part - ``'polar'`` -- height represents absolute value, color - represents argument. + represents argument - ``xmin`` -- the lower bound of the slice to plot; 0 by default - ``xmax`` -- the upper bound of the slice to plot; ``len(self)`` by default diff --git a/src/sage/categories/category.py b/src/sage/categories/category.py index 8d01059511e..83d69ad73d6 100644 --- a/src/sage/categories/category.py +++ b/src/sage/categories/category.py @@ -2716,7 +2716,7 @@ def _make_named_class(self, name, method_provider, cache=False, **options): ``self`` that provides methods for the new class (in addition to what comes from the super categories) - ``**options`` -- other named options to pass down to - :meth:`Category._make_named_class`. + :meth:`Category._make_named_class` ASSUMPTION: diff --git a/src/sage/categories/category_cy_helper.pyx b/src/sage/categories/category_cy_helper.pyx index 40353b2713f..84a1744273c 100644 --- a/src/sage/categories/category_cy_helper.pyx +++ b/src/sage/categories/category_cy_helper.pyx @@ -122,12 +122,12 @@ cpdef tuple join_as_tuple(tuple categories, tuple axioms, tuple ignore_axioms): INPUT: - - ``categories`` -- tuple of categories to be joined, + - ``categories`` -- tuple of categories to be joined - ``axioms`` -- tuple of strings; the names of some - supplementary axioms. + supplementary axioms - ``ignore_axioms`` -- tuple of pairs ``(cat, axiom)``, such that ``axiom`` will not be applied to ``cat``, should ``cat`` - occur in the algorithm. + occur in the algorithm EXAMPLES:: diff --git a/src/sage/categories/crystals.py b/src/sage/categories/crystals.py index 7ee268bd536..7ff6a8a8296 100644 --- a/src/sage/categories/crystals.py +++ b/src/sage/categories/crystals.py @@ -124,12 +124,12 @@ def example(self, choice='highwt', **kwds): INPUT: - - ``choice`` -- string (default: ``'highwt'``); an be either ``'highwt'`` + - ``choice`` -- string (default: ``'highwt'``); can be either ``'highwt'`` for the highest weight crystal of type A, or ``'naive'`` for an - example of a broken crystal. + example of a broken crystal - ``**kwds`` -- keyword arguments passed onto the constructor for the - chosen crystal. + chosen crystal EXAMPLES:: diff --git a/src/sage/categories/examples/finite_coxeter_groups.py b/src/sage/categories/examples/finite_coxeter_groups.py index 9abf9304929..f8bdaa8f460 100644 --- a/src/sage/categories/examples/finite_coxeter_groups.py +++ b/src/sage/categories/examples/finite_coxeter_groups.py @@ -185,7 +185,7 @@ class Element(ElementWrapper): wrapped_class = tuple __lt__ = ElementWrapper._lt_by_value - def has_right_descent(self, i, positive=False, side="right"): + def has_right_descent(self, i, positive=False, side='right'): r""" Implements :meth:`SemiGroups.ElementMethods.has_right_descent`. diff --git a/src/sage/categories/examples/finite_semigroups.py b/src/sage/categories/examples/finite_semigroups.py index d019e6895e4..f358df27305 100644 --- a/src/sage/categories/examples/finite_semigroups.py +++ b/src/sage/categories/examples/finite_semigroups.py @@ -71,7 +71,7 @@ class LeftRegularBand(UniqueRepresentation, Parent): Now, let us look at the structure of the semigroup:: sage: S = FiniteSemigroups().example(alphabet = ('a','b','c')) - sage: S.cayley_graph(side="left", simple=True).plot() # needs sage.graphs sage.plot + sage: S.cayley_graph(side='left', simple=True).plot() # needs sage.graphs sage.plot Graphics object consisting of 60 graphics primitives sage: S.j_transversal_of_idempotents() # random (arbitrary choice) # needs sage.graphs ['acb', 'ac', 'ab', 'bc', 'a', 'c', 'b'] diff --git a/src/sage/categories/examples/finite_weyl_groups.py b/src/sage/categories/examples/finite_weyl_groups.py index b3321bdb58b..670ade3483a 100644 --- a/src/sage/categories/examples/finite_weyl_groups.py +++ b/src/sage/categories/examples/finite_weyl_groups.py @@ -61,7 +61,7 @@ class SymmetricGroup(UniqueRepresentation, Parent): 24 sage: S.long_element() (3, 2, 1, 0) - sage: S.cayley_graph(side="left").plot() # needs sage.graphs sage.plot + sage: S.cayley_graph(side='left').plot() # needs sage.graphs sage.plot Graphics object consisting of 120 graphics primitives Alternatively, one could have implemented diff --git a/src/sage/categories/finite_coxeter_groups.py b/src/sage/categories/finite_coxeter_groups.py index d79240ef42d..6778f68fda6 100644 --- a/src/sage/categories/finite_coxeter_groups.py +++ b/src/sage/categories/finite_coxeter_groups.py @@ -113,7 +113,7 @@ def long_element(self, index_set=None, as_word=False): - ``index_set`` -- a subset (as a list or iterable) of the nodes of the Dynkin diagram; (default: all of them) - - ``as_word`` -- boolean (default ``False``). If ``True``, then + - ``as_word`` -- boolean (default: ``False``); if ``True``, then return instead a reduced decomposition of the longest element. Should this method be called maximal_element? longest_element? @@ -394,7 +394,7 @@ def codegrees(self): return tuple(d - 2 for d in self.degrees()) @cached_method - def weak_poset(self, side="right", facade=False): + def weak_poset(self, side='right', facade=False): """ INPUT: @@ -479,7 +479,7 @@ def weak_poset(self, side="right", facade=False): from sage.combinat.posets.posets import Poset from sage.combinat.posets.lattices import LatticePoset if side == "twosided": - covers = tuple([u, v] for u in self for v in u.upper_covers(side="left") + u.upper_covers(side="right")) + covers = tuple([u, v] for u in self for v in u.upper_covers(side='left') + u.upper_covers(side='right')) return Poset((self, covers), cover_relations=True, facade=facade) covers = tuple([u, v] for u in self for v in u.upper_covers(side=side)) @@ -499,7 +499,7 @@ def inversion_sequence(self, word): INPUT: - ``word`` -- a word in the indices of the simple - generators of ``self``. + generators of ``self`` EXAMPLES:: @@ -691,7 +691,7 @@ def permutahedron(self, point=None, base_ring=None): INPUT: - ``point`` -- optional, a point given by its coordinates in - the weight basis (default is `(1, 1, 1, \ldots)`) + the weight basis (default: `(1, 1, 1, \ldots)`) - ``base_ring`` -- optional, the base ring of the polytope .. NOTE:: @@ -801,7 +801,7 @@ def coxeter_poset(self): 3 sage: # optional - gap3 - sage: W = CoxeterGroup(['H', 3], implementation="permutation") + sage: W = CoxeterGroup(['H', 3], implementation='permutation') sage: P = W.coxeter_poset() sage: P Finite meet-semilattice containing 363 elements @@ -874,7 +874,7 @@ def coxeter_complex(self): {0: 0, 1: 0, 2: Z} sage: # optional - gap3 - sage: W = CoxeterGroup(['H', 3], implementation="permutation") + sage: W = CoxeterGroup(['H', 3], implementation='permutation') sage: C = W.coxeter_complex() sage: C Simplicial complex with 62 vertices and 120 facets diff --git a/src/sage/categories/finite_dimensional_algebras_with_basis.py b/src/sage/categories/finite_dimensional_algebras_with_basis.py index b34d27b72fd..faff88304f5 100644 --- a/src/sage/categories/finite_dimensional_algebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_algebras_with_basis.py @@ -858,7 +858,7 @@ def isotypic_projective_modules(self, side='left'): An example of a finite dimensional algebra with basis: the path algebra of the Kronecker quiver (containing the arrows a:x->y and b:x->y) over Rational Field - sage: Q = A.isotypic_projective_modules(side="left"); Q + sage: Q = A.isotypic_projective_modules(side='left'); Q [Free module generated by {0} over Rational Field, Free module generated by {0, 1, 2} over Rational Field] sage: [[x.lift() for x in Qi.basis()] @@ -1192,7 +1192,7 @@ def to_matrix(self, base_ring=None, action=operator.mul, side='left'): [0 1 0 0 0 0] [0 0 0 0 0 1] [0 0 0 0 1 0] - sage: a.to_matrix(base_ring=RDF, side="left") + sage: a.to_matrix(base_ring=RDF, side='left') [0.0 0.0 1.0 0.0 0.0 0.0] [0.0 0.0 0.0 0.0 1.0 0.0] [1.0 0.0 0.0 0.0 0.0 0.0] diff --git a/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py b/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py index 3ffd3eeeeeb..30feac64c34 100644 --- a/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py +++ b/src/sage/categories/finite_dimensional_lie_algebras_with_basis.py @@ -2440,12 +2440,12 @@ def faithful_representation(self, algorithm=None): sage: F = H2.faithful_representation(); F Faithful 16 dimensional representation of Heisenberg algebra of rank 2 over Rational Field - sage: M = H2.faithful_representation(algorithm="minimal"); M + sage: M = H2.faithful_representation(algorithm='minimal'); M Minimal faithful representation of Heisenberg algebra of rank 2 over Rational Field sage: M.dimension() 4 - sage: H2.faithful_representation(algorithm="invalid") + sage: H2.faithful_representation(algorithm='invalid') Traceback (most recent call last): ... ValueError: invalid algorithm 'invalid' diff --git a/src/sage/categories/finite_dimensional_modules_with_basis.py b/src/sage/categories/finite_dimensional_modules_with_basis.py index fd91efa6350..4a107de2dff 100644 --- a/src/sage/categories/finite_dimensional_modules_with_basis.py +++ b/src/sage/categories/finite_dimensional_modules_with_basis.py @@ -196,15 +196,15 @@ def annihilator_basis(self, S, action=operator.mul, side='right'): roles of `x` and `y`:: sage: # needs sage.graphs sage.modules - sage: F.annihilator_basis([y], side="left") + sage: F.annihilator_basis([y], side='left') (x, a, b) - sage: F.annihilator_basis([a], side="left") + sage: F.annihilator_basis([a], side='left') (x, a, b) - sage: F.annihilator_basis([b], side="left") + sage: F.annihilator_basis([b], side='left') (x, a, b) - sage: F.annihilator_basis([x], side="left") + sage: F.annihilator_basis([x], side='left') (y,) - sage: F.annihilator_basis([a + 3*b + 2*x], side="left") + sage: F.annihilator_basis([a + 3*b + 2*x], side='left') (-1/2*a - 3/2*b + y,) By specifying an inner product, this method can be used to @@ -323,7 +323,7 @@ def echelon_form(self, elements, row_reduced=False, order=None): EXAMPLES:: sage: # needs sage.modules - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x") + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x') sage: x = X.basis() sage: V = X.echelon_form([x[0]-x[1], x[0]-x[2], x[1]-x[2]]); V [x[0] - x[2], x[1] - x[2]] @@ -392,7 +392,7 @@ def echelon_form(self, elements, row_reduced=False, order=None): return ret def invariant_module(self, S, action=operator.mul, action_on_basis=None, - side="left", **kwargs): + side='left', **kwargs): r""" Return the submodule of ``self`` invariant under the action of ``S``. @@ -570,7 +570,7 @@ def _vector_(self, order=None): coerce=True, copy=False) class MorphismMethods: - def matrix(self, base_ring=None, side="left"): + def matrix(self, base_ring=None, side='left'): r""" Return the matrix of this morphism in the distinguished bases of the domain and codomain. @@ -603,7 +603,7 @@ def matrix(self, base_ring=None, side="left"): sage: phi.matrix() [1 2] [3 5] - sage: phi.matrix(side="right") + sage: phi.matrix(side='right') [1 3] [2 5] diff --git a/src/sage/categories/finite_enumerated_sets.py b/src/sage/categories/finite_enumerated_sets.py index 82db418c52a..678a03f1e81 100644 --- a/src/sage/categories/finite_enumerated_sets.py +++ b/src/sage/categories/finite_enumerated_sets.py @@ -678,12 +678,12 @@ def rank(self, x): def unrank(self, i): r""" - Return the ``i``-th element of this Cartesian product. + Return the `i`-th element of this Cartesian product. INPUT: - - ``i`` -- integer between ``0`` and ``n-1`` where - ``n`` is the cardinality of this set. + - ``i`` -- integer between `0` and `n-1` where + `n` is the cardinality of this set .. SEEALSO:: diff --git a/src/sage/categories/finite_monoids.py b/src/sage/categories/finite_monoids.py index f4211d81bd2..26d960a8313 100644 --- a/src/sage/categories/finite_monoids.py +++ b/src/sage/categories/finite_monoids.py @@ -186,7 +186,7 @@ def rhodes_radical_congruence(self, base_ring=None): sage: # needs sage.combinat sage.groups sage.modules sage: from sage.monoids.hecke_monoid import HeckeMonoid sage: H3 = HeckeMonoid(SymmetricGroup(3)) - sage: H3.repr_element_method(style="reduced") + sage: H3.repr_element_method(style='reduced') sage: H3.rhodes_radical_congruence() [([1, 2], [2, 1]), ([1, 2], [1, 2, 1]), ([2, 1], [1, 2, 1])] diff --git a/src/sage/categories/finite_posets.py b/src/sage/categories/finite_posets.py index d934265a2c6..ba20c6cfd82 100644 --- a/src/sage/categories/finite_posets.py +++ b/src/sage/categories/finite_posets.py @@ -406,13 +406,13 @@ def order_ideal_complement_generators(self, antichain, direction='up'): sage: P.order_ideal_complement_generators([1,2,3]) set() - sage: P.order_ideal_complement_generators([1], direction="down") + sage: P.order_ideal_complement_generators([1], direction='down') {2} - sage: P.order_ideal_complement_generators([3], direction="down") + sage: P.order_ideal_complement_generators([3], direction='down') {1, 2} - sage: P.order_ideal_complement_generators([1,2], direction="down") + sage: P.order_ideal_complement_generators([1,2], direction='down') set() - sage: P.order_ideal_complement_generators([1,2,3], direction="down") + sage: P.order_ideal_complement_generators([1,2,3], direction='down') set() .. WARNING:: @@ -664,7 +664,7 @@ def birational_free_labelling(self, linear_extension=None, [(1, x1), (2, x3), (3, x2)] sage: l = P.birational_free_labelling(linear_extension=[1, 3, 2], - ....: prefix="wut", reduced=True, + ....: prefix='wut', reduced=True, ....: addvars="spam, eggs"); l (Fraction Field of Multivariate Polynomial Ring in wut1, wut2, wut3, spam, eggs over Rational Field, @@ -701,7 +701,7 @@ def birational_free_labelling(self, linear_extension=None, sage: P = posets.ChainPoset(2).product(posets.ChainPoset(2)) # needs sage.modules sage: l = P.birational_free_labelling(labels=x_label, - ....: min_label="lambda", max_label="mu") + ....: min_label='lambda', max_label='mu') sage: sorted(l[1].items()) [((0, 0), x_00), ((0, 1), x_01), ((1, 0), x_10), ((1, 1), x_11)] sage: l[2] @@ -745,7 +745,7 @@ def birational_free_labelling(self, linear_extension=None, sage: P = posets.SSTPoset([2,1]) sage: lext = sorted(P) sage: l = P.birational_free_labelling(linear_extension=lext, - ....: addvars="ohai"); l + ....: addvars='ohai'); l (Fraction Field of Multivariate Polynomial Ring in a, x1, x2, x3, x4, x5, x6, x7, x8, b, ohai over Rational Field, {...}, @@ -771,7 +771,7 @@ def birational_free_labelling(self, linear_extension=None, Finite lattice containing 6 elements sage: lex = [(1,0),(0,0),(1,1),(0,1),(1,2),(0,2)] sage: l = P.birational_free_labelling(linear_extension=lex, - ....: prefix="u", reduced=True) + ....: prefix='u', reduced=True) sage: l (Fraction Field of Multivariate Polynomial Ring in u1, u2, u3, u4, u5, u6 over Rational Field, {...}, @@ -788,7 +788,7 @@ def birational_free_labelling(self, linear_extension=None, For comparison, the standard linear extension:: sage: # needs sage.modules - sage: l = P.birational_free_labelling(prefix="u", reduced=True); l + sage: l = P.birational_free_labelling(prefix='u', reduced=True); l (Fraction Field of Multivariate Polynomial Ring in u1, u2, u3, u4, u5, u6 over Rational Field, {...}, 1, @@ -808,7 +808,7 @@ def birational_free_labelling(self, linear_extension=None, sage: # needs sage.modules sage: lex = [(0,0),(0,1),(1,0),(1,1),(0,2),(1,2)] sage: l = P.birational_free_labelling(linear_extension=P.linear_extension(lex), - ....: prefix="u", reduced=True) + ....: prefix='u', reduced=True) sage: l (Fraction Field of Multivariate Polynomial Ring in u1, u2, u3, u4, u5, u6 over Rational Field, {...}, @@ -855,12 +855,12 @@ def birational_free_labelling(self, linear_extension=None, {}, 1, 1) - sage: P.birational_free_labelling(prefix="zzz") + sage: P.birational_free_labelling(prefix='zzz') (Fraction Field of Multivariate Polynomial Ring in a, b over Rational Field, {}, a, b) - sage: P.birational_free_labelling(labels="x,y,z", min_label="spam", max_label="eggs") + sage: P.birational_free_labelling(labels='x,y,z', min_label='spam', max_label='eggs') (Fraction Field of Multivariate Polynomial Ring in spam, eggs over Rational Field, {}, spam, @@ -1590,12 +1590,11 @@ def panyushev_orbit_iter(self, antichain, element_constructor=set, INPUT: - ``antichain`` -- an antichain of ``self``, given as an - iterable. + iterable - - ``element_constructor`` (defaults to ``set``) -- a type - constructor (``set``, ``tuple``, ``list``, ``frozenset``, - ``iter``, etc.) which is to be applied to the antichains - before they are yielded. + - ``element_constructor`` -- a type constructor (default: ``set``). + Can be ``set``, ``tuple``, ``list``, ``frozenset``, ``iter``, + etc. To be applied to the antichains before they are yielded. - ``stop`` -- boolean (default: ``True``); whether the iterator should stop once it completes its cycle (this happens when it is @@ -1679,7 +1678,7 @@ def rowmotion_orbit_iter(self, oideal, element_constructor=set, stop=True, check INPUT: - ``oideal`` -- an order ideal of ``self``, given as an - iterable. + iterable - ``element_constructor`` (defaults to ``set``) -- a type constructor (``set``, ``tuple``, ``list``, ``frozenset``, @@ -1788,7 +1787,7 @@ def toggling_orbit_iter(self, vs, oideal, element_constructor=set, stop=True, ch not be used as ``vs``). - ``oideal`` -- an order ideal of ``self``, given as an - iterable. + iterable - ``element_constructor`` (defaults to ``set``) -- a type constructor (``set``, ``tuple``, ``list``, ``frozenset``, diff --git a/src/sage/categories/finite_semigroups.py b/src/sage/categories/finite_semigroups.py index 266cfba3a63..3c126dacc46 100644 --- a/src/sage/categories/finite_semigroups.py +++ b/src/sage/categories/finite_semigroups.py @@ -92,7 +92,7 @@ def j_classes(self): [['a'], ['ab', 'ba'], ['abc', 'acb', 'bac', 'bca', 'cab', 'cba'], ['ac', 'ca'], ['b'], ['bc', 'cb'], ['c']] """ - return self.cayley_graph(side="twosided", simple=True).strongly_connected_components() + return self.cayley_graph(side='twosided', simple=True).strongly_connected_components() @cached_method def j_classes_of_idempotents(self): diff --git a/src/sage/categories/finitely_generated_semigroups.py b/src/sage/categories/finitely_generated_semigroups.py index 322a3630ddc..58c3363ea0d 100644 --- a/src/sage/categories/finitely_generated_semigroups.py +++ b/src/sage/categories/finitely_generated_semigroups.py @@ -93,7 +93,7 @@ def semigroup_generators(self): # TODO: update transitive ideal - def succ_generators(self, side="twosided"): + def succ_generators(self, side='twosided'): r""" Return the successor function of the ``side``-sided Cayley graph of ``self``. @@ -146,10 +146,10 @@ def __iter__(self): """ from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet return iter(RecursivelyEnumeratedSet(self.semigroup_generators(), - self.succ_generators(side="right"), + self.succ_generators(side='right'), enumeration='breadth')) - def ideal(self, gens, side="twosided"): + def ideal(self, gens, side='twosided'): r""" Return the ``side``-sided ideal generated by ``gens``. @@ -167,15 +167,15 @@ def ideal(self, gens, side="twosided"): EXAMPLES:: sage: S = FiniteSemigroups().example() - sage: sorted(S.ideal([S('cab')], side="left")) + sage: sorted(S.ideal([S('cab')], side='left')) ['abc', 'abcd', 'abdc', 'acb', 'acbd', 'acdb', 'adbc', 'adcb', 'bac', 'bacd', 'badc', 'bca', 'bcad', 'bcda', 'bdac', 'bdca', 'cab', 'cabd', 'cadb', 'cba', 'cbad', 'cbda', 'cdab', 'cdba', 'dabc', 'dacb', 'dbac', 'dbca', 'dcab', 'dcba'] - sage: list(S.ideal([S('cab')], side="right")) + sage: list(S.ideal([S('cab')], side='right')) ['cab', 'cabd'] - sage: sorted(S.ideal([S('cab')], side="twosided")) + sage: sorted(S.ideal([S('cab')], side='twosided')) ['abc', 'abcd', 'abdc', 'acb', 'acbd', 'acdb', 'adbc', 'adcb', 'bac', 'bacd', 'badc', 'bca', 'bcad', 'bcda', 'bdac', 'bdca', 'cab', 'cabd', 'cadb', 'cba', 'cbad', diff --git a/src/sage/categories/groups.py b/src/sage/categories/groups.py index 2ed6590887a..416487ed7b0 100644 --- a/src/sage/categories/groups.py +++ b/src/sage/categories/groups.py @@ -225,7 +225,7 @@ def cayley_table(self, names='letters', elements=None): * a list - a list of strings, where the length of the list equals the number of elements. - - ``elements`` -- (default = ``None``); A list of + - ``elements`` -- (default: ``None``); A list of elements of the group, in forms that can be coerced into the structure, eg. their string representations. This may be used to impose an @@ -627,7 +627,7 @@ def lift(i, gen): gens_prod = cartesian_product([Family(G.group_generators(), lambda g: (i, g)) for i, G in enumerate(F)]) - return Family(gens_prod, lift, name="gen") + return Family(gens_prod, lift, name='gen') def order(self): r""" diff --git a/src/sage/categories/homset.py b/src/sage/categories/homset.py index 38164e576d3..ad0d96ea9e8 100644 --- a/src/sage/categories/homset.py +++ b/src/sage/categories/homset.py @@ -929,7 +929,7 @@ def _element_constructor_(self, x, check=None, **options): Set of Morphisms from Free Group on generators {x, y, z} to Free Group on generators {x, y, z} in Category of infinite groups sage: HH = Hom(H, H) - sage: HH(HH.identity(), foo="bar") + sage: HH(HH.identity(), foo='bar') Traceback (most recent call last): ... NotImplementedError: no keywords are implemented for diff --git a/src/sage/categories/lie_algebras.py b/src/sage/categories/lie_algebras.py index f719f165bdb..8e7a1be3e40 100644 --- a/src/sage/categories/lie_algebras.py +++ b/src/sage/categories/lie_algebras.py @@ -864,7 +864,7 @@ def _test_distributivity(self, **options): By default, this method runs the tests only on the elements returned by ``self.some_elements()``:: - sage: L = LieAlgebra(QQ, 3, 'x,y,z', representation="polynomial") # needs sage.combinat sage.modules + sage: L = LieAlgebra(QQ, 3, 'x,y,z', representation='polynomial') # needs sage.combinat sage.modules sage: L.some_elements() # needs sage.combinat sage.modules [x + y + z] sage: L._test_distributivity() # needs sage.combinat sage.modules @@ -1043,7 +1043,7 @@ def __init__(self, domain, codomain): We skip the category test since this is currently not an element of a homspace:: - sage: TestSuite(f).run(skip="_test_category") # needs sage.combinat sage.libs.singular sage.modules + sage: TestSuite(f).run(skip='_test_category') # needs sage.combinat sage.libs.singular sage.modules """ Morphism.__init__(self, Hom(domain, codomain)) diff --git a/src/sage/categories/lie_groups.py b/src/sage/categories/lie_groups.py index 1512a599e04..792b87bad39 100644 --- a/src/sage/categories/lie_groups.py +++ b/src/sage/categories/lie_groups.py @@ -30,7 +30,7 @@ class LieGroups(Category_over_base_ring): TESTS:: - sage: TestSuite(C).run(skip="_test_category_over_bases") + sage: TestSuite(C).run(skip='_test_category_over_bases') """ @cached_method def super_categories(self): diff --git a/src/sage/categories/manifolds.py b/src/sage/categories/manifolds.py index 22138cca200..95e4dd928d9 100644 --- a/src/sage/categories/manifolds.py +++ b/src/sage/categories/manifolds.py @@ -36,7 +36,7 @@ class Manifolds(Category_over_base_ring): TESTS:: - sage: TestSuite(C).run(skip="_test_category_over_bases") # needs sage.rings.real_mpfr + sage: TestSuite(C).run(skip='_test_category_over_bases') # needs sage.rings.real_mpfr """ def __init__(self, base, name=None): r""" @@ -46,7 +46,7 @@ def __init__(self, base, name=None): sage: from sage.categories.manifolds import Manifolds sage: C = Manifolds(RR) - sage: TestSuite(C).run(skip="_test_category_over_bases") + sage: TestSuite(C).run(skip='_test_category_over_bases') """ if base not in Fields().Topological(): raise ValueError("base must be a topological field") @@ -318,7 +318,7 @@ class FiniteDimensional(CategoryWithAxiom_over_base_ring): sage: from sage.categories.manifolds import Manifolds sage: C = Manifolds(RR).FiniteDimensional() - sage: TestSuite(C).run(skip="_test_category_over_bases") + sage: TestSuite(C).run(skip='_test_category_over_bases') """ class Connected(CategoryWithAxiom_over_base_ring): @@ -329,7 +329,7 @@ class Connected(CategoryWithAxiom_over_base_ring): sage: from sage.categories.manifolds import Manifolds sage: C = Manifolds(RR).Connected() - sage: TestSuite(C).run(skip="_test_category_over_bases") + sage: TestSuite(C).run(skip='_test_category_over_bases') """ diff --git a/src/sage/categories/map.pyx b/src/sage/categories/map.pyx index 2c5f597e514..5052096059c 100644 --- a/src/sage/categories/map.pyx +++ b/src/sage/categories/map.pyx @@ -509,7 +509,7 @@ cdef class Map(Element): .. NOTE:: - By default, the string ``"Generic"`` is returned. Subclasses may overload this method. + By default, the string ``'Generic'`` is returned. Subclasses may overload this method. EXAMPLES:: diff --git a/src/sage/categories/modules_with_basis.py b/src/sage/categories/modules_with_basis.py index 1ecf4aedbf9..24848a51aa0 100644 --- a/src/sage/categories/modules_with_basis.py +++ b/src/sage/categories/modules_with_basis.py @@ -268,21 +268,21 @@ def module_morphism(self, on_basis=None, matrix=None, function=None, positional argument is used as the input of the function `f` (default: 0); this is currently only used with ``on_basis``. - - ``triangular`` -- (default: ``None``) ``"upper"`` or - ``"lower"`` or ``None``: + - ``triangular`` -- (default: ``None``) ``'upper'`` or + ``'lower'`` or ``None``: - * ``"upper"`` -- if the + * ``'upper'`` -- if the :meth:`~ModulesWithBasis.ElementMethods.leading_support` of the image of the basis vector `x_i` is `i`, or - * ``"lower"`` -- if the + * ``'lower'`` -- if the :meth:`~ModulesWithBasis.ElementMethods.trailing_support` of the image of the basis vector `x_i` is `i`. - ``unitriangular`` -- boolean (default: ``False``); Only meaningful for a triangular morphism. As a shorthand, one may use ``unitriangular="lower"`` - for ``triangular="lower", unitriangular=True``. + for ``triangular='lower', unitriangular=True``. - ``side`` -- "left" or "right" (default: "left") Only meaningful for a morphism built from a matrix. @@ -476,7 +476,7 @@ def module_morphism(self, on_basis=None, matrix=None, function=None, sage: X = CombinatorialFreeModule(QQ, I); X.rename("X"); x = X.basis() sage: Y = CombinatorialFreeModule(QQ, I); Y.rename("Y"); y = Y.basis() sage: f = Y.sum_of_monomials * divisors - sage: phi = X.module_morphism(f, triangular="upper", codomain=Y) + sage: phi = X.module_morphism(f, triangular='upper', codomain=Y) sage: phi(x[2]) B[1] + B[2] sage: phi(x[6]) @@ -500,7 +500,7 @@ def module_morphism(self, on_basis=None, matrix=None, function=None, sage: from sage.modules.with_basis.morphism import TriangularModuleMorphismFromFunction sage: def f(x): return x + X.term(0, sum(x.coefficients())) sage: phi = X.module_morphism(function=f, codomain=X, - ....: triangular="upper") + ....: triangular='upper') sage: phi(x[2] + 3*x[4]) 4*B[0] + B[2] + 3*B[4] sage: phi.preimage(_) @@ -779,7 +779,7 @@ def submodule(self, gens, check=True, already_echelonized=False, `y_1 - x_1 - x_2`, and its basis elements are indexed by `0` and `1`:: sage: # needs sage.modules - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x") + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x') sage: x = X.basis() sage: gens = [x[0] - x[1], x[1] - x[2]]; gens [x[0] - x[1], x[1] - x[2]] @@ -802,7 +802,7 @@ def submodule(self, gens, check=True, already_echelonized=False, submodule whose index set coincides with the index set of the family:: sage: # needs sage.modules - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x") + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x') sage: x = X.basis() sage: gens = Family({1: x[0] - x[1], 3: x[1] - x[2]}); gens Finite family {1: x[0] - x[1], 3: x[1] - x[2]} @@ -827,7 +827,7 @@ def submodule(self, gens, check=True, already_echelonized=False, a basis (an explicit basis will be computed):: sage: # needs sage.modules - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x") + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x') sage: x = X.basis() sage: gens = [x[0] - x[1], 2*x[1] - 2*x[2], x[0] - x[2]]; gens [x[0] - x[1], 2*x[1] - 2*x[2], x[0] - x[2]] @@ -942,7 +942,7 @@ def quotient_module(self, submodule, check=True, already_echelonized=False, cate EXAMPLES:: sage: # needs sage.modules - sage: X = CombinatorialFreeModule(QQ, range(3), prefix="x") + sage: X = CombinatorialFreeModule(QQ, range(3), prefix='x') sage: x = X.basis() sage: Y = X.quotient_module([x[0] - x[1], x[1] - x[2]], ....: already_echelonized=True) @@ -2351,7 +2351,7 @@ def __call_on_basis__(self, **options): sage: # needs sage.modules sage: X = CombinatorialFreeModule(QQ, [1,2,3,4]); X.rename("X") sage: Y = CombinatorialFreeModule(QQ, [1,2,3,4], - ....: key="Y"); Y.rename("Y") + ....: key='Y'); Y.rename("Y") sage: H = Hom(X, Y) sage: x = X.basis() sage: phi = H(diagonal=lambda x: x^2) @@ -2531,9 +2531,9 @@ def apply_multilinear_morphism(self, f, codomain=None): examples, with two modules `A` and `B`:: sage: # needs sage.modules - sage: A = CombinatorialFreeModule(ZZ, [1,2], prefix="A") + sage: A = CombinatorialFreeModule(ZZ, [1,2], prefix='A') sage: A.rename("A") - sage: B = CombinatorialFreeModule(ZZ, [3,4], prefix="B") + sage: B = CombinatorialFreeModule(ZZ, [3,4], prefix='B') sage: B.rename("B") and `f` the bilinear morphism `(a,b) \mapsto b \otimes a` @@ -2584,7 +2584,7 @@ def apply_multilinear_morphism(self, f, codomain=None): module with basis with a different base ring:: sage: # needs sage.modules - sage: C = CombinatorialFreeModule(QQ, [(1,3),(2,4)], prefix="C") + sage: C = CombinatorialFreeModule(QQ, [(1,3),(2,4)], prefix='C') sage: C.rename("C") sage: def f(a, b): ....: return C.sum_of_terms([((1,3), QQ(a[1]*b[3])), diff --git a/src/sage/categories/monoids.py b/src/sage/categories/monoids.py index 9269c1b1a61..1fbecf0bcc9 100644 --- a/src/sage/categories/monoids.py +++ b/src/sage/categories/monoids.py @@ -677,7 +677,7 @@ def lift(i, gen): gens_prod = cartesian_product([Family(M.monoid_generators(), lambda g: (i, g)) for i, M in enumerate(F)]) - return Family(gens_prod, lift, name="gen") + return Family(gens_prod, lift, name='gen') class ElementMethods: def multiplicative_order(self): diff --git a/src/sage/categories/morphism.pyx b/src/sage/categories/morphism.pyx index 90e816c04c8..f44f9b08a31 100644 --- a/src/sage/categories/morphism.pyx +++ b/src/sage/categories/morphism.pyx @@ -575,7 +575,7 @@ cdef class SetMorphism(Morphism): - ``parent`` -- a Homset - ``function`` -- a Python function that takes elements - of the domain as input and returns elements of the codomain. + of the domain as input and returns elements of the codomain EXAMPLES:: @@ -751,7 +751,7 @@ cdef class SetIsomorphism(SetMorphism): - ``parent`` -- a Homset - ``function`` -- a Python function that takes elements - of the domain as input and returns elements of the codomain. + of the domain as input and returns elements of the codomain EXAMPLES:: diff --git a/src/sage/categories/number_fields.py b/src/sage/categories/number_fields.py index 7054ff83043..09b549d0012 100644 --- a/src/sage/categories/number_fields.py +++ b/src/sage/categories/number_fields.py @@ -134,13 +134,13 @@ def zeta_function(self, prec=53, INPUT: - - ``prec`` -- optional integer (default 53) bits precision + - ``prec`` -- integer (default: 53); bits of precision - - ``max_imaginary_part`` -- optional real number (default 0) + - ``max_imaginary_part`` -- real (default: 0) - - ``max_asymp_coeffs`` -- optional integer (default 40) + - ``max_asymp_coeffs`` -- integer (default: 40) - - ``algorithm`` -- optional (default "pari") either "gp" or "pari" + - ``algorithm`` -- (default: "pari") either "gp" or "pari" OUTPUT: the zeta function of this number field @@ -168,13 +168,13 @@ def zeta_function(self, prec=53, Using the algorithm "pari":: sage: K. = NumberField(ZZ['x'].0^2 + ZZ['x'].0 - 1) # needs sage.rings.number_field - sage: Z = K.zeta_function(algorithm="pari") # needs sage.rings.number_field sage.symbolic + sage: Z = K.zeta_function(algorithm='pari') # needs sage.rings.number_field sage.symbolic sage: Z(-1) # needs sage.rings.number_field sage.symbolic 0.0333333333333333 sage: x = polygen(QQ, 'x') sage: L. = NumberField([x^2 - 5, x^2 + 3, x^2 + 1]) # needs sage.rings.number_field - sage: Z = L.zeta_function(algorithm="pari") # needs sage.rings.number_field sage.symbolic + sage: Z = L.zeta_function(algorithm='pari') # needs sage.rings.number_field sage.symbolic sage: Z(5) # needs sage.rings.number_field sage.symbolic 1.00199015670185 diff --git a/src/sage/categories/primer.py b/src/sage/categories/primer.py index 157f17814de..0dc22ad5dd7 100644 --- a/src/sage/categories/primer.py +++ b/src/sage/categories/primer.py @@ -193,7 +193,7 @@ Those can be viewed graphically:: sage: g = Groups().category_graph() # needs sage.graphs - sage: g.set_latex_options(format="dot2tex") # needs sage.graphs sage.modules sage.plot + sage: g.set_latex_options(format='dot2tex') # needs sage.graphs sage.modules sage.plot sage: view(g) # not tested # needs sage.graphs sage.modules sage.plot In case ``dot2tex`` is not available, you can use instead:: @@ -203,7 +203,7 @@ Here is an overview of all categories in Sage:: sage: g = sage.categories.category.category_graph() # needs sage.graphs sage.groups sage.modules - sage: g.set_latex_options(format="dot2tex") # needs sage.graphs sage.modules sage.plot + sage: g.set_latex_options(format='dot2tex') # needs sage.graphs sage.modules sage.plot sage: view(g) # not tested # needs sage.graphs sage.modules sage.plot Wrap-up: generic algorithms in Sage are organized in a hierarchy of @@ -379,7 +379,7 @@ Category of objects] sage: g = EuclideanDomains().category_graph() # needs sage.graphs - sage: g.set_latex_options(format="dot2tex") # needs sage.graphs sage.plot + sage: g.set_latex_options(format='dot2tex') # needs sage.graphs sage.plot sage: view(g) # not tested # needs sage.graphs sage.plot A bit of help from computer science @@ -498,7 +498,7 @@ class implements: The full hierarchy is best viewed graphically:: sage: g = class_graph(m.__class__) # needs sage.combinat sage.graphs - sage: g.set_latex_options(format="dot2tex") # needs sage.combinat sage.graphs sage.plot + sage: g.set_latex_options(format='dot2tex') # needs sage.combinat sage.graphs sage.plot sage: view(g) # not tested # needs sage.combinat sage.graphs sage.plot Parallel hierarchy of classes for parents @@ -554,7 +554,7 @@ class implements: sage: # needs sage.combinat sage.graphs sage.modules sage.plot sage: g = class_graph(m.__class__) sage: g.relabel(lambda x: x.replace("_",r"\_")) - sage: g.set_latex_options(format="dot2tex") + sage: g.set_latex_options(format='dot2tex') sage: view(g) # not tested .. NOTE:: @@ -1405,7 +1405,7 @@ class naming and introspection. Sage currently works around the or for more advanced categories:: sage: g = HopfAlgebras(QQ).WithBasis().Graded().Connected().category_graph() # needs sage.graphs - sage: g.set_latex_options(format="dot2tex") # needs sage.graphs sage.plot + sage: g.set_latex_options(format='dot2tex') # needs sage.graphs sage.plot sage: view(g) # not tested # needs sage.graphs sage.plot Difference between axioms and regressive covariant functorial constructions diff --git a/src/sage/categories/pushout.py b/src/sage/categories/pushout.py index a6141243808..3c4650efbb6 100644 --- a/src/sage/categories/pushout.py +++ b/src/sage/categories/pushout.py @@ -356,7 +356,7 @@ def common_base(self, other_functor, self_bases, other_bases): - ``self_bases`` -- the arguments passed to this functor - ``other_bases`` -- the arguments passed to the functor - ``other_functor``. + ``other_functor`` OUTPUT: @@ -394,7 +394,7 @@ def _raise_common_base_exception_(self, other_functor, - ``self_bases`` -- the arguments passed to this functor - ``other_bases`` -- the arguments passed to the functor - ``other_functor``. + ``other_functor`` - ``reason`` -- a string or ``None`` (default). @@ -764,7 +764,7 @@ def common_base(self, other_functor, self_bases, other_bases): - ``self_bases`` -- the arguments passed to this functor - ``other_bases`` -- the arguments passed to the functor - ``other_functor``. + ``other_functor`` OUTPUT: a parent diff --git a/src/sage/categories/regular_crystals.py b/src/sage/categories/regular_crystals.py index 91aa9283a45..22561eafcc4 100644 --- a/src/sage/categories/regular_crystals.py +++ b/src/sage/categories/regular_crystals.py @@ -449,10 +449,10 @@ def wt_zero(x): if checker(y): edges.append([x, y, i]) from sage.graphs.digraph import DiGraph - G = DiGraph([X, edges], format="vertices_and_edges", immutable=True) + G = DiGraph([X, edges], format='vertices_and_edges', immutable=True) from sage.graphs.dot2tex_utils import have_dot2tex if have_dot2tex(): - G.set_latex_options(format="dot2tex", edge_labels=True, + G.set_latex_options(format='dot2tex', edge_labels=True, color_by_label=self.cartan_type()._index_set_coloring) return G @@ -878,7 +878,7 @@ def dual_equivalence_class(self, index_set=None): immutable=True, multiedges=True) from sage.graphs.dot2tex_utils import have_dot2tex if have_dot2tex(): - G.set_latex_options(format="dot2tex", edge_labels=True, + G.set_latex_options(format='dot2tex', edge_labels=True, color_by_label=self.cartan_type()._index_set_coloring) return G diff --git a/src/sage/categories/rings.py b/src/sage/categories/rings.py index b846e2ba0ef..c544ec2424e 100644 --- a/src/sage/categories/rings.py +++ b/src/sage/categories/rings.py @@ -752,13 +752,13 @@ def ideal(self, *args, **kwds): INPUT: - - An element or a list/tuple/sequence of elements. - - ``coerce`` (optional bool, default ``True``): - First coerce the elements into this ring. - - ``side``, optional string, one of ``"twosided"`` - (default), ``"left"``, ``"right"``: determines + - an element or a list/tuple/sequence of elements + - ``coerce`` -- boolean (default: ``True``); + first coerce the elements into this ring + - ``side`` -- optional string, one of ``'twosided'`` + (default), ``'left'``, ``'right'``; determines whether the resulting ideal is twosided, a left - ideal or a right ideal. + ideal or a right ideal EXAMPLES:: @@ -1351,7 +1351,7 @@ def free_module(self, base=None, basis=None, map=True): - ``basis`` -- (optional) a basis for this ring over the base - - ``map`` -- boolean (default ``True``), whether to return + - ``map`` -- boolean (default: ``True``); whether to return `R`-linear maps to and from `V` OUTPUT: a finite-rank free `R`-module `V` diff --git a/src/sage/categories/semigroups.py b/src/sage/categories/semigroups.py index 7e14cc2e8c2..ad314fadb04 100644 --- a/src/sage/categories/semigroups.py +++ b/src/sage/categories/semigroups.py @@ -60,7 +60,7 @@ class Semigroups(CategoryWithAxiom): """ _base_category_class_and_axiom = (Magmas, "Associative") - def example(self, choice="leftzero", **kwds): + def example(self, choice='leftzero', **kwds): r""" Returns an example of a semigroup, as per :meth:`Category.example() @@ -68,10 +68,10 @@ def example(self, choice="leftzero", **kwds): INPUT: - - ``choice`` -- string (default: ``'leftzero'``); Can be either 'leftzero' - for the left zero semigroup, or 'free' for the free semigroup. + - ``choice`` -- string (default: ``'leftzero'``); can be either 'leftzero' + for the left zero semigroup, or 'free' for the free semigroup - ``**kwds`` -- keyword arguments passed onto the constructor for the - chosen semigroup. + chosen semigroup EXAMPLES:: @@ -173,7 +173,7 @@ def prod(self, args): assert len(args) > 0, "Cannot compute an empty product in a semigroup" return prod(args[1:], args[0]) - def cayley_graph(self, side="right", simple=False, elements=None, + def cayley_graph(self, side='right', simple=False, elements=None, generators=None, connecting_set=None): r""" Return the Cayley graph for this finite semigroup. @@ -185,7 +185,7 @@ def cayley_graph(self, side="right", simple=False, elements=None, - ``simple`` -- boolean (default: ``False``): if ``True``, returns a simple graph (no loops, no labels, no multiple edges) - - ``generators`` -- list, tuple, or family of elements + - ``generators`` -- list; tuple, or family of elements of ``self`` (default: ``self.semigroup_generators()``) - ``connecting_set`` -- alias for ``generators``; deprecated - ``elements`` -- list (or iterable) of elements of ``self`` @@ -261,7 +261,7 @@ def cayley_graph(self, side="right", simple=False, elements=None, :: - sage: g = S.cayley_graph(side="left", simple=True) # needs sage.graphs + sage: g = S.cayley_graph(side='left', simple=True) # needs sage.graphs sage: g.vertices(sort=True) # needs sage.graphs ['a', 'ab', 'b', 'ba'] sage: g.edges(sort=True) # needs sage.graphs @@ -270,7 +270,7 @@ def cayley_graph(self, side="right", simple=False, elements=None, :: - sage: g = S.cayley_graph(side="twosided", simple=True) # needs sage.graphs + sage: g = S.cayley_graph(side='twosided', simple=True) # needs sage.graphs sage: g.vertices(sort=True) # needs sage.graphs ['a', 'ab', 'b', 'ba'] sage: g.edges(sort=True) # needs sage.graphs @@ -279,7 +279,7 @@ def cayley_graph(self, side="right", simple=False, elements=None, :: - sage: g = S.cayley_graph(side="twosided") # needs sage.graphs + sage: g = S.cayley_graph(side='twosided') # needs sage.graphs sage: g.vertices(sort=True) # needs sage.graphs ['a', 'ab', 'b', 'ba'] sage: g.edges(sort=True) # needs sage.graphs @@ -293,7 +293,7 @@ def cayley_graph(self, side="right", simple=False, elements=None, TESTS:: - sage: SymmetricGroup(2).cayley_graph(side="both") # needs sage.graphs sage.groups + sage: SymmetricGroup(2).cayley_graph(side='both') # needs sage.graphs sage.groups Traceback (most recent call last): ... ValueError: option 'side' must be 'left', 'right' or 'twosided' @@ -455,7 +455,7 @@ def subsemigroup(self, generators, one=None, category=None): return AutomaticSemigroup(generators, ambient=self, one=one, category=category) - def trivial_representation(self, base_ring=None, side="twosided"): + def trivial_representation(self, base_ring=None, side='twosided'): r""" Return the trivial representation of ``self`` over ``base_ring``. @@ -477,12 +477,12 @@ def trivial_representation(self, base_ring=None, side="twosided"): from sage.modules.with_basis.representation import TrivialRepresentation return TrivialRepresentation(self, base_ring) - def regular_representation(self, base_ring=None, side="left"): + def regular_representation(self, base_ring=None, side='left'): """ Return the regular representation of ``self`` over ``base_ring``. - - ``side`` -- (default: ``"left"``) whether this is the - ``"left"`` or ``"right"`` regular representation + - ``side`` -- (default: ``'left'``) whether this is the + ``'left'`` or ``'right'`` regular representation EXAMPLES:: @@ -497,7 +497,7 @@ def regular_representation(self, base_ring=None, side="left"): from sage.modules.with_basis.representation import RegularRepresentation return RegularRepresentation(self, base_ring, side) - def representation(self, module, on_basis, side="left", *args, **kwargs): + def representation(self, module, on_basis, side='left', *args, **kwargs): r""" Return a representation of ``self`` on ``module`` with the action given by ``on_basis``. @@ -509,8 +509,8 @@ def representation(self, module, on_basis, side="left", *args, **kwargs): ``g`` is an element of the semigroup and ``m`` is an element of the indexing set for the basis, and returns the result of ``g`` acting on ``m`` - - ``side`` -- (default: ``"left"``) whether this is a - ``"left"`` or ``"right"`` representation + - ``side`` -- (default: ``'left'``) whether this is a + ``'left'`` or ``'right'`` representation EXAMPLES:: @@ -1004,7 +1004,7 @@ def product_on_basis(self, g1, g2): """ return self.monomial(g1 * g2) - def trivial_representation(self, side="twosided"): + def trivial_representation(self, side='twosided'): """ Return the trivial representation of ``self``. @@ -1024,14 +1024,14 @@ def trivial_representation(self, side="twosided"): S = self.basis().keys() return S.trivial_representation(self.base_ring()) - def regular_representation(self, side="left"): + def regular_representation(self, side='left'): """ Return the regular representation of ``self``. INPUT: - - ``side`` -- (default: ``"left"``) whether this is the - ``"left"`` or ``"right"`` regular representation + - ``side`` -- (default: ``'left'``) whether this is the + ``'left'`` or ``'right'`` regular representation EXAMPLES:: @@ -1045,7 +1045,7 @@ def regular_representation(self, side="left"): S = self.basis().keys() return S.regular_representation(self.base_ring(), side) - def representation(self, module, on_basis, side="left", *args, **kwargs): + def representation(self, module, on_basis, side='left', *args, **kwargs): r""" Return a representation of ``self`` on ``module`` with the action of the semigroup given by ``on_basis``. @@ -1057,8 +1057,8 @@ def representation(self, module, on_basis, side="left", *args, **kwargs): ``g`` is an element of the semigroup and ``m`` is an element of the indexing set for the basis, and returns the result of ``g`` acting on ``m`` - - ``side`` -- (default: ``"left"``) whether this is a - ``"left"`` or ``"right"`` representation + - ``side`` -- (default: ``'left'``) whether this is a + ``'left'`` or ``'right'`` representation EXAMPLES:: diff --git a/src/sage/categories/sets_cat.py b/src/sage/categories/sets_cat.py index f0bca1fb023..2bb9ae5e5e2 100644 --- a/src/sage/categories/sets_cat.py +++ b/src/sage/categories/sets_cat.py @@ -2823,8 +2823,8 @@ def inject_shorthands(self, shorthands=None, verbose=True): - ``shorthands`` -- list (or iterable) of strings (default: ``self._shorthands``) - or ``"all"`` (for ``self._shorthands_all``) - - ``verbose`` -- boolean (default ``True``); + or ``'all'`` (for ``self._shorthands_all``) + - ``verbose`` -- boolean (default: ``True``); whether to print the defined shorthands EXAMPLES: diff --git a/src/sage/categories/sets_with_grading.py b/src/sage/categories/sets_with_grading.py index 038c176f54c..9777c0fd68c 100644 --- a/src/sage/categories/sets_with_grading.py +++ b/src/sage/categories/sets_with_grading.py @@ -223,7 +223,7 @@ def generating_series(self): from sage.rings.lazy_series_ring import LazyPowerSeriesRing from sage.sets.non_negative_integers import NonNegativeIntegers if isinstance(self.grading_set(), NonNegativeIntegers): - R = LazyPowerSeriesRing(ZZ, names="z") + R = LazyPowerSeriesRing(ZZ, names='z') return R(lambda n: self.graded_component(n).cardinality()) raise NotImplementedError diff --git a/src/sage/categories/supercrystals.py b/src/sage/categories/supercrystals.py index fdc074a37d9..09b924e0ad6 100644 --- a/src/sage/categories/supercrystals.py +++ b/src/sage/categories/supercrystals.py @@ -121,7 +121,7 @@ def edge_options(data): edge_opts['label'] = LatexExpr(str(l)) return edge_opts - G.set_latex_options(format="dot2tex", edge_labels=True, edge_options=edge_options) + G.set_latex_options(format='dot2tex', edge_labels=True, edge_options=edge_options) return G def genuine_highest_weight_vectors(self): diff --git a/src/sage/categories/triangular_kac_moody_algebras.py b/src/sage/categories/triangular_kac_moody_algebras.py index 0a7988282d3..7e756c9d55e 100644 --- a/src/sage/categories/triangular_kac_moody_algebras.py +++ b/src/sage/categories/triangular_kac_moody_algebras.py @@ -238,7 +238,7 @@ def part(self): EXAMPLES:: sage: # needs sage.combinat sage.modules - sage: L = LieAlgebra(QQ, cartan_type="F4") + sage: L = LieAlgebra(QQ, cartan_type='F4') sage: L.inject_variables() Defining e1, e2, e3, e4, f1, f2, f3, f4, h1, h2, h3, h4 sage: e1.part() diff --git a/src/sage/categories/vector_bundles.py b/src/sage/categories/vector_bundles.py index bd6e569ba36..bc4ab47039c 100644 --- a/src/sage/categories/vector_bundles.py +++ b/src/sage/categories/vector_bundles.py @@ -35,7 +35,7 @@ class VectorBundles(Category_over_base_ring): TESTS:: - sage: TestSuite(C).run(skip="_test_category_over_bases") + sage: TestSuite(C).run(skip='_test_category_over_bases') """ def __init__(self, base_space, base_field, name=None): @@ -47,7 +47,7 @@ def __init__(self, base_space, base_field, name=None): sage: M = Manifold(2, 'M') sage: from sage.categories.vector_bundles import VectorBundles sage: C = VectorBundles(M, RR) - sage: TestSuite(C).run(skip="_test_category_over_bases") + sage: TestSuite(C).run(skip='_test_category_over_bases') """ if base_field not in Fields().Topological(): diff --git a/src/sage/categories/weyl_groups.py b/src/sage/categories/weyl_groups.py index 10428ced319..b0794af3def 100644 --- a/src/sage/categories/weyl_groups.py +++ b/src/sage/categories/weyl_groups.py @@ -243,7 +243,7 @@ def quantum_bruhat_graph(self, index_set=()): EXAMPLES:: - sage: W = WeylGroup(['A',3], prefix="s") + sage: W = WeylGroup(['A',3], prefix='s') sage: g = W.quantum_bruhat_graph((1,3)) sage: g Parabolic Quantum Bruhat Graph of Weyl Group of type ['A', 3] @@ -260,7 +260,7 @@ def quantum_bruhat_graph(self, index_set=()): (s2, s1*s2, alpha[1] + alpha[2]), (s2, s3*s2, alpha[2] + alpha[3]), (1, s2, alpha[2])] - sage: W = WeylGroup(['A',3,1], prefix="s") + sage: W = WeylGroup(['A',3,1], prefix='s') sage: g = W.quantum_bruhat_graph() Traceback (most recent call last): ... @@ -318,7 +318,7 @@ def length(x): return DiGraph(visited, name="Parabolic Quantum Bruhat Graph of %s for nodes %s" % (self, index_set), format="dict_of_dicts", - data_structure="static_sparse") + data_structure='static_sparse') class ElementMethods: @@ -584,7 +584,7 @@ def reflection_to_root(self): EXAMPLES:: - sage: W = WeylGroup(['C',2],prefix="s") + sage: W = WeylGroup(['C',2], prefix='s') sage: W.from_reduced_word([1,2,1]).reflection_to_root() 2*alpha[1] + alpha[2] sage: W.from_reduced_word([1,2]).reflection_to_root() @@ -613,7 +613,7 @@ def reflection_to_coroot(self): EXAMPLES:: - sage: W = WeylGroup(['C',2],prefix="s") + sage: W = WeylGroup(['C',2], prefix='s') sage: W.from_reduced_word([1,2,1]).reflection_to_coroot() alphacheck[1] + alphacheck[2] sage: W.from_reduced_word([1,2]).reflection_to_coroot() @@ -654,7 +654,7 @@ def inversions(self, side='right', inversion_type='reflections'): EXAMPLES:: - sage: W = WeylGroup(['C',2], prefix="s") + sage: W = WeylGroup(['C',2], prefix='s') sage: w = W.from_reduced_word([1,2]) sage: w.inversions() [s2, s2*s1*s2] @@ -742,7 +742,7 @@ def bruhat_lower_covers_coroots(self): EXAMPLES:: - sage: W = WeylGroup(['A',3], prefix="s") + sage: W = WeylGroup(['A',3], prefix='s') sage: w = W.from_reduced_word([3,1,2,1]) sage: w.bruhat_lower_covers_coroots() [(s1*s2*s1, alphacheck[1] + alphacheck[2] + alphacheck[3]), @@ -763,7 +763,7 @@ def bruhat_upper_covers_coroots(self): EXAMPLES:: - sage: W = WeylGroup(['A',4], prefix="s") + sage: W = WeylGroup(['A',4], prefix='s') sage: w = W.from_reduced_word([3,1,2,1]) sage: w.bruhat_upper_covers_coroots() [(s1*s2*s3*s2*s1, alphacheck[3]), @@ -800,7 +800,7 @@ def quantum_bruhat_successors(self, index_set=None, roots=False, quantum_only=Fa EXAMPLES:: - sage: W = WeylGroup(['A',3], prefix="s") + sage: W = WeylGroup(['A',3], prefix='s') sage: w = W.from_reduced_word([3,1,2]) sage: w.quantum_bruhat_successors([1], roots = True) [(s3, alpha[2]), (s1*s2*s3*s2, alpha[3]), diff --git a/src/sage/coding/abstract_code.py b/src/sage/coding/abstract_code.py index 7f1350dba25..36291540f8c 100644 --- a/src/sage/coding/abstract_code.py +++ b/src/sage/coding/abstract_code.py @@ -857,18 +857,18 @@ def decoders_available(self, classes=False): def encode(self, word, encoder_name=None, *args, **kwargs): r""" - Transforms an element of a message space into a codeword. + Transform an element of a message space into a codeword. INPUT: - ``word`` -- an element of a message space of the code - - ``encoder_name`` -- (default: ``None``) Name of the encoder which will be used - to encode ``word``. The default encoder of ``self`` will be used if - default value is kept. + - ``encoder_name`` -- (default: ``None``) name of the encoder which + will be used to encode ``word``. The default encoder of ``self`` will + be used if default value is kept. - - ``args``, ``kwargs`` -- all additional arguments are forwarded to the construction of the - encoder that is used.. + - ``args``, ``kwargs`` -- all additional arguments are forwarded to the + construction of the encoder that is used One can use the following shortcut to encode a word :: @@ -915,8 +915,8 @@ def encoder(self, encoder_name=None, *args, **kwargs): returned. The default encoder of ``self`` will be used if default value is kept. - - ``args``, ``kwargs`` -- all additional arguments are forwarded to the constructor of the encoder - this method will return. + - ``args``, ``kwargs`` -- all additional arguments are forwarded to the + constructor of the encoder this method will return OUTPUT: an Encoder object diff --git a/src/sage/coding/bch_code.py b/src/sage/coding/bch_code.py index 7c035666d33..784ac13af41 100644 --- a/src/sage/coding/bch_code.py +++ b/src/sage/coding/bch_code.py @@ -270,7 +270,7 @@ class BCHUnderlyingGRSDecoder(Decoder): - ``**kwargs`` -- all extra arguments are forwarded to the GRS decoder """ - def __init__(self, code, grs_decoder="KeyEquationSyndrome", **kwargs): + def __init__(self, code, grs_decoder='KeyEquationSyndrome', **kwargs): r""" EXAMPLES:: diff --git a/src/sage/coding/code_bounds.py b/src/sage/coding/code_bounds.py index 6e6238920e9..c9165ddaf46 100644 --- a/src/sage/coding/code_bounds.py +++ b/src/sage/coding/code_bounds.py @@ -254,15 +254,15 @@ def codesize_upper_bound(n, d, q, algorithm=None): sage: codes.bounds.codesize_upper_bound(10, 3, 2) 93 - sage: codes.bounds.codesize_upper_bound(24, 8, 2, algorithm="LP") # needs sage.numerical.mip + sage: codes.bounds.codesize_upper_bound(24, 8, 2, algorithm='LP') # needs sage.numerical.mip 4096 - sage: codes.bounds.codesize_upper_bound(10, 3, 2, algorithm="gap") # optional - gap_package_guava + sage: codes.bounds.codesize_upper_bound(10, 3, 2, algorithm='gap') # optional - gap_package_guava 85 sage: codes.bounds.codesize_upper_bound(11, 3, 4, algorithm=None) # needs sage.symbolic 123361 - sage: codes.bounds.codesize_upper_bound(11, 3, 4, algorithm="gap") # optional - gap_package_guava + sage: codes.bounds.codesize_upper_bound(11, 3, 4, algorithm='gap') # optional - gap_package_guava 123361 - sage: codes.bounds.codesize_upper_bound(11, 3, 4, algorithm="LP") # needs sage.numerical.mip + sage: codes.bounds.codesize_upper_bound(11, 3, 4, algorithm='LP') # needs sage.numerical.mip 109226 TESTS: @@ -271,7 +271,7 @@ def codesize_upper_bound(n, d, q, algorithm=None): sage: codes.bounds.codesize_upper_bound(19, 10, 2) 20 - sage: codes.bounds.codesize_upper_bound(19, 10, 2, algorithm="gap") # optional - gap_package_guava + sage: codes.bounds.codesize_upper_bound(19, 10, 2, algorithm='gap') # optional - gap_package_guava 20 Meaningless parameters are rejected:: @@ -283,7 +283,7 @@ def codesize_upper_bound(n, d, q, algorithm=None): """ _check_n_q_d(n, q, d, field_based=False) if algorithm == "gap": - GapPackage("guava", spkg="gap_packages").require() + GapPackage("guava", spkg='gap_packages').require() libgap.load_package('guava') return int(libgap.UpperBound(n, d, q)) if algorithm == "LP": @@ -313,7 +313,7 @@ def dimension_upper_bound(n, d, q, algorithm=None): 6 sage: codes.bounds.dimension_upper_bound(30,15,4) # needs sage.libs.pari sage.symbolic 13 - sage: codes.bounds.dimension_upper_bound(30,15,4,algorithm="LP") # needs sage.libs.pari sage.numerical.mip + sage: codes.bounds.dimension_upper_bound(30,15,4,algorithm='LP') # needs sage.libs.pari sage.numerical.mip 12 TESTS: @@ -380,12 +380,12 @@ def plotkin_upper_bound(n,q,d, algorithm=None): sage: codes.bounds.plotkin_upper_bound(10,2,3) 192 - sage: codes.bounds.plotkin_upper_bound(10,2,3,algorithm="gap") # optional - gap_package_guava + sage: codes.bounds.plotkin_upper_bound(10,2,3,algorithm='gap') # optional - gap_package_guava 192 """ _check_n_q_d(n, q, d, field_based=False) if algorithm == "gap": - GapPackage("guava", spkg="gap_packages").require() + GapPackage("guava", spkg='gap_packages').require() libgap.load_package("guava") return QQ(libgap.UpperBoundPlotkin(n, d, q)) else: @@ -431,7 +431,7 @@ def griesmer_upper_bound(n,q,d,algorithm=None): sage: codes.bounds.griesmer_upper_bound(10,2,3) # needs sage.libs.pari 128 - sage: codes.bounds.griesmer_upper_bound(10,2,3,algorithm="gap") # optional - gap_package_guava, needs sage.libs.pari + sage: codes.bounds.griesmer_upper_bound(10,2,3,algorithm='gap') # optional - gap_package_guava, needs sage.libs.pari 128 TESTS:: @@ -443,7 +443,7 @@ def griesmer_upper_bound(n,q,d,algorithm=None): """ _check_n_q_d(n, q, d) if algorithm == "gap": - GapPackage("guava", spkg="gap_packages").require() + GapPackage("guava", spkg='gap_packages').require() libgap.load_package("guava") return QQ(libgap.UpperBoundGriesmer(n, d, q)) else: @@ -472,13 +472,13 @@ def elias_upper_bound(n,q,d,algorithm=None): sage: codes.bounds.elias_upper_bound(10,2,3) 232 - sage: codes.bounds.elias_upper_bound(10,2,3,algorithm="gap") # optional - gap_package_guava + sage: codes.bounds.elias_upper_bound(10,2,3,algorithm='gap') # optional - gap_package_guava 232 """ _check_n_q_d(n, q, d, field_based=False) r = 1-1/q if algorithm == "gap": - GapPackage("guava", spkg="gap_packages").require() + GapPackage("guava", spkg='gap_packages').require() libgap.load_package("guava") return QQ(libgap.UpperBoundElias(n, d, q)) else: diff --git a/src/sage/coding/code_constructions.py b/src/sage/coding/code_constructions.py index d648d5c2451..bba083db6bd 100644 --- a/src/sage/coding/code_constructions.py +++ b/src/sage/coding/code_constructions.py @@ -731,7 +731,7 @@ def ToricCode(P,F): [36, 5] linear code over GF(7) sage: C.minimum_distance() # needs sage.groups 24 - sage: C.minimum_distance(algorithm="guava") # optional - gap_package_guava + sage: C.minimum_distance(algorithm='guava') # optional - gap_package_guava ...24 sage: C = codes.ToricCode([[-2,-2],[-1,-2],[-1,-1],[-1,0], ....: [0,-1],[0,0],[0,1],[1,-1],[1,0]], GF(5)) @@ -739,7 +739,7 @@ def ToricCode(P,F): [16, 9] linear code over GF(5) sage: C.minimum_distance() # needs sage.groups 6 - sage: C.minimum_distance(algorithm="guava") # optional - gap_package_guava + sage: C.minimum_distance(algorithm='guava') # optional - gap_package_guava 6 sage: C = codes.ToricCode([[0,0],[1,1],[1,2],[1,3],[1,4],[2,1], ....: [2,2],[2,3],[3,1],[3,2],[4,1]], GF(8,"a")) diff --git a/src/sage/coding/codecan/autgroup_can_label.pyx b/src/sage/coding/codecan/autgroup_can_label.pyx index e94e6329c6b..44cee14ef02 100644 --- a/src/sage/coding/codecan/autgroup_can_label.pyx +++ b/src/sage/coding/codecan/autgroup_can_label.pyx @@ -81,13 +81,13 @@ columns do share the same coloring:: We can also restrict the group action to linear isometries:: - sage: P = LinearCodeAutGroupCanLabel(C, algorithm_type="linear") + sage: P = LinearCodeAutGroupCanLabel(C, algorithm_type='linear') sage: P.get_autom_order() == GL(3, GF(4, 'a')).order() True and to the action of the symmetric group only:: - sage: P = LinearCodeAutGroupCanLabel(C, algorithm_type="permutational") + sage: P = LinearCodeAutGroupCanLabel(C, algorithm_type='permutational') sage: P.get_autom_order() == C.permutation_automorphism_group().order() True """ @@ -184,7 +184,7 @@ class LinearCodeAutGroupCanLabel: True """ - def __init__(self, C, P=None, algorithm_type="semilinear"): + def __init__(self, C, P=None, algorithm_type='semilinear'): """ see :class:`LinearCodeAutGroupCanLabel` @@ -213,7 +213,7 @@ class LinearCodeAutGroupCanLabel: [0 1 0 1 0 1 1] [0 0 1 1 1 1 0] sage: P2 = LinearCodeAutGroupCanLabel(C, P=[[0,3,5],[1,2,4,6]], - ....: algorithm_type="permutational") + ....: algorithm_type='permutational') sage: P2.get_canonical_form().generator_matrix() [1 1 1 0 0 0 1] [0 1 0 1 1 0 1] @@ -294,7 +294,7 @@ class LinearCodeAutGroupCanLabel: # this command allows you some advanced debugging # it prints the backtrack tree -> must be activated when installing - # pr._latex_view(title="MyTitle") #this will provide you some visual representation of what is going on + # pr._latex_view(title='MyTitle') #this will provide you some visual representation of what is going on can_transp = pr.get_transporter() can_col_set = pr.get_canonical_form().columns() diff --git a/src/sage/coding/codecan/codecan.pyx b/src/sage/coding/codecan/codecan.pyx index 15198f095ad..6e1e4358b27 100644 --- a/src/sage/coding/codecan/codecan.pyx +++ b/src/sage/coding/codecan/codecan.pyx @@ -113,7 +113,7 @@ cdef class InnerGroup: - ``rank`` -- integer in `\{0, \ldots, k\}` - ``row_partition`` -- a partition of `\{0, \ldots, k-1\}` with - discrete cells for all integers `i` `\geq` ``rank``. + discrete cells for all integers `i` `\geq` ``rank`` - ``frob_pow`` -- integer `s` in `\{0, \ldots, r-1\}` if `q = p^r` The group `G_{\Pi^{(I)}(x)}` contains all elements `(A, \varphi, \alpha) \in G`, @@ -132,7 +132,7 @@ cdef class InnerGroup: See [Feu2009]_ for more details. """ - def __cinit__(self, k=0, algorithm="semilinear", **kwds): + def __cinit__(self, k=0, algorithm='semilinear', **kwds): r""" See :class:`sage.coding.codecan.codecan.InnerGroup` @@ -505,7 +505,7 @@ cdef class PartitionRefinementLinearCode(PartitionRefinement_generic): self._nr_of_point_refine_calls = 0 self._stored_states = dict() - def __init__(self, n, generator_matrix, P=None, algorithm_type="semilinear"): + def __init__(self, n, generator_matrix, P=None, algorithm_type='semilinear'): r""" Initialization, we immediately start the algorithm (see :mod:`sage.coding.codecan.codecan`) @@ -516,7 +516,7 @@ cdef class PartitionRefinementLinearCode(PartitionRefinement_generic): - ``n`` -- integer - ``generator_matrix`` -- a `k \times n` matrix over `\GF{q}` of full row rank, - i.e. `k x_1` and `i_2 < x_2` where `x_1, x_2` are the two zeroes of the equation in `x`: - `ax^2+bx+c=0`. + `i_1 > x_1` and `i_2 < x_2` where `x_1, x_2` are the two zeroes of the + equation in `x`: `ax^2+bx+c=0`. - If there is no real solution to the equation, it returns an empty range with negative coefficients. + If there is no real solution to the equation, it returns an empty range + with negative coefficients. INPUT: - - ``a``, ``b`` and ``c`` -- coefficients of a second degree equation, ``a`` being the coefficient of - the higher degree term. + - ``a``, ``b`` and ``c`` -- coefficients of a second degree equation, ``a`` + being the coefficient of the higher degree term EXAMPLES:: diff --git a/src/sage/coding/information_set_decoder.py b/src/sage/coding/information_set_decoder.py index 5489aab90b0..a0584ff44b2 100644 --- a/src/sage/coding/information_set_decoder.py +++ b/src/sage/coding/information_set_decoder.py @@ -697,7 +697,7 @@ class LinearCodeInformationSetDecoder(Decoder): :meth:`sage.code.linear_code.AbstractLinearCode.decoder` method:: sage: C = codes.GolayCode(GF(3)) - sage: D = C.decoder("InformationSet", 2); D + sage: D = C.decoder('InformationSet', 2); D Information-set decoder (Lee-Brickell) for [12, 6, 6] Extended Golay code over GF(3) decoding up to 2 errors @@ -705,7 +705,7 @@ class LinearCodeInformationSetDecoder(Decoder): order to pass special parameters to it:: sage: C = codes.GolayCode(GF(3)) - sage: D2 = C.decoder("InformationSet", 2, algorithm="Lee-Brickell", search_size=2); D2 + sage: D2 = C.decoder('InformationSet', 2, algorithm='Lee-Brickell', search_size=2); D2 Information-set decoder (Lee-Brickell) for [12, 6, 6] Extended Golay code over GF(3) decoding up to 2 errors sage: D2.algorithm() @@ -716,7 +716,7 @@ class LinearCodeInformationSetDecoder(Decoder): If you specify an algorithm which is not known, you get a friendly error message:: - sage: C.decoder("InformationSet", 2, algorithm="NoSuchThing") + sage: C.decoder('InformationSet', 2, algorithm="NoSuchThing") Traceback (most recent call last): ... ValueError: Unknown ISD algorithm 'NoSuchThing'. @@ -727,14 +727,14 @@ class LinearCodeInformationSetDecoder(Decoder): sage: from sage.coding.information_set_decoder import LeeBrickellISDAlgorithm sage: A = LeeBrickellISDAlgorithm(C, (0, 2)) - sage: D = C.decoder("InformationSet", 2, algorithm=A); D + sage: D = C.decoder('InformationSet', 2, algorithm=A); D Information-set decoder (Lee-Brickell) for [12, 6, 6] Extended Golay code over GF(3) decoding up to 2 errors When passing an already constructed ISD algorithm, you can't also pass parameters to the ISD algorithm when constructing the decoder:: - sage: C.decoder("InformationSet", 2, algorithm=A, search_size=2) + sage: C.decoder('InformationSet', 2, algorithm=A, search_size=2) Traceback (most recent call last): ... ValueError: ISD algorithm arguments are not allowed @@ -743,7 +743,7 @@ class LinearCodeInformationSetDecoder(Decoder): We can also information-set decode non-binary codes:: sage: C = codes.GolayCode(GF(3)) - sage: D = C.decoder("InformationSet", 2); D + sage: D = C.decoder('InformationSet', 2); D Information-set decoder (Lee-Brickell) for [12, 6, 6] Extended Golay code over GF(3) decoding up to 2 errors @@ -766,7 +766,7 @@ def __init__(self, code, number_errors, algorithm=None, **kwargs): or an Integer/int:: sage: C = codes.GolayCode(GF(2)) - sage: D = C.decoder("InformationSet", "aa") + sage: D = C.decoder('InformationSet', "aa") Traceback (most recent call last): ... ValueError: number_errors should be an integer or a pair of integers @@ -775,14 +775,14 @@ def __init__(self, code, number_errors, algorithm=None, **kwargs): two values, the first one being at most the second one:: sage: C = codes.GolayCode(GF(2)) - sage: D = C.decoder("InformationSet", (4, 2)) + sage: D = C.decoder('InformationSet', (4, 2)) Traceback (most recent call last): ... ValueError: number_errors should be a positive integer or a valid interval within the positive integers You cannot ask the decoder to correct more errors than the code length:: - sage: D = C.decoder("InformationSet", 25) + sage: D = C.decoder('InformationSet', 25) Traceback (most recent call last): ... ValueError: The provided number of errors should be at most the code's length @@ -790,7 +790,7 @@ def __init__(self, code, number_errors, algorithm=None, **kwargs): If ``algorithm`` is not set, additional parameters cannot be passed to the ISD algorithm:: - sage: D = C.decoder("InformationSet", 2, search_size=2) + sage: D = C.decoder('InformationSet', 2, search_size=2) Traceback (most recent call last): ... ValueError: Additional arguments to an information-set decoder algorithm are only allowed if a specific algorithm is selected by setting the algorithm keyword @@ -800,7 +800,7 @@ def __init__(self, code, number_errors, algorithm=None, **kwargs): sage: from sage.coding.information_set_decoder import LeeBrickellISDAlgorithm sage: A = LeeBrickellISDAlgorithm(C, (0, 2)) - sage: D = C.decoder("InformationSet", 2, A, search_size=3) + sage: D = C.decoder('InformationSet', 2, A, search_size=3) Traceback (most recent call last): ... ValueError: ISD algorithm arguments are not allowed when supplying a constructed ISD algorithm @@ -812,11 +812,11 @@ def __init__(self, code, number_errors, algorithm=None, **kwargs): sage: C = codes.GolayCode(GF(2)) sage: from sage.coding.information_set_decoder import LeeBrickellISDAlgorithm sage: A = LeeBrickellISDAlgorithm(C, (0, 2)) - sage: D = C.decoder("InformationSet", 2, A); D + sage: D = C.decoder('InformationSet', 2, A); D Information-set decoder (Lee-Brickell) for [24, 12, 8] Extended Golay code over GF(2) decoding up to 2 errors - sage: D = C.decoder("InformationSet", (0,2), A); D + sage: D = C.decoder('InformationSet', (0,2), A); D Information-set decoder (Lee-Brickell) for [24, 12, 8] Extended Golay code over GF(2) decoding up to 2 errors - sage: D = C.decoder("InformationSet", 3, A); D + sage: D = C.decoder('InformationSet', 3, A); D Traceback (most recent call last): ... ValueError: number_errors must match that of the passed ISD algorithm @@ -878,8 +878,8 @@ def known_algorithms(dictionary=False): INPUT: - - ``dictionary`` -- optional. If set to ``True``, return a ``dict`` - mapping decoding algorithm name to its class. + - ``dictionary`` -- optional; if set to ``True``, return a ``dict`` + mapping decoding algorithm name to its class OUTPUT: a list of strings or a ``dict`` from string to ISD algorithm class @@ -901,7 +901,7 @@ def algorithm(self): EXAMPLES:: sage: C = codes.GolayCode(GF(2)) - sage: D = C.decoder("InformationSet", (2,4), "Lee-Brickell") + sage: D = C.decoder('InformationSet', (2,4), "Lee-Brickell") sage: D.algorithm() ISD Algorithm (Lee-Brickell) for [24, 12, 8] Extended Golay code over GF(2) decoding between 2 and 4 errors @@ -976,7 +976,7 @@ def decoding_radius(self): EXAMPLES:: sage: C = codes.GolayCode(GF(2)) - sage: D = C.decoder("InformationSet", 2) + sage: D = C.decoder('InformationSet', 2) sage: D.decoding_radius() 2 """ @@ -992,7 +992,7 @@ def decoding_interval(self): EXAMPLES:: sage: C = codes.GolayCode(GF(2)) - sage: D = C.decoder("InformationSet", 2) + sage: D = C.decoder('InformationSet', 2) sage: D.decoding_interval() (0, 2) """ @@ -1005,7 +1005,7 @@ def _repr_(self): EXAMPLES:: sage: C = codes.GolayCode(GF(2)) - sage: D = C.decoder("InformationSet", 2) + sage: D = C.decoder('InformationSet', 2) sage: D Information-set decoder (Lee-Brickell) for [24, 12, 8] Extended Golay code over GF(2) decoding up to 2 errors """ @@ -1019,7 +1019,7 @@ def _latex_(self): sage: C = codes.GolayCode(GF(2)) sage: from sage.coding.information_set_decoder import LeeBrickellISDAlgorithm - sage: D = C.decoder("InformationSet", 2) + sage: D = C.decoder('InformationSet', 2) sage: latex(D) \textnormal{Information-set decoder (Lee-Brickell) for }[24, 12, 8] \textnormal{ Extended Golay Code over } \Bold{F}_{2} \textnormal{decoding up to 2 errors} """ diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py index a886d590b8a..4be047f3527 100644 --- a/src/sage/coding/linear_code.py +++ b/src/sage/coding/linear_code.py @@ -439,7 +439,7 @@ def _an_element_(self): """ return self.gens()[0] - def automorphism_group_gens(self, equivalence="semilinear"): + def automorphism_group_gens(self, equivalence='semilinear'): r""" Return generators of the automorphism group of ``self``. @@ -447,11 +447,11 @@ def automorphism_group_gens(self, equivalence="semilinear"): - ``equivalence`` (optional) -- which defines the acting group, either - * ``"permutational"`` + * ``'permutational'`` - * ``"linear"`` + * ``'linear'`` - * ``"semilinear"`` + * ``'semilinear'`` OUTPUT: @@ -484,7 +484,7 @@ def automorphism_group_gens(self, equivalence="semilinear"): Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z)], 362880) - sage: C.automorphism_group_gens(equivalence="linear") + sage: C.automorphism_group_gens(equivalence='linear') ([((z, 1, z + 1, z + 1, 1, z + 1, z, 1, z + 1, z + 1, 1, z, 1, z + 1, z, 1, z, 1, z + 1, 1, 1); (1,12,11,10,6,8,9,20,13,21,5,14,3,16,17,19,7,4,2,15,18), @@ -501,7 +501,7 @@ def automorphism_group_gens(self, equivalence="semilinear"): Ring endomorphism of Finite Field in z of size 2^2 Defn: z |--> z)], 181440) - sage: C.automorphism_group_gens(equivalence="permutational") + sage: C.automorphism_group_gens(equivalence='permutational') ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2 @@ -577,7 +577,7 @@ def assmus_mattson_designs(self, t, mode=None): `C=C^*` in this case, so this info is extraneous). The test fails to produce 6-designs (ie, the hypotheses of the theorem fail to hold, not that the 6-designs definitely don't exist). The command - ``assmus_mattson_designs(C,5,mode="verbose")`` returns the same value + ``assmus_mattson_designs(C,5,mode='verbose')`` returns the same value but prints out more detailed information. The second example below illustrates the blocks of the 5-(24, 8, 1) @@ -732,7 +732,7 @@ def _canonize(self, equivalence): from sage.coding.codecan.autgroup_can_label import LinearCodeAutGroupCanLabel return LinearCodeAutGroupCanLabel(self, algorithm_type=equivalence) - def canonical_representative(self, equivalence="semilinear"): + def canonical_representative(self, equivalence='semilinear'): r""" Compute a canonical orbit representative under the action of the semimonomial transformation group. @@ -747,11 +747,11 @@ def canonical_representative(self, equivalence="semilinear"): - ``equivalence`` (optional) -- which defines the acting group, either - * ``"permutational"`` + * ``'permutational'`` - * ``"linear"`` + * ``'linear'`` - * ``"semilinear"`` + * ``'semilinear'`` OUTPUT: @@ -925,8 +925,8 @@ def covering_radius(self): is limited to computing with fields of size at most 256 """ from sage.libs.gap.libgap import libgap - GapPackage("guava", spkg="gap_packages").require() - libgap.LoadPackage("guava") + GapPackage('guava', spkg='gap_packages').require() + libgap.LoadPackage('guava') F = self.base_ring() if F.cardinality() > 256: raise NotImplementedError("the GAP algorithm that Sage is using " @@ -1284,7 +1284,7 @@ def is_permutation_equivalent(self,other,algorithm=None): [7, 4] Hamming Code over GF(2) sage: C1.is_permutation_equivalent(C2) True - sage: C1.is_permutation_equivalent(C2, algorithm="verbose") # needs sage.groups + sage: C1.is_permutation_equivalent(C2, algorithm='verbose') # needs sage.groups (True, (3,4)(5,7,6)) sage: C1 = codes.random_linear_code(GF(2), 10, 5) sage: C2 = codes.random_linear_code(GF(3), 10, 5) @@ -1359,7 +1359,7 @@ def minimum_distance(self, algorithm=None): - ``None``, to use GAP methods (but not Guava) - - ``"Guava"``, to use the optional GAP package Guava + - ``'guava'``, to use the optional GAP package Guava OUTPUT: integer; minimum distance of this code @@ -1374,10 +1374,10 @@ def minimum_distance(self, algorithm=None): If ``algorithm`` is provided, then the minimum distance will be recomputed even if there is a stored value from a previous run.:: - sage: C.minimum_distance(algorithm="gap") # needs sage.libs.gap + sage: C.minimum_distance(algorithm='gap') # needs sage.libs.gap 3 sage: libgap.SetAllInfoLevels(0) # to suppress extra info messages # needs sage.libs.gap - sage: C.minimum_distance(algorithm="guava") # optional - gap_package_guava + sage: C.minimum_distance(algorithm='guava') # optional - gap_package_guava ...3 TESTS:: @@ -1397,13 +1397,13 @@ def minimum_distance(self, algorithm=None): NotImplementedError: the GAP algorithm that Sage is using is limited to computing with fields of size at most 256 """ - if algorithm == "guava": - GapPackage("guava", spkg="gap_packages").require() + if algorithm == 'guava': + GapPackage('guava', spkg='gap_packages').require() # If the minimum distance has already been computed or provided by # the user then simply return the stored value. # This is done only if algorithm is None. - if algorithm not in (None, "gap", "guava"): + if algorithm not in (None, 'gap', 'guava'): raise ValueError("The algorithm argument must be one of None, " "'gap' or 'guava'; got '{0}'".format(algorithm)) @@ -1415,9 +1415,9 @@ def minimum_distance(self, algorithm=None): "of size at most 256") G = self.generator_matrix() - if (q == 2 or q == 3) and algorithm == "guava": + if (q == 2 or q == 3) and algorithm == 'guava': from sage.libs.gap.libgap import libgap - libgap.LoadPackage("guava") + libgap.LoadPackage('guava') C = libgap(G).GeneratorMatCode(libgap(F)) d = C.MinimumWeight() return ZZ(d) @@ -1432,7 +1432,7 @@ def _minimum_weight_codeword(self, algorithm=None): - ``algorithm`` -- (default: ``None``) the name of the algorithm to use to perform minimum weight codeword search. If set to ``None``, a search using GAP methods will be done. ``algorithm`` can be: - - ``"Guava"``, which will use optional GAP package Guava + - ``'guava'``, which will use optional GAP package Guava REMARKS: @@ -1468,9 +1468,9 @@ def _minimum_weight_codeword(self, algorithm=None): current_randstate().set_seed_gap() - if algorithm == "guava": - GapPackage("guava", spkg="gap_packages").require() - libgap.LoadPackage("guava") + if algorithm == 'guava': + GapPackage('guava', spkg='gap_packages').require() + libgap.LoadPackage('guava') C = Gmat.GeneratorMatCode(F) cg = C.MinimumDistanceCodeword() c = [cg[j].sage(ring=F) for j in range(n)] @@ -1534,7 +1534,7 @@ def module_composition_factors(self, gp): # M_gap.MTX.CompositionFactors() yet return libgap.eval('MTX.CompositionFactors('+str(M_gap)+')') - def permutation_automorphism_group(self, algorithm="partition"): + def permutation_automorphism_group(self, algorithm='partition'): r""" If `C` is an `[n,k,d]` code over `F`, this function computes the subgroup `Aut(C) \subset S_n` of all permutation automorphisms of `C`. @@ -1548,13 +1548,13 @@ def permutation_automorphism_group(self, algorithm="partition"): INPUT: - - ``algorithm`` -- if ``"gap"`` then GAP's MatrixAutomorphism function + - ``algorithm`` -- if ``'gap'`` then GAP's MatrixAutomorphism function (written by Thomas Breuer) is used. The implementation combines an idea of mine with an improvement suggested by Cary Huffman. If - ``"gap+verbose"`` then code-theoretic data is printed out at - several stages of the computation. If ``"partition"`` then the + ``'gap+verbose'`` then code-theoretic data is printed out at + several stages of the computation. If ``'partition'`` then the (default) partition refinement algorithm of Robert Miller is used. - Finally, if ``"codecan"`` then the partition refinement algorithm + Finally, if ``'codecan'`` then the partition refinement algorithm of Thomas Feulner is used, which also computes a canonical representative of ``self`` (call :meth:`~sage.coding.linear_code.LinearCode.canonical_representative` @@ -1609,19 +1609,19 @@ def permutation_automorphism_group(self, algorithm="partition"): 9999360 sage: C = codes.HammingCode(GF(3), 2); C [4, 2] Hamming Code over GF(3) - sage: C.permutation_automorphism_group(algorithm="partition") + sage: C.permutation_automorphism_group(algorithm='partition') Permutation Group with generators [(1,3,4)] sage: C = codes.HammingCode(GF(4,"z"), 2); C [5, 3] Hamming Code over GF(4) - sage: G = C.permutation_automorphism_group(algorithm="partition"); G + sage: G = C.permutation_automorphism_group(algorithm='partition'); G Permutation Group with generators [(1,3)(4,5), (1,4)(3,5)] - sage: GG = C.permutation_automorphism_group(algorithm="codecan") # long time + sage: GG = C.permutation_automorphism_group(algorithm='codecan') # long time sage: GG == G # long time True - sage: C.permutation_automorphism_group(algorithm="gap") # optional - gap_package_guava + sage: C.permutation_automorphism_group(algorithm='gap') # optional - gap_package_guava Permutation Group with generators [(1,3)(4,5), (1,4)(3,5)] sage: C = codes.GolayCode(GF(3), True) - sage: C.permutation_automorphism_group(algorithm="gap") # optional - gap_package_guava + sage: C.permutation_automorphism_group(algorithm='gap') # optional - gap_package_guava Permutation Group with generators [(5,7)(6,11)(8,9)(10,12), (4,6,11)(5,8,12)(7,10,9), (3,4)(6,8)(9,11)(10,12), (2,3)(6,11)(8,12)(9,10), (1,2)(5,10)(7,12)(8,9)] @@ -1634,7 +1634,7 @@ def permutation_automorphism_group(self, algorithm="partition"): Using the 132 codewords of weight 5 Supergroup size: 39916800 in addition to the output of - ``C.permutation_automorphism_group(algorithm="gap")``. + ``C.permutation_automorphism_group(algorithm='gap')``. """ F = self.base_ring() q = F.order() @@ -1642,7 +1642,7 @@ def permutation_automorphism_group(self, algorithm="partition"): n = len(G.columns()) if "gap" in algorithm: from sage.libs.gap.libgap import libgap - GapPackage("guava", spkg="gap_packages").require() + GapPackage('guava', spkg='gap_packages').require() libgap.LoadPackage('guava') wts = self.weight_distribution() # bottleneck 1 nonzerowts = [i for i in range(len(wts)) if wts[i] != 0] @@ -1806,11 +1806,11 @@ def weight_distribution(self, algorithm=None): INPUT: - - ``algorithm`` -- (default: ``None``) If set to ``"gap"``, - call GAP. If set to ``"leon"``, call the option GAP package GUAVA and + - ``algorithm`` -- (default: ``None``) If set to ``'gap'``, + call GAP. If set to ``'leon'``, call the option GAP package GUAVA and call a function therein by Jeffrey Leon (see warning below). If set to - ``"binary"``, use an algorithm optimized for binary codes. The default - is to use ``"binary"`` for binary codes and ``"gap"`` otherwise. + ``'binary'``, use an algorithm optimized for binary codes. The default + is to use ``'binary'`` for binary codes and ``'gap'`` otherwise. OUTPUT: a list of nonnegative integers; the weight distribution @@ -1836,25 +1836,25 @@ def weight_distribution(self, algorithm=None): [1, 0, 0, 30, 15, 18] sage: C = codes.HammingCode(GF(2), 3); C [7, 4] Hamming Code over GF(2) - sage: C.weight_distribution(algorithm="leon") # optional - gap_package_guava + sage: C.weight_distribution(algorithm='leon') # optional - gap_package_guava [1, 0, 0, 7, 7, 0, 0, 1] - sage: C.weight_distribution(algorithm="gap") # needs sage.libs.gap + sage: C.weight_distribution(algorithm='gap') # needs sage.libs.gap [1, 0, 0, 7, 7, 0, 0, 1] - sage: C.weight_distribution(algorithm="binary") + sage: C.weight_distribution(algorithm='binary') [1, 0, 0, 7, 7, 0, 0, 1] sage: # optional - gap_package_guava sage: C = codes.HammingCode(GF(3), 3); C [13, 10] Hamming Code over GF(3) - sage: C.weight_distribution() == C.weight_distribution(algorithm="leon") + sage: C.weight_distribution() == C.weight_distribution(algorithm='leon') True sage: C = codes.HammingCode(GF(5), 2); C [6, 4] Hamming Code over GF(5) - sage: C.weight_distribution() == C.weight_distribution(algorithm="leon") + sage: C.weight_distribution() == C.weight_distribution(algorithm='leon') True sage: C = codes.HammingCode(GF(7), 2); C [8, 6] Hamming Code over GF(7) - sage: C.weight_distribution() == C.weight_distribution(algorithm="leon") + sage: C.weight_distribution() == C.weight_distribution(algorithm='leon') True """ @@ -1881,7 +1881,7 @@ def weight_distribution(self, algorithm=None): # The GAP command DirectoriesPackageLibrary tells the location of the latest # version of the Guava libraries, so gives us the location of the Guava binaries too. from sage.libs.gap.libgap import libgap - guava_bin_dir = libgap.DirectoriesPackagePrograms("guava")[0].Filename("").sage() + guava_bin_dir = libgap.DirectoriesPackagePrograms('guava')[0].Filename("").sage() input = _dump_code_in_leon_format(self) + "::code" lines = subprocess.check_output([os.path.join(guava_bin_dir, 'wtdist'), input]) # to use the already present output parser @@ -1929,14 +1929,14 @@ def weight_enumerator(self, names=None, bivariate=True): INPUT: - - ``names`` -- (default: ``"xy"``) The names of the variables in the + - ``names`` -- (default: ``'xy'``) The names of the variables in the homogeneous polynomial. Can be given as a single string of length 2, or a single string with a comma, or as a tuple or list of two strings. - ``bivariate`` -- boolean (default: ``True``); Whether to return a bivariate, homogeneous polynomial or just a univariate polynomial. If set to ``False``, then ``names`` will be interpreted as a single - variable name and default to ``"x"``. + variable name and default to ``'x'``. OUTPUT: the weight enumerator polynomial over `\ZZ` @@ -1945,7 +1945,7 @@ def weight_enumerator(self, names=None, bivariate=True): sage: C = codes.HammingCode(GF(2), 3) sage: C.weight_enumerator() x^7 + 7*x^4*y^3 + 7*x^3*y^4 + y^7 - sage: C.weight_enumerator(names="st") + sage: C.weight_enumerator(names='st') s^7 + 7*s^4*t^3 + 7*s^3*t^4 + t^7 sage: C.weight_enumerator(names="var1, var2") var1^7 + 7*var1^4*var2^3 + 7*var1^3*var2^4 + var2^7 @@ -1976,7 +1976,7 @@ def weight_enumerator(self, names=None, bivariate=True): x, = R.gens() return sum(spec[i]*x**i for i in range(n+1)) - def zeta_polynomial(self, name="T"): + def zeta_polynomial(self, name='T'): r""" Return the Duursma zeta polynomial of this code. @@ -2045,7 +2045,7 @@ def zeta_polynomial(self, name="T"): P = sum([P_coeffs[i]*T**i for i in range(r+1)]) return RT(P) / RT(P)(1) - def zeta_function(self, name="T"): + def zeta_function(self, name='T'): r""" Return the Duursma zeta function of the code. @@ -2404,7 +2404,7 @@ def generator_matrix(self, encoder_name=None, **kwargs): will be returned if default value is kept. - ``kwargs`` -- all additional arguments are forwarded to the construction of the - encoder that is used. + encoder that is used EXAMPLES:: diff --git a/src/sage/coding/linear_code_no_metric.py b/src/sage/coding/linear_code_no_metric.py index 83bb913fc8b..8ecdebcbe0c 100644 --- a/src/sage/coding/linear_code_no_metric.py +++ b/src/sage/coding/linear_code_no_metric.py @@ -231,7 +231,7 @@ def generator_matrix(self, encoder_name=None, **kwargs): will be used if default value is kept. - ``kwargs`` -- all additional arguments are forwarded to the construction of the - encoder that is used. + encoder that is used EXAMPLES:: diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index b83041b31d3..b10b4ff11aa 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -759,7 +759,7 @@ def generator_matrix(self, encoder_name=None, **kwargs): will be returned if default value is kept. - ``kwargs`` -- all additional arguments are forwarded to the construction of the - encoder that is used. + encoder that is used EXAMPLES:: diff --git a/src/sage/coding/punctured_code.py b/src/sage/coding/punctured_code.py index 228cdbfc04d..1d9b8b3ff12 100644 --- a/src/sage/coding/punctured_code.py +++ b/src/sage/coding/punctured_code.py @@ -100,9 +100,10 @@ class PuncturedCode(AbstractLinearCode): - ``C`` -- a linear code - - ``positions`` -- the positions where ``C`` will be punctured. It can be either an integer - if one need to puncture only one position, a list or a set of positions to puncture. - If the same position is passed several times, it will be considered only once. + - ``positions`` -- the positions where ``C`` will be punctured. It can be + either an integer if one need to puncture only one position, a list or a + set of positions to puncture. If the same position is passed several + times, it will be considered only once. EXAMPLES:: @@ -246,7 +247,7 @@ def random_element(self, *args, **kwds): INPUT: - ``agrs``, ``kwds`` -- extra positional arguments passed to - :meth:`sage.modules.free_module.random_element`. + :meth:`sage.modules.free_module.random_element` EXAMPLES:: @@ -479,7 +480,7 @@ class PuncturedCodeOriginalCodeDecoder(Decoder): sage: C = codes.GeneralizedReedSolomonCode(GF(16, 'a').list()[:15], 7) sage: Cp = codes.PuncturedCode(C, 3) - sage: D = codes.decoders.PuncturedCodeOriginalCodeDecoder(Cp, strategy="try-all") + sage: D = codes.decoders.PuncturedCodeOriginalCodeDecoder(Cp, strategy='try-all') sage: "error-erasure" in D.decoder_type() False @@ -490,7 +491,7 @@ class PuncturedCodeOriginalCodeDecoder(Decoder): sage: Cp = codes.PuncturedCode(C, 3) sage: Dor = C.decoder("Gao") sage: D = codes.decoders.PuncturedCodeOriginalCodeDecoder(Cp, original_decoder=Dor, - ....: strategy="error-erasure") + ....: strategy='error-erasure') sage: D.original_decoder() == Dor True """ diff --git a/src/sage/coding/reed_muller_code.py b/src/sage/coding/reed_muller_code.py index 01c2ccc4428..b8f005ba611 100644 --- a/src/sage/coding/reed_muller_code.py +++ b/src/sage/coding/reed_muller_code.py @@ -146,7 +146,7 @@ def ReedMullerCode(base_field, order, num_of_var): - ``base_field`` -- the finite field `F` over which the code is built - ``order`` -- the order of the Reed-Muller Code, which is the maximum - degree of the polynomial to be used in the code. + degree of the polynomial to be used in the code - ``num_of_var`` -- the number of variables used in polynomial @@ -208,7 +208,7 @@ class directly, as :meth:`ReedMullerCode` creates either a binary or a - ``base_field`` -- a finite field, which is the base field of the code - ``order`` -- the order of the Reed-Muller Code, i.e., the maximum degree - of the polynomial to be used in the code. + of the polynomial to be used in the code - ``num_of_var`` -- the number of variables used in polynomial diff --git a/src/sage/coding/self_dual_codes.py b/src/sage/coding/self_dual_codes.py index 3d65a2cdcec..13efd12d753 100644 --- a/src/sage/coding/self_dual_codes.py +++ b/src/sage/coding/self_dual_codes.py @@ -6,18 +6,18 @@ The main function is ``self_dual_binary_codes``, which is a case-by-case list of entries, each represented by a Python dictionary. -Format of each entry: a Python dictionary with keys ``"order autgp"``, ``"spectrum"``, -``"code"``, ``"Comment"``, ``"Type"``, where +Format of each entry: a Python dictionary with keys ``"order autgp"``, ``'spectrum'``, +``'code'``, ``'Comment'``, ``'Type'``, where -- ``"code"`` -- a sd code `C` of length `n`, dim `n/2`, over `\GF{2}` +- ``'code'`` -- a sd code `C` of length `n`, dim `n/2`, over `\GF{2}` - ``"order autgp"`` -- order of the permutation automorphism group of `C` -- ``"Type"`` -- the type of `C` (which can be ``"I"`` or ``"II"``, in the binary case) +- ``'Type'`` -- the type of `C` (which can be ``'I'`` or ``'II'``, in the binary case) -- ``"spectrum"`` -- the spectrum `[A_0,A_1,...,A_n]` +- ``'spectrum'`` -- the spectrum `[A_0,A_1,...,A_n]` -- ``"Comment"`` -- possibly an empty string +- ``'Comment'`` -- possibly an empty string Python dictionaries were used since they seemed to be both human-readable and allow others to update the database easiest. diff --git a/src/sage/coding/source_coding/huffman.py b/src/sage/coding/source_coding/huffman.py index 631c9848fdb..c97b0e455b6 100644 --- a/src/sage/coding/source_coding/huffman.py +++ b/src/sage/coding/source_coding/huffman.py @@ -513,7 +513,7 @@ def tree(self): g.add_edges(self._generate_edges(self._tree)) return g - def _generate_edges(self, tree, parent="", bit=""): + def _generate_edges(self, tree, parent='', bit=''): """ Generate the edges of the given Huffman tree. @@ -522,11 +522,11 @@ def _generate_edges(self, tree, parent="", bit=""): - ``tree`` -- a Huffman binary tree - ``parent`` -- (default: empty string) a parent vertex with exactly - two children. + two children - ``bit`` -- (default: empty string) the bit signifying either the - left or right branch. The bit "0" denotes the left branch and "1" - denotes the right branch. + left or right branch; the bit '0' denotes the left branch and '1' + denotes the right branch OUTPUT: an edge list of the Huffman binary tree @@ -544,8 +544,8 @@ def _generate_edges(self, tree, parent="", bit=""): u = parent s = "".join([parent, bit]) try: - left = self._generate_edges(tree[0], parent=s, bit="0") - right = self._generate_edges(tree[1], parent=s, bit="1") + left = self._generate_edges(tree[0], parent=s, bit='0') + right = self._generate_edges(tree[1], parent=s, bit='1') L = [(u, s)] if s != "" else [] return left + right + L except TypeError: diff --git a/src/sage/combinat/abstract_tree.py b/src/sage/combinat/abstract_tree.py index 8bc46f2d804..d7eef45927e 100644 --- a/src/sage/combinat/abstract_tree.py +++ b/src/sage/combinat/abstract_tree.py @@ -2304,7 +2304,7 @@ def as_digraph(self): from sage.graphs.digraph import DiGraph resu = {self.label(): [t.label() for t in self if not t.is_empty()]} - resu = DiGraph(resu, format="dict_of_lists") + resu = DiGraph(resu, format='dict_of_lists') for t in self: if not t.is_empty(): resu = resu.union(t.as_digraph()) diff --git a/src/sage/combinat/affine_permutation.py b/src/sage/combinat/affine_permutation.py index fdda2855daf..7088b3c95c1 100644 --- a/src/sage/combinat/affine_permutation.py +++ b/src/sage/combinat/affine_permutation.py @@ -219,7 +219,7 @@ def __call__(self, i): """ return self.value(i) - def is_i_grassmannian(self, i=0, side="right") -> bool: + def is_i_grassmannian(self, i=0, side='right') -> bool: r""" Test whether ``self`` is `i`-grassmannian, i.e., either is the identity or has ``i`` as the sole descent. @@ -258,7 +258,7 @@ def index_set(self): """ return tuple(range(self.k+1)) - def lower_covers(self,side="right"): + def lower_covers(self, side='right'): r""" Return lower covers of ``self``. diff --git a/src/sage/combinat/bijectionist.py b/src/sage/combinat/bijectionist.py index 206ec309d93..06175665f67 100644 --- a/src/sage/combinat/bijectionist.py +++ b/src/sage/combinat/bijectionist.py @@ -1748,7 +1748,7 @@ def possible_values(self, p=None, optimal=False): Test if all formats are really possible:: - sage: bij.possible_values(p="a") + sage: bij.possible_values(p='a') {'a': {1, 2}, 'b': {1, 2}} sage: bij.possible_values(p=["a", "b"]) {'a': {1, 2}, 'b': {1, 2}} @@ -1762,9 +1762,9 @@ def possible_values(self, p=None, optimal=False): sage: A = B = 'ab' sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2) sage: bij.set_constant_blocks([['a', 'b']]) - sage: bij.possible_values(p="a") + sage: bij.possible_values(p='a') {'a': {0, 1}, 'b': {0, 1}} - sage: bij.possible_values(p="a", optimal=True) + sage: bij.possible_values(p='a', optimal=True) {'a': set(), 'b': set()} """ # convert input to set of block representatives @@ -1893,7 +1893,7 @@ def minimal_subdistributions_iterator(self): # add constraint that not all of these can be 1, thus vetoing # the current solution minimal_subdistribution.add_constraint(sum(active_vars) <= len(active_vars) - 1, - name="veto") + name='veto') else: s = new_s @@ -2110,7 +2110,7 @@ def add_counter_example_constraint(s): support = [X[p] for p in P if d[p]] # add constraint that the support is different minimal_subdistribution.add_constraint(sum(support) <= len(support) - 1, - name="veto") + name='veto') else: s = new_s add_counter_example_constraint(s) @@ -2274,7 +2274,7 @@ def solutions_iterator(self): EXAMPLES:: sage: A = B = 'abc' - sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2, solver="GLPK") + sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2, solver='GLPK') sage: next(bij.solutions_iterator()) {'a': 0, 'b': 1, 'c': 0} @@ -2303,7 +2303,7 @@ def solutions_iterator(self): sage: P = [list(a) for n in range(N) for a in Permutations(n).conjugacy_classes()] - sage: bij = Bijectionist(A, B, tau, solver="GLPK") + sage: bij = Bijectionist(A, B, tau, solver='GLPK') sage: bij.set_statistics((len, len)) sage: bij.set_constant_blocks(P) sage: for solution in bij.solutions_iterator(): @@ -2534,7 +2534,7 @@ def show(self, variables=True): EXAMPLES:: sage: A = B = ["a", "b", "c"] - sage: bij = Bijectionist(A, B, lambda x: A.index(x) % 2, solver="GLPK") + sage: bij = Bijectionist(A, B, lambda x: A.index(x) % 2, solver='GLPK') sage: bij.set_constant_blocks([["a", "b"]]) sage: next(bij.solutions_iterator()) {'a': 0, 'b': 0, 'c': 1} @@ -2640,7 +2640,7 @@ def solutions_iterator(self, on_blocks, additional_constraints): TESTS:: sage: A = B = 'abc' - sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2, solver="GLPK") + sage: bij = Bijectionist(A, B, lambda x: B.index(x) % 2, solver='GLPK') sage: from sage.combinat.bijectionist import _BijectionistMILP sage: bmilp = _BijectionistMILP(bij) sage: it = bmilp.solutions_iterator(False, []) @@ -2729,7 +2729,7 @@ def _add_solution(self, solution): for z in self._bijectionist._possible_block_values[p] if solution[(p, z)]] self.milp.add_constraint(sum(active_vars) <= len(active_vars) - 1, - name="veto") + name='veto') self._solution_cache.append(solution) def _is_solution(self, constraint, values): @@ -2825,7 +2825,7 @@ def add_alpha_beta_constraints(self): for w in range(len(W)): for z in range(len(Z)): self.milp.add_constraint(AZ_matrix[z][w] == B_matrix[z][w], - name="statistics") + name='statistics') def add_distribution_constraints(self): r""" diff --git a/src/sage/combinat/binary_tree.py b/src/sage/combinat/binary_tree.py index 7db5de1e1da..5c6ee265100 100644 --- a/src/sage/combinat/binary_tree.py +++ b/src/sage/combinat/binary_tree.py @@ -869,7 +869,7 @@ def show(self, with_leaves=False): sage: t1.show() # needs sage.plot """ try: - self.graph(with_leaves=with_leaves).show(layout='tree', tree_root=0, tree_orientation="down") + self.graph(with_leaves=with_leaves).show(layout='tree', tree_root=0, tree_orientation='down') except RuntimeError: # This is for the border case BinaryTree().show(). self.graph(with_leaves=with_leaves).show() @@ -942,7 +942,7 @@ def make_leaf(self): self._require_mutable() self.__init__(self.parent(), None) - def _to_dyck_word_rec(self, usemap="1L0R"): + def _to_dyck_word_rec(self, usemap='1L0R'): r""" EXAMPLES:: @@ -1148,7 +1148,7 @@ def tamari_join(self, other): b = other.to_132_avoiding_permutation() return a.permutohedron_join(b).binary_search_tree_shape(left_to_right=False) - def tamari_meet(self, other, side="right"): + def tamari_meet(self, other, side='right'): r""" Return the meet of the binary trees ``self`` and ``other`` (of equal size) in the `n`-th Tamari poset (where `n` is @@ -1237,7 +1237,7 @@ def tamari_meet(self, other, side="right"): return from_tamari_sorting_tuple(meet) @combinatorial_map(name="to Dyck paths: up step, left tree, down step, right tree") - def to_dyck_word(self, usemap="1L0R"): + def to_dyck_word(self, usemap='1L0R'): r""" Return the Dyck word associated with ``self`` using the given map. @@ -1293,7 +1293,7 @@ def to_dyck_word(self, usemap="1L0R"): raise ValueError("%s is not a correct map" % usemap) return DyckWord(self._to_dyck_word_rec(usemap)) - def _to_ordered_tree(self, bijection="left", root=None): + def _to_ordered_tree(self, bijection='left', root=None): r""" Internal recursive method to obtain an ordered tree from a binary tree. @@ -1303,16 +1303,16 @@ def _to_ordered_tree(self, bijection="left", root=None): sage: bt = BinaryTree([[],[]]) sage: bt._to_ordered_tree() [[], [[]]] - sage: bt._to_ordered_tree(bijection="right") + sage: bt._to_ordered_tree(bijection='right') [[[]], []] - sage: bt._to_ordered_tree(bijection="none") + sage: bt._to_ordered_tree(bijection='none') Traceback (most recent call last): ... ValueError: the bijection argument should be either left or right sage: bt = BinaryTree([[[], [[], None]], [[], []]]) sage: bt._to_ordered_tree() [[], [[], []], [[], [[]]]] - sage: bt._to_ordered_tree(bijection="right") + sage: bt._to_ordered_tree(bijection='right') [[[[]], [[]]], [[]], []] """ close_root = False @@ -1377,7 +1377,7 @@ def to_ordered_tree_right_branch(self): sage: bt.to_ordered_tree_right_branch() [[[[]], [[]]], [[]], []] """ - return self._to_ordered_tree(bijection="right") + return self._to_ordered_tree(bijection='right') def _postfix_word(self, left_first=True, start=1): r""" @@ -1425,7 +1425,7 @@ def tamari_sorting_tuple(self, reverse=False): INPUT: - - ``reverse`` -- boolean (default ``False``) if ``True``, + - ``reverse`` -- boolean (default: ``False``); if ``True``, return instead the result for the left-right symmetric of the binary tree @@ -4643,7 +4643,7 @@ class LabelledBinaryTree(AbstractLabelledClonableTree, BinaryTree): sage: LabelledBinaryTree(None) . - sage: LabelledBinaryTree(None, label="ae") # not well supported + sage: LabelledBinaryTree(None, label='ae') # not well supported 'ae' sage: LabelledBinaryTree([]) None[., .] @@ -5182,7 +5182,7 @@ def _an_element_(self): t = LT([], label=3) t1 = LT([t, t], label=42) t2 = LT([[], []], label=5) - return LT([t1, t2], label="toto") + return LT([t1, t2], label='toto') def unlabelled_trees(self): """ @@ -5230,7 +5230,7 @@ def binary_search_tree_shape(w, left_to_right=True): - ``w`` -- list of integers - - ``left_to_right`` -- boolean (default ``True``) + - ``left_to_right`` -- boolean (default: ``True``) OUTPUT: a non labelled binary tree diff --git a/src/sage/combinat/chas/fsym.py b/src/sage/combinat/chas/fsym.py index 8987bd64283..384f3167766 100644 --- a/src/sage/combinat/chas/fsym.py +++ b/src/sage/combinat/chas/fsym.py @@ -351,7 +351,7 @@ def duality_pairing_matrix(self, basis, degree): INPUT: - ``basis`` -- a basis of the dual Hopf algebra - - ``degree`` -- a non-negative integer + - ``degree`` -- a nonnegative integer OUTPUT: diff --git a/src/sage/combinat/chas/wqsym.py b/src/sage/combinat/chas/wqsym.py index 567e1f1b9f5..474cbd7be76 100644 --- a/src/sage/combinat/chas/wqsym.py +++ b/src/sage/combinat/chas/wqsym.py @@ -918,7 +918,7 @@ def __init__(self, alg): WQSymBasis_abstract.__init__(self, alg) X = self.realization_of().X() - phi = self.module_morphism(self._C_to_X, codomain=X, unitriangular="upper") + phi = self.module_morphism(self._C_to_X, codomain=X, unitriangular='upper') phi.register_as_coercion() inv_phi = ~phi inv_phi.register_as_coercion() @@ -1067,9 +1067,9 @@ def __init__(self, alg): WQSymBasis_abstract.__init__(self, alg) M = self.realization_of().M() - phi = self.module_morphism(self._Q_to_M, codomain=M, unitriangular="lower") + phi = self.module_morphism(self._Q_to_M, codomain=M, unitriangular='lower') phi.register_as_coercion() - phi_inv = M.module_morphism(self._M_to_Q, codomain=self, unitriangular="lower") + phi_inv = M.module_morphism(self._M_to_Q, codomain=self, unitriangular='lower') phi_inv.register_as_coercion() def some_elements(self): @@ -1449,9 +1449,9 @@ def __init__(self, alg): WQSymBasis_abstract.__init__(self, alg) M = self.realization_of().M() - phi = self.module_morphism(self._Phi_to_M, codomain=M, unitriangular="lower") + phi = self.module_morphism(self._Phi_to_M, codomain=M, unitriangular='lower') phi.register_as_coercion() - phi_inv = M.module_morphism(self._M_to_Phi, codomain=self, unitriangular="lower") + phi_inv = M.module_morphism(self._M_to_Phi, codomain=self, unitriangular='lower') phi_inv.register_as_coercion() def some_elements(self): @@ -2572,9 +2572,7 @@ def to_quasisymmetric_function(self): sizes of the blocks of `P`. This `\pi` is a ring homomorphism. - OUTPUT: - - - an element of the quasisymmetric functions in the monomial basis + OUTPUT: an element of the quasisymmetric functions in the monomial basis EXAMPLES:: diff --git a/src/sage/combinat/cluster_complex.py b/src/sage/combinat/cluster_complex.py index a731fc48318..bc1b9dd54d1 100644 --- a/src/sage/combinat/cluster_complex.py +++ b/src/sage/combinat/cluster_complex.py @@ -74,7 +74,7 @@ def cluster(self): """ if self.parent().k() != 1: raise NotImplementedError("not working for multi-cluster complexes") - F = self.parent().greedy_facet(side="positive") + F = self.parent().greedy_facet(side='positive') R = F.extended_root_configuration() N = len(list(F)) return [-R[i] if i < N else R[i] for i in self] @@ -173,7 +173,7 @@ class ClusterComplex(SubwordComplex): """ @staticmethod - def __classcall__(cls, W, k=1, coxeter_element=None, algorithm="inductive"): + def __classcall__(cls, W, k=1, coxeter_element=None, algorithm='inductive'): r""" Standardize input to ensure a unique representation. @@ -184,7 +184,7 @@ def __classcall__(cls, W, k=1, coxeter_element=None, algorithm="inductive"): sage: S2 = ClusterComplex(W) sage: S3 = ClusterComplex(CoxeterMatrix('B2'), coxeter_element=(1,2)) sage: w = W.from_reduced_word([1,2]) - sage: S4 = ClusterComplex('B2', coxeter_element=w, algorithm="inductive") + sage: S4 = ClusterComplex('B2', coxeter_element=w, algorithm='inductive') sage: S1 is S2 and S2 is S3 and S3 is S4 True """ diff --git a/src/sage/combinat/combinat.py b/src/sage/combinat/combinat.py index 7a5ea160176..7e57033a5df 100644 --- a/src/sage/combinat/combinat.py +++ b/src/sage/combinat/combinat.py @@ -201,13 +201,13 @@ def bell_number(n, algorithm='flint', **options) -> Integer: - ``algorithm`` -- (Default: ``'flint'``) any one of the following: - - ``'dobinski'`` -- Use Dobinski's formula implemented in Sage + - ``'dobinski'`` -- use Dobinski's formula implemented in Sage - - ``'flint'`` -- Wrap FLINT's ``arith_bell_number`` + - ``'flint'`` -- wrap FLINT's ``arith_bell_number`` - - ``'gap'`` -- Wrap GAP's ``Bell`` + - ``'gap'`` -- wrap GAP's ``Bell`` - - ``'mpmath'`` -- Wrap mpmath's ``bell`` + - ``'mpmath'`` -- wrap mpmath's ``bell`` .. WARNING:: @@ -503,9 +503,9 @@ def narayana_number(n: Integer, k: Integer) -> Integer: INPUT: - - ``n`` -- an integer + - ``n`` -- integer - - ``k`` -- an integer between ``0`` and ``n - 1`` + - ``k`` -- integer between ``0`` and ``n - 1`` OUTPUT: integer @@ -535,11 +535,11 @@ def euler_number(n, algorithm='flint') -> Integer: - ``n`` -- a positive integer - - ``algorithm`` -- (Default: ``'flint'``) any one of the following: + - ``algorithm`` -- (default: ``'flint'``) any one of the following: - - ``'maxima'`` -- Wraps Maxima's ``euler``. + - ``'maxima'`` -- wraps Maxima's ``euler`` - - ``'flint'`` -- Wrap FLINT's ``arith_euler_number`` + - ``'flint'`` -- wrap FLINT's ``arith_euler_number`` EXAMPLES:: @@ -589,7 +589,7 @@ def eulerian_number(n, k, algorithm='recursive') -> Integer: - ``k`` -- integer between ``0`` and ``n - 1`` - - ``algorithm`` -- ``"recursive"`` (default) or ``"formula"`` + - ``algorithm`` -- ``'recursive'`` (default) or ``'formula'`` OUTPUT: integer @@ -631,9 +631,9 @@ def eulerian_polynomial(n, algorithm='derivative'): INPUT: - - ``n`` -- an integer + - ``n`` -- integer - - ``algorithm`` -- ``"derivative"`` (default) or ``"coeffs"`` + - ``algorithm`` -- ``'derivative'`` (default) or ``'coeffs'`` OUTPUT: polynomial in one variable ``t`` @@ -671,7 +671,7 @@ def eulerian_polynomial(n, algorithm='derivative'): return R([eulerian_number(n, k, "formula") for k in range(n)]) -def fibonacci(n, algorithm="pari") -> Integer: +def fibonacci(n, algorithm='pari') -> Integer: """ Return the `n`-th Fibonacci number. @@ -685,10 +685,10 @@ def fibonacci(n, algorithm="pari") -> Integer: - ``algorithm`` -- a string: - * ``"pari"`` -- (default) use the PARI C library's + * ``'pari'`` -- (default) use the PARI C library's :pari:`fibo` function - * ``"gap"`` -- use GAP's Fibonacci function + * ``'gap'`` -- use GAP's Fibonacci function .. NOTE:: @@ -849,7 +849,7 @@ def lucas_number2(n, P, Q): return libgap.Lucas(P, Q, n)[1].sage() -def stirling_number1(n, k, algorithm="gap") -> Integer: +def stirling_number1(n, k, algorithm='gap') -> Integer: r""" Return the `n`-th Stirling number `S_1(n,k)` of the first kind. @@ -863,8 +863,8 @@ def stirling_number1(n, k, algorithm="gap") -> Integer: - ``k`` -- nonnegative machine-size integer - ``algorithm``: - * ``"gap"`` (default) -- use GAP's ``Stirling1`` function - * ``"flint"`` -- use flint's ``arith_stirling_number_1u`` function + * ``'gap'`` (default) -- use GAP's ``Stirling1`` function + * ``'flint'`` -- use flint's ``arith_stirling_number_1u`` function EXAMPLES:: @@ -885,7 +885,7 @@ def stirling_number1(n, k, algorithm="gap") -> Integer: sage: stirling_number1(10,5, algorithm='flint') # needs sage.libs.flint 269325 - sage: s_sage = stirling_number1(50,3, algorithm="mutta") + sage: s_sage = stirling_number1(50,3, algorithm='mutta') Traceback (most recent call last): ... ValueError: unknown algorithm: mutta @@ -918,9 +918,9 @@ def stirling_number2(n, k, algorithm=None) -> Integer: - ``algorithm``: * ``None`` (default) -- use native implementation - * ``"flint"`` -- use flint's ``arith_stirling_number_2`` function - * ``"gap"`` -- use GAP's ``Stirling2`` function - * ``"maxima"`` -- use Maxima's ``stirling2`` function + * ``'flint'`` -- use flint's ``arith_stirling_number_2`` function + * ``'gap'`` -- use GAP's ``Stirling2`` function + * ``'maxima'`` -- use Maxima's ``stirling2`` function EXAMPLES: @@ -1008,10 +1008,10 @@ def stirling_number2(n, k, algorithm=None) -> Integer: ....: if not (s_sage == s_flint and s_sage == s_gap): ....: print("Error with n<200") - sage: stirling_number2(20, 3, algorithm="maxima") # needs sage.symbolic + sage: stirling_number2(20, 3, algorithm='maxima') # needs sage.symbolic 580606446 - sage: s_sage = stirling_number2(5, 3, algorithm="namba") + sage: s_sage = stirling_number2(5, 3, algorithm='namba') Traceback (most recent call last): ... ValueError: unknown algorithm: namba @@ -1134,7 +1134,7 @@ def __init__(self, l, copy=True): INPUT: - - ``l`` -- a list or any object that can be converted to a + - ``l`` -- list or any object that can be converted to a list by calling ``list()``. - ``copy`` -- (boolean, default ``True``) if ``False``, then @@ -1378,7 +1378,7 @@ def __hash__(self): def __bool__(self) -> bool: """ - Return ``True`` if ``self`` is non-zero. + Return ``True`` if ``self`` is nonzero. We consider a list to be zero if it has length zero. @@ -1499,10 +1499,10 @@ class CombinatorialElement(CombinatorialObject, Element, INPUT: - - ``parent`` -- the :class:`Parent` class for this element. + - ``parent`` -- the :class:`Parent` class for this element - - ``lst`` -- a list or any object that can be converted to a - list by calling ``list()``. + - ``lst`` -- list or any object that can be converted to a + list by calling ``list()`` EXAMPLES:: @@ -1652,7 +1652,7 @@ def _tuples_native(S, k): Return a list of all `k`-tuples of elements of a given set ``S``. This is a helper method used in :meth:`tuples`. It returns the - same as ``tuples(S, k, algorithm="native")``. + same as ``tuples(S, k, algorithm='native')``. EXAMPLES:: @@ -1703,16 +1703,16 @@ def number_of_tuples(S, k, algorithm='naive') -> Integer: sage: S = [1,2,3,4,5] sage: number_of_tuples(S,2) 25 - sage: number_of_tuples(S,2, algorithm="gap") # needs sage.libs.gap + sage: number_of_tuples(S,2, algorithm='gap') # needs sage.libs.gap 25 sage: S = [1,1,2,3,4,5] sage: number_of_tuples(S,2) 25 - sage: number_of_tuples(S,2, algorithm="gap") # needs sage.libs.gap + sage: number_of_tuples(S,2, algorithm='gap') # needs sage.libs.gap 25 sage: number_of_tuples(S,0) 1 - sage: number_of_tuples(S,0, algorithm="gap") # needs sage.libs.gap + sage: number_of_tuples(S,0, algorithm='gap') # needs sage.libs.gap 1 """ if algorithm == 'naive': @@ -1819,16 +1819,16 @@ def number_of_unordered_tuples(S, k, algorithm='naive') -> Integer: sage: S = [1,2,3,4,5] sage: number_of_unordered_tuples(S,2) 15 - sage: number_of_unordered_tuples(S,2, algorithm="gap") # needs sage.libs.gap + sage: number_of_unordered_tuples(S,2, algorithm='gap') # needs sage.libs.gap 15 sage: S = [1,1,2,3,4,5] sage: number_of_unordered_tuples(S,2) 15 - sage: number_of_unordered_tuples(S,2, algorithm="gap") # needs sage.libs.gap + sage: number_of_unordered_tuples(S,2, algorithm='gap') # needs sage.libs.gap 15 sage: number_of_unordered_tuples(S,0) 1 - sage: number_of_unordered_tuples(S,0, algorithm="gap") # needs sage.libs.gap + sage: number_of_unordered_tuples(S,0, algorithm='gap') # needs sage.libs.gap 1 """ if algorithm == 'naive': @@ -2260,7 +2260,7 @@ def bernoulli_polynomial(x, n: Integer): if n < 0: raise TypeError except TypeError: - raise ValueError("the second argument must be a non-negative integer") + raise ValueError("the second argument must be a nonnegative integer") if n == 0: return x**0 # result should be in the parent of x diff --git a/src/sage/combinat/combinatorial_map.py b/src/sage/combinat/combinatorial_map.py index 84876e52f56..3fe38ae30b6 100644 --- a/src/sage/combinat/combinatorial_map.py +++ b/src/sage/combinat/combinatorial_map.py @@ -70,9 +70,7 @@ def combinatorial_map_trivial(f=None, order=None, name=None): - ``name`` -- (default: ``None``) the name for nicer outputs on combinatorial maps - ``order`` -- (default: ``None``) the order of the combinatorial map, if it is known. Is not used, but might be helpful later - OUTPUT: - - - ``f`` unchanged + OUTPUT: ``f`` unchanged EXAMPLES:: @@ -119,9 +117,7 @@ def combinatorial_map_wrapper(f=None, order=None, name=None): - ``name`` -- (default: ``None``) the name for nicer outputs on combinatorial maps - ``order`` -- (default: ``None``) the order of the combinatorial map, if it is known. Is not used, but might be helpful later - OUTPUT: - - - A combinatorial map. This is an instance of the :class:`CombinatorialMap`. + OUTPUT: a combinatorial map; this is an instance of the :class:`CombinatorialMap` EXAMPLES: diff --git a/src/sage/combinat/composition.py b/src/sage/combinat/composition.py index 0e455ecbefc..ea49e2f55dc 100644 --- a/src/sage/combinat/composition.py +++ b/src/sage/combinat/composition.py @@ -180,7 +180,7 @@ def _ascii_art_(self): [ * ** * * ] [ * * ** *** * ** * ] [ *, * , * , * , **, ** , ***, **** ] - sage: Partitions.options(diagram_str='#', convention="French") + sage: Partitions.options(diagram_str='#', convention='French') sage: ascii_art(Compositions(4).list()) [ # ] [ # # # ## ] @@ -202,7 +202,7 @@ def _unicode_art_(self): ⎢ ├┤ ├┼┘ ┌┼┤ ┌┬┬┐ ├┤ ┌┬┐ ┌┐ ⎥ ⎢ ├┤ ├┤ ├┼┘ ├┼┴┘ ┌┼┤ ┌┼┼┘ ┌┬┼┤ ┌┬┬┬┐ ⎥ ⎣ └┘, └┘ , └┘ , └┘ , └┴┘, └┴┘ , └┴┴┘, └┴┴┴┘ ⎦ - sage: Partitions.options(diagram_str='#', convention="French") + sage: Partitions.options(diagram_str='#', convention='French') sage: unicode_art(Compositions(4).list()) ⎡ ┌┐ ⎤ ⎢ ├┤ ┌┐ ┌┐ ┌┬┐ ⎥ @@ -363,7 +363,7 @@ def sum(compositions) -> Composition: INPUT: - - ``compositions`` -- a list (or iterable) of compositions + - ``compositions`` -- list (or iterable) of compositions EXAMPLES:: @@ -559,9 +559,7 @@ def join(self, other, check=True) -> Composition: - ``check`` -- boolean (default: ``True``); whether to check the input compositions for having the same size - OUTPUT: - - - the join of the compositions ``self`` and ``other`` + OUTPUT: the join of the compositions ``self`` and ``other`` EXAMPLES:: @@ -684,9 +682,7 @@ def meet(self, other, check=True) -> Composition: - ``check`` -- boolean (default: ``True``); whether to check the input compositions for having the same size - OUTPUT: - - - the meet of the compositions ``self`` and ``other`` + OUTPUT: the meet of the compositions ``self`` and ``other`` EXAMPLES:: @@ -923,7 +919,7 @@ def refinement_splitting(self, J) -> list[Composition]: INPUT: - - ``J`` -- A composition such that ``self`` is finer than ``J`` + - ``J`` -- a composition such that ``self`` is finer than ``J`` OUTPUT: @@ -1481,10 +1477,10 @@ class Compositions(UniqueRepresentation, Parent): [1, 2, 1] If `n` is not specified, this returns the combinatorial class of - all (non-negative) integer compositions:: + all (nonnegative) integer compositions:: sage: Compositions() - Compositions of non-negative integers + Compositions of nonnegative integers sage: [] in Compositions() True sage: [2,3,1] in Compositions() @@ -1830,7 +1826,7 @@ def from_subset(self, S, n) -> Composition: - ``S`` -- an iterable, a subset of `\{1, 2, \ldots, n-1\}` - - ``n`` -- an integer + - ``n`` -- integer EXAMPLES:: @@ -1944,9 +1940,9 @@ def _repr_(self) -> str: TESTS:: sage: repr(Compositions()) - 'Compositions of non-negative integers' + 'Compositions of nonnegative integers' """ - return "Compositions of non-negative integers" + return "Compositions of nonnegative integers" def subset(self, size=None): """ diff --git a/src/sage/combinat/composition_tableau.py b/src/sage/combinat/composition_tableau.py index 8ee363fb275..0d67d73e03e 100644 --- a/src/sage/combinat/composition_tableau.py +++ b/src/sage/combinat/composition_tableau.py @@ -37,7 +37,7 @@ class CompositionTableau(CombinatorialElement, metaclass=ClasscallMetaclass): INPUT: - - ``t`` -- A list of lists + - ``t`` -- list of lists EXAMPLES:: @@ -403,7 +403,7 @@ def __classcall_private__(cls, *args, **kwargs): if not isinstance(size, (int, Integer)): raise ValueError("size must be an integer") elif size < 0: - raise ValueError("size must be non-negative") + raise ValueError("size must be nonnegative") if shape is not None: # use in (and not isinstance) below so that lists can be used as @@ -411,7 +411,7 @@ def __classcall_private__(cls, *args, **kwargs): if shape not in Compositions(): raise ValueError("shape must be a composition") if any(i == 0 for i in shape): - raise ValueError("shape must have non-zero parts") + raise ValueError("shape must have nonzero parts") shape = Composition(shape) if (size is not None) and (shape is not None): @@ -460,9 +460,7 @@ def _element_constructor_(self, t): - ``t`` -- data which can be interpreted as a composition tableau - OUTPUT: - - - The corresponding CompositionTableau object + OUTPUT: the corresponding CompositionTableau object TESTS:: @@ -572,8 +570,8 @@ class CompositionTableaux_size(CompositionTableaux): INPUT: - - ``n`` -- a nonnegative integer. - - ``max_entry`` -- a nonnegative integer. This keyword argument defaults to ``n``. + - ``n`` -- a nonnegative integer + - ``max_entry`` -- a nonnegative integer (default: `n`) OUTPUT: @@ -674,9 +672,8 @@ class CompositionTableaux_shape(CompositionTableaux): INPUT: - - ``comp`` -- a composition. - - ``max_entry`` -- a nonnegative integer. This keyword argument defaults - to the size of ``comp``. + - ``comp`` -- a composition + - ``max_entry`` -- a nonnegative integer (default: size of ``comp``) """ def __init__(self, comp, max_entry=None): """ diff --git a/src/sage/combinat/constellation.py b/src/sage/combinat/constellation.py index 67590f06630..21ebb504bd5 100644 --- a/src/sage/combinat/constellation.py +++ b/src/sage/combinat/constellation.py @@ -133,15 +133,16 @@ def Constellation(g=None, mutable=False, connected=True, check=True): INPUT: - - ``g`` -- a list of permutations + - ``g`` -- list of permutations - - ``mutable`` -- whether the result is mutable or not. Default is ``False``. + - ``mutable`` -- boolean (default: ``False``); whether the result is + mutable or not - - ``connected`` -- whether the result should be connected. Default is - ``True``. + - ``connected`` -- boolean (default: ``True``); whether the result should + be connected - - ``check`` -- whether or not to check. If it is ``True``, then the - list ``g`` must contains no ``None``. + - ``check`` -- boolean (default: ``True``); whether or not to check. If it + is ``True``, then the list ``g`` must contain no ``None``. EXAMPLES: @@ -930,9 +931,9 @@ def __init__(self, length, degree, sym=None, connected=True): self._length = length self._degree = degree if self._length < 0: - raise ValueError("length should be a non-negative integer") + raise ValueError("length should be a nonnegative integer") if self._degree < 0: - raise ValueError("degree should be a non-negative integer") + raise ValueError("degree should be a nonnegative integer") self._sym = sym @@ -1185,9 +1186,7 @@ def braid_group_action(self): Return a list of graphs that corresponds to the braid group action on ``self`` up to isomorphism. - OUTPUT: - - - list of graphs + OUTPUT: list of graphs EXAMPLES:: @@ -1276,7 +1275,7 @@ def __init__(self, profile, domain=None, connected=True): r""" OPTIONS: - - ``profile`` -- a list of integer partitions of the same integer + - ``profile`` -- list of integer partitions of the same integer - ``connected`` -- boolean (default: ``True``); whether we consider only connected constellations @@ -1464,10 +1463,10 @@ def perms_sym_init(g, sym=None): Initialize a list of permutations (in the same symmetric group). OUTPUT: - + - ``sym`` -- a symmetric group - - ``gg`` -- a list of permutations + - ``gg`` -- list of permutations EXAMPLES:: diff --git a/src/sage/combinat/core.py b/src/sage/combinat/core.py index d3d169f934c..8fcb778ac1f 100644 --- a/src/sage/combinat/core.py +++ b/src/sage/combinat/core.py @@ -382,9 +382,8 @@ def _transposition_to_reduced_word(self, t): - a tuple `[r,s]` such that `r` and `s` are not equivalent mod `k` - OUTPUT: - - - a list of integers in `\{0,1,\ldots,k-1\}` representing a reduced word for the transposition `t` + OUTPUT: a list of integers in `\{0,1,\ldots,k-1\}` representing a + reduced word for the transposition `t` EXAMPLES:: diff --git a/src/sage/combinat/cyclic_sieving_phenomenon.py b/src/sage/combinat/cyclic_sieving_phenomenon.py index 8ad3bfc1f0c..5c7bccb9898 100644 --- a/src/sage/combinat/cyclic_sieving_phenomenon.py +++ b/src/sage/combinat/cyclic_sieving_phenomenon.py @@ -173,9 +173,7 @@ def orbit_decomposition(L, cyc_act) -> list[list]: - ``cyc_act`` -- bijective function from ``L`` to ``L`` - OUTPUT: - - - a list of lists, the orbits under the cyc_act acting on ``L`` + OUTPUT: list of lists, the orbits under the cyc_act acting on ``L`` EXAMPLES:: diff --git a/src/sage/combinat/debruijn_sequence.pyx b/src/sage/combinat/debruijn_sequence.pyx index 01dbf826c90..cd4c7aa5a32 100644 --- a/src/sage/combinat/debruijn_sequence.pyx +++ b/src/sage/combinat/debruijn_sequence.pyx @@ -74,9 +74,9 @@ def debruijn_sequence(int k, int n): INPUT: - - ``k`` -- Arity. Must be an integer. + - ``k`` -- arity; must be an integer - - ``n`` -- Substring length. Must be an integer. + - ``n`` -- substring length; must be an integer EXAMPLES:: @@ -113,14 +113,14 @@ cdef gen(int t, int p, k, n): def is_debruijn_sequence(seq, k, n): r""" - Given a sequence of integer elements in `0..k-1`, tests whether it + Given a sequence of integer elements in `0, \ldots, k-1`, tests whether it corresponds to a De Bruijn sequence of parameters `k` and `n`. INPUT: - - ``seq`` -- Sequence of elements in `0..k-1`. + - ``seq`` -- sequence of elements in `0, \ldots, k-1` - - ``n``, ``k`` -- Integers. + - ``n``, ``k`` -- integers EXAMPLES:: @@ -206,10 +206,10 @@ class DeBruijnSequences(UniqueRepresentation, Parent): INPUT: - - ``k`` -- A natural number to define arity. The letters used are the - integers `0..k-1`. + - ``k`` -- a natural number to define arity; the letters used are the + integers `0, \ldots, k-1` - - ``n`` -- A natural number that defines the length of the substring. + - ``n`` -- a natural number that defines the length of the substring EXAMPLES: @@ -325,7 +325,7 @@ class DeBruijnSequences(UniqueRepresentation, Parent): INPUT: - - ``seq`` -- A sequence of integers. + - ``seq`` -- a sequence of integers EXAMPLES:: diff --git a/src/sage/combinat/decorated_permutation.py b/src/sage/combinat/decorated_permutation.py index 817be65223d..ea1f06eebc8 100644 --- a/src/sage/combinat/decorated_permutation.py +++ b/src/sage/combinat/decorated_permutation.py @@ -137,7 +137,7 @@ class DecoratedPermutations(UniqueRepresentation, Parent): INPUT: - - `n` -- an integer, the size of the decorated permutations. + - `n` -- integer; the size of the decorated permutations EXAMPLES: diff --git a/src/sage/combinat/derangements.py b/src/sage/combinat/derangements.py index 6b2d868b90d..53398e6b727 100644 --- a/src/sage/combinat/derangements.py +++ b/src/sage/combinat/derangements.py @@ -89,7 +89,7 @@ class Derangements(UniqueRepresentation, Parent): INPUT: - - ``x`` -- Can be an integer which corresponds to derangements of + - ``x`` -- can be an integer which corresponds to derangements of `\{1, 2, 3, \ldots, x\}`, a list, or a string REFERENCES: diff --git a/src/sage/combinat/descent_algebra.py b/src/sage/combinat/descent_algebra.py index 8ab3886012f..0cdb21c3dad 100644 --- a/src/sage/combinat/descent_algebra.py +++ b/src/sage/combinat/descent_algebra.py @@ -219,7 +219,7 @@ class D(CombinatorialFreeModule, BindableClass): [D{}] """ - def __init__(self, alg, prefix="D"): + def __init__(self, alg, prefix='D'): r""" Initialize ``self``. @@ -422,7 +422,7 @@ class B(CombinatorialFreeModule, BindableClass): The basis element `B_p` is denoted `\Xi^p` in [Sch2004]_. By using compositions of `n`, the product `B_p B_q` becomes a - sum over the non-negative-integer matrices `M` with row sum `p` + sum over the nonnegative-integer matrices `M` with row sum `p` and column sum `q`. The summand corresponding to `M` is `B_c`, where `c` is the composition obtained by reading `M` row-by-row from left-to-right and top-to-bottom and removing all zeroes. @@ -438,7 +438,7 @@ class B(CombinatorialFreeModule, BindableClass): B[2, 1, 1], B[2, 2], B[3, 1], B[4]] """ - def __init__(self, alg, prefix="B"): + def __init__(self, alg, prefix='B'): r""" Initialize ``self``. @@ -671,7 +671,7 @@ class I(CombinatorialFreeModule, BindableClass): [I[1, 1, 1, 1], I[1, 1, 2], I[1, 2, 1], I[1, 3], I[2, 1, 1], I[2, 2], I[3, 1], I[4]] """ - def __init__(self, alg, prefix="I"): + def __init__(self, alg, prefix='I'): r""" Initialize ``self``. diff --git a/src/sage/combinat/diagram.py b/src/sage/combinat/diagram.py index 61a97249779..c81fc21b64a 100644 --- a/src/sage/combinat/diagram.py +++ b/src/sage/combinat/diagram.py @@ -481,7 +481,7 @@ def check(self): sage: D = Diagram([(0,0), (0,-3), (2,2), (2,4)]) Traceback (most recent call last): ... - ValueError: diagrams must be indexed by non-negative integers + ValueError: diagrams must be indexed by nonnegative integers The next example fails because one cell is indexed by rational numbers:: @@ -489,12 +489,12 @@ def check(self): sage: D = Diagram([(0,0), (0,3), (2/3,2), (2,4)]) Traceback (most recent call last): ... - ValueError: diagrams must be indexed by non-negative integers + ValueError: diagrams must be indexed by nonnegative integers """ from sage.sets.non_negative_integers import NonNegativeIntegers NN = NonNegativeIntegers() if not all(i in NN for c in self._cells for i in c): - raise ValueError("diagrams must be indexed by non-negative integers") + raise ValueError("diagrams must be indexed by nonnegative integers") def specht_module(self, base_ring=None): r""" @@ -891,7 +891,7 @@ def check(self): sage: NorthwestDiagram([(0,1/2)]) Traceback (most recent call last): ... - ValueError: diagrams must be indexed by non-negative integers + ValueError: diagrams must be indexed by nonnegative integers """ from itertools import combinations Diagram.check(self) diff --git a/src/sage/combinat/diagram_algebras.py b/src/sage/combinat/diagram_algebras.py index 2971dd851c8..5bc8ae55fea 100644 --- a/src/sage/combinat/diagram_algebras.py +++ b/src/sage/combinat/diagram_algebras.py @@ -449,9 +449,7 @@ def base_diagram(self): r""" Return the underlying implementation of the diagram. - OUTPUT: - - - tuple of tuples of integers + OUTPUT: tuple of tuples of integers EXAMPLES:: @@ -1589,7 +1587,7 @@ def from_involution_permutation_triple(self, D1_D2_pi): INPUT: - - ``D1_D2_pi`` -- a list or tuple where the first entry is a list of + - ``D1_D2_pi`` -- list or tuple where the first entry is a list of arcs on the top of the diagram, the second entry is a list of arcs on the bottom of the diagram, and the third entry is a permutation on the free nodes. @@ -2286,12 +2284,10 @@ class PartitionAlgebra(DiagramBasis, UnitDiagramMixin): - ``q`` -- the deformation parameter `q` - OPTIONAL ARGUMENTS: - - - ``base_ring`` -- (default ``None``) a ring containing ``q``; if + - ``base_ring`` -- (default: ``None``) a ring containing ``q``; if ``None``, then Sage automatically chooses the parent of ``q`` - - ``prefix`` -- (default ``"P"``) a label for the basis elements + - ``prefix`` -- (default: ``'P'``) a label for the basis elements EXAMPLES: @@ -2516,7 +2512,7 @@ class PartitionAlgebra(DiagramBasis, UnitDiagramMixin): True """ @staticmethod - def __classcall_private__(cls, k, q, base_ring=None, prefix="P"): + def __classcall_private__(cls, k, q, base_ring=None, prefix='P'): r""" Standardize the input by getting the base ring from the parent of the parameter ``q`` if no ``base_ring`` is given. @@ -2751,7 +2747,7 @@ def a(self, i): INPUT: - - ``i`` -- an integer between 1 and `k-1` + - ``i`` -- integer between 1 and `k-1` EXAMPLES:: @@ -2851,7 +2847,7 @@ def s(self, i): INPUT: - - ``i`` -- an integer between 1 and `k-1` + - ``i`` -- integer between 1 and `k-1` EXAMPLES:: @@ -3715,12 +3711,10 @@ class BrauerAlgebra(SubPartitionAlgebra, UnitDiagramMixin): - ``q`` -- the deformation parameter `q` - OPTIONAL ARGUMENTS: - - - ``base_ring`` -- (default ``None``) a ring containing ``q``; if ``None`` + - ``base_ring`` -- (default: ``None``) a ring containing ``q``; if ``None`` then just takes the parent of ``q`` - - ``prefix`` -- (default ``"B"``) a label for the basis elements + - ``prefix`` -- (default: ``'B'``) a label for the basis elements EXAMPLES: @@ -3760,7 +3754,7 @@ class BrauerAlgebra(SubPartitionAlgebra, UnitDiagramMixin): """ @staticmethod - def __classcall_private__(cls, k, q, base_ring=None, prefix="B"): + def __classcall_private__(cls, k, q, base_ring=None, prefix='B'): r""" Standardize the input by getting the base ring from the parent of the parameter ``q`` if no ``base_ring`` is given. @@ -4156,12 +4150,10 @@ class TemperleyLiebAlgebra(SubPartitionAlgebra, UnitDiagramMixin): - ``q`` -- the deformation parameter `q` - OPTIONAL ARGUMENTS: - - - ``base_ring`` -- (default ``None``) a ring containing ``q``; if ``None`` + - ``base_ring`` -- (default: ``None``) a ring containing ``q``; if ``None`` then just takes the parent of ``q`` - - ``prefix`` -- (default ``"T"``) a label for the basis elements + - ``prefix`` -- (default: ``'T'``) a label for the basis elements EXAMPLES: @@ -4245,7 +4237,7 @@ class TemperleyLiebAlgebra(SubPartitionAlgebra, UnitDiagramMixin): 1 7 20 21 13 """ @staticmethod - def __classcall_private__(cls, k, q, base_ring=None, prefix="T"): + def __classcall_private__(cls, k, q, base_ring=None, prefix='T'): r""" Standardize the input by getting the base ring from the parent of the parameter ``q`` if no ``base_ring`` is given. @@ -4523,12 +4515,10 @@ class PlanarAlgebra(SubPartitionAlgebra, UnitDiagramMixin): - ``q`` -- the deformation parameter `q` - OPTIONAL ARGUMENTS: - - - ``base_ring`` -- (default ``None``) a ring containing ``q``; if ``None`` + - ``base_ring`` -- (default: ``None``) a ring containing ``q``; if ``None`` then just takes the parent of ``q`` - - ``prefix`` -- (default ``"Pl"``) a label for the basis elements + - ``prefix`` -- (default: ``'Pl'``) a label for the basis elements EXAMPLES: @@ -4564,7 +4554,7 @@ class PlanarAlgebra(SubPartitionAlgebra, UnitDiagramMixin): True """ @staticmethod - def __classcall_private__(cls, k, q, base_ring=None, prefix="Pl"): + def __classcall_private__(cls, k, q, base_ring=None, prefix='Pl'): r""" Standardize the input by getting the base ring from the parent of the parameter ``q`` if no ``base_ring`` is given. @@ -4653,7 +4643,7 @@ class PropagatingIdeal(SubPartitionAlgebra): True """ @staticmethod - def __classcall_private__(cls, k, q, base_ring=None, prefix="I"): + def __classcall_private__(cls, k, q, base_ring=None, prefix='I'): r""" Standardize the input by getting the base ring from the parent of the parameter ``q`` if no ``base_ring`` is given. @@ -4736,7 +4726,7 @@ def TL_diagram_ascii_art(diagram, use_unicode=False, blobs=[]): INPUT: - - ``diagram`` -- a list of pairs of matchings of the set + - ``diagram`` -- list of pairs of matchings of the set `\{-1, \ldots, -n, 1, \ldots, n\}` - ``use_unicode`` -- (default: ``False``): whether or not to use unicode art instead of ascii art @@ -5798,12 +5788,10 @@ def to_set_partition(l, k=None): INPUT: - - ``l`` -- a list of lists of integers + - ``l`` -- list of lists of integers - ``k`` -- integer (default: ``None``) - OUTPUT: - - - a list of sets + OUTPUT: list of sets EXAMPLES:: diff --git a/src/sage/combinat/dyck_word.py b/src/sage/combinat/dyck_word.py index 3a471b2727d..1ea22baec12 100644 --- a/src/sage/combinat/dyck_word.py +++ b/src/sage/combinat/dyck_word.py @@ -161,7 +161,7 @@ def replace_symbols(x): INPUT: - - ``x`` -- either ``open_symbol`` or ``close_symbol``. + - ``x`` -- either ``open_symbol`` or ``close_symbol`` OUTPUT: @@ -616,7 +616,7 @@ def to_path_string(self, unicode=False) -> str: INPUT: - - ``unicode`` -- boolean (default ``False``) whether to use unicode + - ``unicode`` -- boolean (default: ``False``); whether to use unicode EXAMPLES:: @@ -1287,9 +1287,7 @@ def number_of_initial_rises(self) -> int: r""" Return the length of the initial run of ``self``. - OUTPUT: - - - a non--negative integer indicating the length of the initial rise + OUTPUT: nonnegative integer indicating the length of the initial rise EXAMPLES:: @@ -1497,9 +1495,7 @@ def touch_points(self) -> list[int]: Note that these abscissae are precisely the entries of :meth:`returns_to_zero` divided by `2`. - OUTPUT: - - - a list of integers indicating where the path touches the diagonal + OUTPUT: list of integers indicating where the path touches the diagonal EXAMPLES:: @@ -1521,9 +1517,7 @@ def touch_composition(self): This assumes ``self`` to be a complete Dyck word. - OUTPUT: - - - a composition of length equal to the length of the Dyck word. + OUTPUT: a composition of length equal to the length of the Dyck word EXAMPLES:: @@ -1547,9 +1541,7 @@ def number_of_touch_points(self) -> int: r""" Return the number of touches of ``self`` at the main diagonal. - OUTPUT: - - - a non--negative integer + OUTPUT: nonnegative integer EXAMPLES:: @@ -1673,7 +1665,7 @@ def to_tamari_sorting_tuple(self) -> list[int]: return resu @combinatorial_map(name="to binary trees: up step, left tree, down step, right tree") - def to_binary_tree(self, usemap="1L0R"): + def to_binary_tree(self, usemap='1L0R'): r""" Return a binary tree recursively constructed from the Dyck path ``self`` by the map ``usemap``. The default ``usemap`` is ``'1L0R'`` @@ -2057,7 +2049,7 @@ def characteristic_symmetric_function(self, q=None, - ``q`` -- (default: ``q = R('q')``) a parameter for the generating function power - - ``R`` -- (default : ``R = QQ['q','t'].fraction_field()``) the base + - ``R`` -- (default: ``R = QQ['q','t'].fraction_field()``) the base ring to do the calculations over OUTPUT: @@ -2324,13 +2316,13 @@ def to_permutation(self, map) -> Permutation: | x . . | . . . - sage: D.to_permutation(map="Bandlow-Killpatrick") + sage: D.to_permutation(map='Bandlow-Killpatrick') [3, 4, 2, 1] - sage: D.to_permutation(map="Stump") + sage: D.to_permutation(map='Stump') [4, 2, 3, 1] - sage: D.to_permutation(map="Knuth") + sage: D.to_permutation(map='Knuth') [1, 2, 4, 3] - sage: D.to_permutation(map="Krattenthaler") + sage: D.to_permutation(map='Krattenthaler') [2, 1, 3, 4] TESTS:: @@ -3338,7 +3330,7 @@ class options(GlobalOptions): _| x | x . | . . - sage: DyckWords.options(diagram_style="line") + sage: DyckWords.options(diagram_style='line') sage: D /\/\ / \ @@ -3355,7 +3347,7 @@ class options(GlobalOptions): description='Specifies how the ascii art of Dyck words should be printed', values=dict(path="Using the path string", pretty_output="Using pretty printing"), - alias=dict(pretty_print="pretty_output", path_string="path"), + alias=dict(pretty_print='pretty_output', path_string='path'), case_sensitive=False) diagram_style = dict(default="grid", values=dict(grid='printing as paths on a grid using N and E steps', @@ -3878,7 +3870,7 @@ def from_area_sequence(self, code) -> DyckWord: INPUT: - - ``code`` -- a list of integers satisfying ``code[0] == 0`` + - ``code`` -- list of integers satisfying ``code[0] == 0`` and ``0 <= code[i+1] <= code[i]+1``. EXAMPLES:: diff --git a/src/sage/combinat/e_one_star.py b/src/sage/combinat/e_one_star.py index b3de5fc9ac5..85eb0285092 100644 --- a/src/sage/combinat/e_one_star.py +++ b/src/sage/combinat/e_one_star.py @@ -1006,7 +1006,7 @@ def repaint(self, cmap='Set1') -> None: - string -- A coloring map. For available coloring map names type: ``sorted(colormaps)`` - - list -- a list of colors to assign cyclically to the faces. + - list -- list of colors to assign cyclically to the faces A list of a single color colors all the faces with the same color. - dict -- a dict of face types mapped to colors, to color the faces according to their type. diff --git a/src/sage/combinat/fast_vector_partitions.pyx b/src/sage/combinat/fast_vector_partitions.pyx index 6099c67b6a1..1cdd5792149 100644 --- a/src/sage/combinat/fast_vector_partitions.pyx +++ b/src/sage/combinat/fast_vector_partitions.pyx @@ -37,7 +37,7 @@ cdef list vector_halve(list v): INPUT: - - ``v`` -- list of non-negative integers, understood as a vector + - ``v`` -- list of nonnegative integers, understood as a vector OUTPUT: @@ -82,11 +82,11 @@ def recursive_within_from_to(list m, list s, list e, bint useS, bint useE): INPUT: - - ``m`` -- list of non-negative integers, understood as a vector - - ``s`` -- list of non-negative integers, understood as a vector - - ``e`` -- list of non-negative integers, understood as a vector - - ``useS`` -- boolean - - ``useE`` -- boolean + - ``m`` -- list of nonnegative integers, understood as a vector + - ``s`` -- list of nonnegative integers, understood as a vector + - ``e`` -- list of nonnegative integers, understood as a vector + - ``useS`` -- boolean + - ``useE`` -- boolean EXAMPLES:: @@ -148,9 +148,9 @@ def within_from_to(list m, list s, list e): INPUT: - - ``m`` -- list of non-negative integers, understood as a vector - - ``s`` -- list of non-negative integers, understood as a vector - - ``e`` -- list of non-negative integers, understood as a vector + - ``m`` -- list of nonnegative integers, understood as a vector + - ``s`` -- list of nonnegative integers, understood as a vector + - ``e`` -- list of nonnegative integers, understood as a vector EXAMPLES:: @@ -253,8 +253,8 @@ def recursive_vector_partitions(list v, list vL): INPUT: - - ``v`` -- list of non-negative integers, understood as a vector - - ``vL`` -- list of non-negative integers, understood as a vector + - ``v`` -- list of nonnegative integers, understood as a vector + - ``vL`` -- list of nonnegative integers, understood as a vector EXAMPLES:: @@ -284,10 +284,10 @@ def fast_vector_partitions(v, min_vals=None): INPUT: - - ``v`` -- list of non-negative integers, understood as the vector + - ``v`` -- list of nonnegative integers, understood as the vector to be partitioned - - ``min_vals`` -- optional list of non-negative integers, of same + - ``min_vals`` -- optional list of nonnegative integers, of same length as ``v`` OUTPUT: a list of lists, each representing a vector partition of ``v`` diff --git a/src/sage/combinat/finite_state_machine_generators.py b/src/sage/combinat/finite_state_machine_generators.py index 5ca3b4480a3..53bf8cbfd24 100644 --- a/src/sage/combinat/finite_state_machine_generators.py +++ b/src/sage/combinat/finite_state_machine_generators.py @@ -120,7 +120,7 @@ def AnyLetter(self, input_alphabet): INPUT: - - ``input_alphabet`` -- a list, the input alphabet + - ``input_alphabet`` -- list; the input alphabet OUTPUT: an :class:`~Automaton` @@ -153,7 +153,7 @@ def AnyWord(self, input_alphabet): INPUT: - - ``input_alphabet`` -- a list, the input alphabet + - ``input_alphabet`` -- list; the input alphabet OUTPUT: an :class:`~Automaton` @@ -221,10 +221,10 @@ def Word(self, word, input_alphabet=None): INPUT: - - ``word`` -- an iterable. + - ``word`` -- an iterable - - ``input_alphabet`` -- a list or ``None``. If ``None``, - then the letters occurring in the word are used. + - ``input_alphabet`` -- list or ``None``; if ``None``, + then the letters occurring in the word are used OUTPUT: an :class:`~Automaton` @@ -279,11 +279,11 @@ def ContainsWord(self, word, input_alphabet): INPUT: - - ``word`` -- a list (or other iterable) of letters, the - word we are looking for. + - ``word`` -- list (or other iterable) of letters; the + word we are looking for - - ``input_alphabet`` -- a list or other iterable, the input - alphabet. + - ``input_alphabet`` -- list or other iterable; the input + alphabet OUTPUT: an :class:`~Automaton` @@ -363,7 +363,7 @@ def Identity(self, input_alphabet): INPUT: - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable OUTPUT: @@ -402,9 +402,9 @@ def CountSubblockOccurrences(self, block, input_alphabet): INPUT: - - ``block`` -- a list (or other iterable) of letters. + - ``block`` -- list (or other iterable) of letters - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable OUTPUT: @@ -522,10 +522,10 @@ def Wait(self, input_alphabet, threshold=1): INPUT: - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable - ``threshold`` -- a positive integer specifying how many - occurrences of ``True`` inputs are waited for. + occurrences of ``True`` inputs are waited for OUTPUT: @@ -565,9 +565,9 @@ def map(self, f, input_alphabet): INPUT: - - ``f`` -- function to realize. + - ``f`` -- function to realize - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable OUTPUT: @@ -610,14 +610,14 @@ def operator(self, operator, input_alphabet, number_of_operands=2): INPUT: - - ``operator`` -- operator to realize. It is a function which + - ``operator`` -- operator to realize; it is a function which takes ``number_of_operands`` input arguments (each out of - ``input_alphabet``). + ``input_alphabet``) - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable - ``number_of_operands`` -- (default: `2`) it specifies the number - of input arguments the operator takes. + of input arguments the operator takes OUTPUT: @@ -692,10 +692,10 @@ def all(self, input_alphabet, number_of_operands=2): INPUT: - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable - ``number_of_operands`` -- (default: `2`) specifies the number - of input arguments for the ``and`` operation. + of input arguments for the ``and`` operation OUTPUT: @@ -743,10 +743,10 @@ def any(self, input_alphabet, number_of_operands=2): INPUT: - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable - ``number_of_operands`` -- (default: `2`) specifies the number - of input arguments for the ``or`` operation. + of input arguments for the ``or`` operation OUTPUT: @@ -794,10 +794,10 @@ def add(self, input_alphabet, number_of_operands=2): INPUT: - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable - ``number_of_operands`` -- (default: `2`) it specifies the number - of input arguments the operator takes. + of input arguments the operator takes OUTPUT: @@ -848,7 +848,7 @@ def sub(self, input_alphabet): INPUT: - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable OUTPUT: @@ -887,7 +887,7 @@ def weight(self, input_alphabet, zero=0): INPUT: - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable - ``zero`` -- the zero symbol in the alphabet used @@ -895,7 +895,7 @@ def weight(self, input_alphabet, zero=0): A transducer mapping `i_0\ldots i_k` to `(i_0\neq 0)\ldots(i_k\neq 0)`. - The Hamming weight is defined as the number of non-zero digits in the + The Hamming weight is defined as the number of nonzero digits in the input sequence over the alphabet ``input_alphabet`` (see :wikipedia:`Hamming_weight`). The output sequence of the transducer is a unary encoding of the Hamming weight. Thus the sum of the output @@ -953,7 +953,7 @@ def abs(self, input_alphabet): INPUT: - - ``input_alphabet`` -- a list or other iterable. + - ``input_alphabet`` -- list or other iterable OUTPUT: @@ -1039,24 +1039,24 @@ def _parse_recursion_equation_(self, equation, base, function, var, INPUT: - - ``equation`` -- An equation of the form + - ``equation`` -- an equation of the form - ``f(base^K * n + r) == f(base^k * n + s) + t`` for some integers ``0 <= k < K``, ``r`` and some ``t``---valid for all ``n`` such that the arguments on both sides are - non-negative--- + nonnegative--- or the form - ``f(r) == t`` for some integer ``r`` and some ``t``. - - ``base`` -- see :meth:`~Recursion`. + - ``base`` -- see :meth:`~Recursion` - - ``function`` -- see :meth:`~Recursion`. + - ``function`` -- see :meth:`~Recursion` - - ``var`` -- see :meth:`~Recursion`. + - ``var`` -- see :meth:`~Recursion` - - ``output_rings`` -- see :meth:`~Recursion`. + - ``output_rings`` -- see :meth:`~Recursion` OUTPUT: @@ -1360,7 +1360,7 @@ def Recursion(self, recursions, base, function=None, var=None, - ``f(base^K * n + r) == f(base^k * n + s) + t`` for some integers ``0 <= k < K``, ``r`` and some ``t``---valid for all ``n`` such that the arguments on both sides are - non-negative--- + nonnegative--- or the form @@ -1371,12 +1371,12 @@ def Recursion(self, recursions, base, function=None, var=None, ``r``, ``k``, ``s``, ``t`` as above or a tuple ``(r, t)``. Note that ``t`` *must* be a list in this case. - - ``base`` -- base of the digit expansion. + - ``base`` -- base of the digit expansion - ``function`` -- symbolic function ``f`` occurring in the recursions. - - ``var`` -- symbolic variable. + - ``var`` -- symbolic variable - ``input_alphabet`` -- (default: ``None``) a list of digits to be used as the input alphabet. If ``None`` and the base @@ -1392,9 +1392,9 @@ def Recursion(self, recursions, base, function=None, var=None, - ``is_zero`` -- (default: ``None``) a callable. The recursion relations are only well-posed if there is no cycle with - non-zero output and input consisting of zeros. This parameter + nonzero output and input consisting of zeros. This parameter is used to determine whether the output of such a cycle is - non-zero. By default, the output must evaluate to ``False`` as + nonzero. By default, the output must evaluate to ``False`` as a boolean. - ``output_rings`` -- (default: ``[ZZ, QQ]``) a list of @@ -1500,7 +1500,7 @@ def Recursion(self, recursions, base, function=None, var=None, sage: sum(T(binary_expansion)) # needs sage.symbolic 3 - Indeed, the given non-adjacent form has three non-zero + Indeed, the given non-adjacent form has three nonzero digits. - The following example computes the non-adjacent form from the @@ -1841,13 +1841,13 @@ def recursion_transition(carry, level, force_nonnegative_target): INPUT: - - ``carry`` -- integer. + - ``carry`` -- integer - - ``level`` -- integer. + - ``level`` -- integer - - ``force_nonnegative_target`` -- boolean. If ``True``, only - recursion transitions leading to a non-negative carry are - returned. + - ``force_nonnegative_target`` -- boolean; if ``True``, only + recursion transitions leading to a nonnegative carry are + returned OUTPUT: @@ -1880,13 +1880,13 @@ def recursion_transitions(carry, level, force_nonnegative_target): INPUT: - - ``carry`` -- integer. + - ``carry`` -- integer - - ``level`` -- integer. + - ``level`` -- integer - - ``force_nonnegative_target`` -- boolean. If ``True``, only - recursion transitions leading to a non-negative carry are - allowed. + - ``force_nonnegative_target`` -- boolean; if ``True``, only + recursion transitions leading to a nonnegative carry are + allowed OUTPUT: @@ -1913,7 +1913,7 @@ def transition_function(states2, input): carry += input * base**level level += 1 # We now may proceed along recursion transitions - # as long as the carries stay non-negative. + # as long as the carries stay nonnegative. ((carry, level), new_output) = recursion_transitions( carry, level, True) return ((carry, level), output + new_output) @@ -1928,7 +1928,7 @@ def edge_recursion_digraph(n): INPUT: - - ``n`` -- integer. + - ``n`` -- integer OUTPUT: