diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index 1a72a48c14e..60b80719c53 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -2436,7 +2436,7 @@ def cohomology_generators(self, max_degree): ALGORITHM: - Reduce a basis of the `n`'th cohomology modulo all the degree `n` + Reduce a basis of the `n`-th cohomology modulo all the degree `n` products of the lower degree cohomologies. EXAMPLES:: diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py index 2e459ef4a18..93285f7e7f8 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py @@ -801,7 +801,7 @@ def maximal_ideal(self): - :class:`~sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra_ideal.FiniteDimensionalAlgebraIdeal`; the unique maximal ideal of ``self``. If ``self`` is not a local - algebra, a :class:`ValueError` is raised. + algebra, a :exc:`ValueError` is raised. EXAMPLES:: diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py index 5efac2d25cf..29fe9a1cee1 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py @@ -29,7 +29,7 @@ class FiniteDimensionalAlgebraMorphism(RingHomomorphism_im_gens): - ``f`` -- matrix of the underlying `k`-linear map - ``unitary`` -- boolean (default: ``True``); if ``True`` and ``check`` - is also ``True``, raise a :class:`ValueError` unless ``A`` and ``B`` are + is also ``True``, raise a :exc:`ValueError` unless ``A`` and ``B`` are unitary and ``f`` respects unit elements - ``check`` -- boolean (default: ``True``); check whether the given diff --git a/src/sage/algebras/free_algebra_quotient.py b/src/sage/algebras/free_algebra_quotient.py index df19a18e3e8..2d54b35a8e1 100644 --- a/src/sage/algebras/free_algebra_quotient.py +++ b/src/sage/algebras/free_algebra_quotient.py @@ -226,7 +226,7 @@ def gen(self, i): sage: H.gen(2) k - An :class:`IndexError` is raised if an invalid generator is requested:: + An :exc:`IndexError` is raised if an invalid generator is requested:: sage: H.gen(3) Traceback (most recent call last): diff --git a/src/sage/algebras/fusion_rings/fusion_ring.py b/src/sage/algebras/fusion_rings/fusion_ring.py index d657e4643a5..797735d99b8 100644 --- a/src/sage/algebras/fusion_rings/fusion_ring.py +++ b/src/sage/algebras/fusion_rings/fusion_ring.py @@ -53,7 +53,7 @@ class FusionRing(WeylCharacterRing): The cyclotomic order is an integer `N` such that all computations will return elements of the cyclotomic field of `N`-th roots of unity. Normally you will never need to change this but consider changing it - if :meth:`root_of_unity` raises a :class:`ValueError`. + if :meth:`root_of_unity` raises a :exc:`ValueError`. This algebra has a basis (sometimes called *primary fields* but here called *simple objects*) indexed by the weights of level `\leq k`. diff --git a/src/sage/algebras/fusion_rings/shm_managers.pyx b/src/sage/algebras/fusion_rings/shm_managers.pyx index 9f4d7af4204..94bc24eb4ce 100644 --- a/src/sage/algebras/fusion_rings/shm_managers.pyx +++ b/src/sage/algebras/fusion_rings/shm_managers.pyx @@ -418,7 +418,7 @@ cdef class FvarsHandler: .. NOTE:: - If you ever encounter an :class:`OverflowError` when running the + If you ever encounter an :exc:`OverflowError` when running the :meth:`FMatrix.find_orthogonal_solution` solver, consider increasing the parameter ``n_bytes``. diff --git a/src/sage/algebras/lie_algebras/verma_module.py b/src/sage/algebras/lie_algebras/verma_module.py index 87549c007d6..6c47d43e5ed 100644 --- a/src/sage/algebras/lie_algebras/verma_module.py +++ b/src/sage/algebras/lie_algebras/verma_module.py @@ -590,7 +590,7 @@ def _Hom_(self, Y, category=None, **options): The sole purpose of this method is to construct the homset as a :class:`~sage.algebras.lie_algebras.verma_module.VermaModuleHomset`. If ``category`` is specified and is not a subcategory of - ``self.category()``, a :class:`TypeError` is raised instead. + ``self.category()``, a :exc:`TypeError` is raised instead. This method is not meant to be called directly. Please use :func:`sage.categories.homset.Hom` instead. diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index 6f916ac66a1..d1da5e6c189 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -3775,7 +3775,7 @@ def cyclic_right_subideals(self, p, alpha=None): .. NOTE:: Currently, `p` must satisfy a bunch of conditions, or a - :class:`NotImplementedError` is raised. In particular, `p` must + :exc:`NotImplementedError` is raised. In particular, `p` must be odd and unramified in the quaternion algebra, must be coprime to the index of the right order in the maximal order, and also coprime to the normal of ``self``. (The Brandt diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd index 484736a9717..5330776b3bf 100644 --- a/src/sage/arith/long.pxd +++ b/src/sage/arith/long.pxd @@ -31,9 +31,9 @@ cdef inline long pyobject_to_long(x) except? LONG_MIN: r""" Given a Python object ``x`` cast it quickly to a C long. - A :class:`TypeError` is raised if the input cannot be converted to + A :exc:`TypeError` is raised if the input cannot be converted to an integer or - an :class:`OverflowError` is raised if it does not fit into a C long. + an :exc:`OverflowError` is raised if it does not fit into a C long. TESTS: @@ -106,7 +106,7 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1: - ``ERR_TYPE`` -- ``x`` is not an integer type of any kind - - ``ERR_INDEX`` -- ``x`` implements ``__index__`` but a :class:`TypeError` + - ``ERR_INDEX`` -- ``x`` implements ``__index__`` but a :exc:`TypeError` was raised calling ``__index__()`` - Other exceptions in ``__index__`` are simply propagated. This is diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py index 3722f6383af..fb071d78474 100644 --- a/src/sage/arith/misc.py +++ b/src/sage/arith/misc.py @@ -57,7 +57,7 @@ def algdep(z, degree, known_bits=None, use_bits=None, known_digits=None, is not found, then ``None`` will be returned. If ``proof=True`` then the result is returned only if it can be proved correct (i.e. the only possible minimal polynomial satisfying the height bound, or no - such polynomial exists). Otherwise a :class:`ValueError` is raised + such polynomial exists). Otherwise a :exc:`ValueError` is raised indicating that higher precision is required. ALGORITHM: Uses LLL for real/complex inputs, PARI C-library @@ -4260,7 +4260,7 @@ def primitive_root(n, check=True): """ Return a positive integer that generates the multiplicative group of integers modulo `n`, if one exists; otherwise, raise a - :class:`ValueError`. + :exc:`ValueError`. A primitive root exists if `n=4` or `n=p^k` or `n=2p^k`, where `p` is an odd prime and `k` is a nonnegative number. @@ -5302,7 +5302,7 @@ def integer_trunc(i): def two_squares(n): """ Write the integer `n` as a sum of two integer squares if possible; - otherwise raise a :class:`ValueError`. + otherwise raise a :exc:`ValueError`. INPUT: @@ -5424,7 +5424,7 @@ def two_squares(n): def three_squares(n): """ Write the integer `n` as a sum of three integer squares if possible; - otherwise raise a :class:`ValueError`. + otherwise raise a :exc:`ValueError`. INPUT: @@ -5645,7 +5645,7 @@ def four_squares(n): def sum_of_k_squares(k, n): """ Write the integer `n` as a sum of `k` integer squares if possible; - otherwise raise a :class:`ValueError`. + otherwise raise a :exc:`ValueError`. INPUT: diff --git a/src/sage/arith/multi_modular.pyx b/src/sage/arith/multi_modular.pyx index 5b8c3f17663..1d5e9a46221 100644 --- a/src/sage/arith/multi_modular.pyx +++ b/src/sage/arith/multi_modular.pyx @@ -184,7 +184,7 @@ cdef class MultiModularBasis_base(): cdef mod_int _new_random_prime(self, set known_primes) except 1: """ Choose a new random prime for inclusion in the list of moduli, - or raise a :class:`RuntimeError` if there are no more primes. + or raise a :exc:`RuntimeError` if there are no more primes. INPUT: diff --git a/src/sage/arith/rational_reconstruction.pyx b/src/sage/arith/rational_reconstruction.pyx index bd07977411a..6806cda3a00 100644 --- a/src/sage/arith/rational_reconstruction.pyx +++ b/src/sage/arith/rational_reconstruction.pyx @@ -35,7 +35,7 @@ cdef int mpq_rational_reconstruction(mpq_t answer, mpz_t a, mpz_t m) except -1: sqrt(m/2). If `m` is zero, raise :class`ZeroDivisionError`. If the rational - reconstruction does not exist, raise :class:`ValueError`. + reconstruction does not exist, raise :exc:`ValueError`. We assume that ``mpq_init`` has been called on ``answer``. diff --git a/src/sage/calculus/calculus.py b/src/sage/calculus/calculus.py index 856433c84f7..e9c97ad3332 100644 --- a/src/sage/calculus/calculus.py +++ b/src/sage/calculus/calculus.py @@ -962,10 +962,10 @@ def minpoly(ex, var='x', algorithm=None, bits=None, degree=None, epsilon=0): If the minimal polynomial could not be found, two distinct kinds of errors are raised. If no reasonable candidate was found with the - given ``bits``/``degree`` parameters, a :class:`ValueError` will be + given ``bits``/``degree`` parameters, a :exc:`ValueError` will be raised. If a reasonable candidate was found but (perhaps due to limits in the underlying symbolic package) was unable to be proved - correct, a :class:`NotImplementedError` will be raised. + correct, a :exc:`NotImplementedError` will be raised. ALGORITHM: Two distinct algorithms are used, depending on the algorithm parameter. By default, the numerical algorithm is @@ -987,8 +987,8 @@ def minpoly(ex, var='x', algorithm=None, bits=None, degree=None, epsilon=0): vanishing. If this fails, and ``epsilon`` is nonzero, return `f` if and only if `f(\mathtt{self}) < \mathtt{epsilon}`. - Otherwise raise a :class:`ValueError` (if no suitable - candidate was found) or a :class:`NotImplementedError` (if a + Otherwise raise a :exc:`ValueError` (if no suitable + candidate was found) or a :exc:`NotImplementedError` (if a likely candidate was found but could not be proved correct). EXAMPLES: First some simple examples:: diff --git a/src/sage/calculus/var.pyx b/src/sage/calculus/var.pyx index d687574968d..57727f11b88 100644 --- a/src/sage/calculus/var.pyx +++ b/src/sage/calculus/var.pyx @@ -36,7 +36,7 @@ def var(*args, **kwds): If a single symbolic variable was created, the variable itself. Otherwise, a tuple of symbolic variables. The variable names are checked to be valid Python identifiers and a - :class:`ValueError` is raised otherwise. + :exc:`ValueError` is raised otherwise. EXAMPLES: diff --git a/src/sage/categories/category.py b/src/sage/categories/category.py index c929a3a2e42..7a4b71c40d0 100644 --- a/src/sage/categories/category.py +++ b/src/sage/categories/category.py @@ -565,7 +565,7 @@ def an_instance(cls): def __call__(self, x, *args, **opts): """ Construct an object in this category from the data in ``x``, - or throw :class:`TypeError` or :class:`NotImplementedError`. + or throw :exc:`TypeError` or :exc:`NotImplementedError`. If ``x`` is readily in ``self`` it is returned unchanged. Categories wishing to extend this minimal behavior should @@ -583,7 +583,7 @@ def __call__(self, x, *args, **opts): def _call_(self, x): """ Construct an object in this category from the data in ``x``, - or throw :class:`NotImplementedError`. + or throw :exc:`NotImplementedError`. EXAMPLES:: diff --git a/src/sage/categories/crystals.py b/src/sage/categories/crystals.py index bcf8e361c66..c822bbd50fc 100644 --- a/src/sage/categories/crystals.py +++ b/src/sage/categories/crystals.py @@ -579,7 +579,7 @@ def _Hom_(self, Y, category=None, **options): The sole purpose of this method is to construct the homset as a :class:`~sage.categories.crystals.CrystalHomset`. If ``category`` is specified and is not a subcategory of - :class:`Crystals`, a :class:`TypeError` is raised instead. + :class:`Crystals`, a :exc:`TypeError` is raised instead. This method is not meant to be called directly. Please use :func:`sage.categories.homset.Hom` instead. diff --git a/src/sage/categories/enumerated_sets.py b/src/sage/categories/enumerated_sets.py index 17449aec514..68a830c289d 100644 --- a/src/sage/categories/enumerated_sets.py +++ b/src/sage/categories/enumerated_sets.py @@ -48,11 +48,11 @@ class EnumeratedSets(CategoryWithAxiom): - ``iter(S)`` -- an iterator for the elements of the set; - ``S.list()`` -- a fresh list of the elements of the set, when - possible; raises a :class:`NotImplementedError` if the list is + possible; raises a :exc:`NotImplementedError` if the list is predictably too large to be expanded in memory. - ``S.tuple()`` -- a tuple of the elements of the set, when - possible; raises a :class:`NotImplementedError` if the tuple is + possible; raises a :exc:`NotImplementedError` if the tuple is predictably too large to be expanded in memory. - ``S.unrank(n)`` -- the ``n``-th element of the set when ``n`` is a sage @@ -183,7 +183,7 @@ def __iter__(self): the methods of the first column are defined using ``__iter__`` If none of these are provided, this raises - a :class:`NotImplementedError`. + a :exc:`NotImplementedError`. EXAMPLES: @@ -928,7 +928,7 @@ def random_element(self): the probability is uniform. This is a generic implementation from the category - ``EnumeratedSets()``. It raises a :class:`NotImplementedError` + ``EnumeratedSets()``. It raises a :exc:`NotImplementedError` since one does not know whether the set is finite. EXAMPLES:: diff --git a/src/sage/categories/facade_sets.py b/src/sage/categories/facade_sets.py index d1a8a853c5f..e832068fa97 100644 --- a/src/sage/categories/facade_sets.py +++ b/src/sage/categories/facade_sets.py @@ -212,7 +212,7 @@ def _an_element_(self): For each parent ``self`` is a facade for, this default implementation tries the method ``an_element`` until it finds an element in ``self``. If none is found, this raises a - :class:`NotImplementedError`. + :exc:`NotImplementedError`. EXAMPLES:: diff --git a/src/sage/categories/fields.py b/src/sage/categories/fields.py index 75d0ef71651..33a86e33244 100644 --- a/src/sage/categories/fields.py +++ b/src/sage/categories/fields.py @@ -811,7 +811,7 @@ def inverse_of_unit(self): 1/2 Trying to invert the zero element typically raises a - :class:`ZeroDivisionError`:: + :exc:`ZeroDivisionError`:: sage: QQ(0).inverse_of_unit() Traceback (most recent call last): diff --git a/src/sage/categories/filtered_modules_with_basis.py b/src/sage/categories/filtered_modules_with_basis.py index 40bb31fbf4d..454f31e5070 100644 --- a/src/sage/categories/filtered_modules_with_basis.py +++ b/src/sage/categories/filtered_modules_with_basis.py @@ -159,7 +159,7 @@ def basis(self, d=None): over Integer Ring(i))_{i in Partitions} Checking this method on a filtered algebra. Note that this - will typically raise a :class:`NotImplementedError` when this + will typically raise a :exc:`NotImplementedError` when this feature is not implemented. :: sage: A = AlgebrasWithBasis(ZZ).Filtered().example() diff --git a/src/sage/categories/finite_groups.py b/src/sage/categories/finite_groups.py index 7905a93e739..88cce2fbae0 100644 --- a/src/sage/categories/finite_groups.py +++ b/src/sage/categories/finite_groups.py @@ -152,7 +152,7 @@ def conjugacy_classes(self): This will eventually be a fall-back method for groups not defined over GAP. Right now, it just raises a - :class:`NotImplementedError`, until we include a non-GAP + :exc:`NotImplementedError`, until we include a non-GAP way of listing the conjugacy classes representatives. EXAMPLES:: diff --git a/src/sage/categories/finite_posets.py b/src/sage/categories/finite_posets.py index eb2d8584d3a..0c78e12c6c7 100644 --- a/src/sage/categories/finite_posets.py +++ b/src/sage/categories/finite_posets.py @@ -929,7 +929,7 @@ def birational_toggle(self, v, labelling): encoded to be understood by Sage. This implementation allows `\mathbf{K}` to be a semifield, not just a field. The birational `v`-toggle is only a rational map, so an exception (most - likely, :class:`ZeroDivisionError`) will be thrown if the + likely, :exc:`ZeroDivisionError`) will be thrown if the denominator is zero. INPUT: @@ -1150,7 +1150,7 @@ def birational_toggles(self, vs, labelling): encoded to be understood by Sage. This implementation allows `\mathbf{K}` to be a semifield, not just a field. The birational `v`-toggle is only a rational map, so an exception (most - likely, :class:`ZeroDivisionError`) will be thrown if the + likely, :exc:`ZeroDivisionError`) will be thrown if the denominator is zero. INPUT: @@ -1229,7 +1229,7 @@ def birational_rowmotion(self, labelling): by Sage. This implementation allows `\mathbf{K}` to be a semifield, not just a field. Birational rowmotion is only a rational map, so an exception (most likely, - :class:`ZeroDivisionError`) will be thrown if the + :exc:`ZeroDivisionError`) will be thrown if the denominator is zero. INPUT: diff --git a/src/sage/categories/function_fields.py b/src/sage/categories/function_fields.py index 8d089a881c2..5207a9da3ad 100644 --- a/src/sage/categories/function_fields.py +++ b/src/sage/categories/function_fields.py @@ -49,7 +49,7 @@ def super_categories(self): def _call_(self, x): r""" Construct an object in this category from the data in ``x``, - or throw a ``TypeError``. + or throw a :exc:`TypeError`. EXAMPLES:: diff --git a/src/sage/categories/functor.pyx b/src/sage/categories/functor.pyx index 09c92bf7d5d..9b491ee0b94 100644 --- a/src/sage/categories/functor.pyx +++ b/src/sage/categories/functor.pyx @@ -73,8 +73,8 @@ cdef class Functor(SageObject): default call method: - ``_coerce_into_domain(self, x)`` -- return an object of ``self``'s - domain, corresponding to ``x``, or raise a :class:`TypeError`. - - Default: Raise :class:`TypeError` if ``x`` is not in ``self``'s domain. + domain, corresponding to ``x``, or raise a :exc:`TypeError`. + - Default: Raise :exc:`TypeError` if ``x`` is not in ``self``'s domain. - ``_apply_functor(self, x)`` -- apply ``self`` to an object ``x`` of ``self``'s domain. @@ -277,10 +277,10 @@ cdef class Functor(SageObject): A subclass of :class:`Functor` may overload this method. It should return an object of ``self``'s domain, and should raise a - :class:`TypeError` if this is impossible. + :exc:`TypeError` if this is impossible. By default, the argument will not be changed, but a - :class:`TypeError` will be raised if the argument does not + :exc:`TypeError` will be raised if the argument does not belong to the domain. TESTS:: diff --git a/src/sage/categories/hecke_modules.py b/src/sage/categories/hecke_modules.py index 783442c76e4..99ce981eb03 100644 --- a/src/sage/categories/hecke_modules.py +++ b/src/sage/categories/hecke_modules.py @@ -115,7 +115,7 @@ def _Hom_(self, Y, category): The sole purpose of this method is to construct the homset as a :class:`~sage.modular.hecke.homspace.HeckeModuleHomspace`. If ``category`` is specified and is not a subcategory of - :class:`HeckeModules`, a :class:`TypeError` is raised instead + :class:`HeckeModules`, a :exc:`TypeError` is raised instead This method is not meant to be called directly. Please use :func:`sage.categories.homset.Hom` instead. diff --git a/src/sage/categories/highest_weight_crystals.py b/src/sage/categories/highest_weight_crystals.py index fc248adb3c5..db7600755bb 100644 --- a/src/sage/categories/highest_weight_crystals.py +++ b/src/sage/categories/highest_weight_crystals.py @@ -411,7 +411,7 @@ def _Hom_(self, Y, category=None, **options): The sole purpose of this method is to construct the homset as a :class:`~sage.categories.highest_weight_crystals.HighestWeightCrystalHomset`. If ``category`` is specified and is not a subcategory of - :class:`HighestWeightCrystals`, a :class:`TypeError` is raised + :class:`HighestWeightCrystals`, a :exc:`TypeError` is raised instead This method is not meant to be called directly. Please use diff --git a/src/sage/categories/homset.py b/src/sage/categories/homset.py index e6a4a38edfa..1b05cca4a52 100644 --- a/src/sage/categories/homset.py +++ b/src/sage/categories/homset.py @@ -179,7 +179,7 @@ def Hom(X, Y, category=None, check=True): A parent (or a parent class of a category) may specify how to construct certain homsets by implementing a method ``_Hom_(self, codomain, category)``. This method should either construct the - requested homset or raise a :class:`TypeError`. This hook is currently + requested homset or raise a :exc:`TypeError`. This hook is currently mostly used to create homsets in some specific subclass of :class:`Homset` (e.g. :class:`sage.rings.homset.RingHomset`):: diff --git a/src/sage/categories/infinite_enumerated_sets.py b/src/sage/categories/infinite_enumerated_sets.py index 0867d886832..8a6618a4fe6 100644 --- a/src/sage/categories/infinite_enumerated_sets.py +++ b/src/sage/categories/infinite_enumerated_sets.py @@ -102,7 +102,7 @@ def _test_enumerated_set_iter_cardinality(self, **options): * :meth:`.cardinality` is supposed to return ``infinity`` - * :meth:`.list` is supposed to raise a :class:`NotImplementedError`. + * :meth:`.list` is supposed to raise a :exc:`NotImplementedError`. EXAMPLES:: diff --git a/src/sage/categories/map.pyx b/src/sage/categories/map.pyx index 0761357f3f8..3ee42fc0157 100644 --- a/src/sage/categories/map.pyx +++ b/src/sage/categories/map.pyx @@ -1139,7 +1139,7 @@ cdef class Map(Element): OUTPUT: An element of Hom(X, Z) obtained by composing self with `\phi`. If - no canonical `\phi` exists, a :class:`TypeError` is raised. + no canonical `\phi` exists, a :exc:`TypeError` is raised. EXAMPLES:: @@ -1184,7 +1184,7 @@ cdef class Map(Element): OUTPUT: An element of Hom(X, Z) obtained by composing ``self`` with `\phi`. If - no canonical `\phi` exists, a :class:`TypeError` is raised. + no canonical `\phi` exists, a :exc:`TypeError` is raised. EXAMPLES:: @@ -1886,7 +1886,7 @@ cdef class FormalCompositeMap(Map): """ Tell whether ``self`` is injective. - It raises :class:`NotImplementedError` if it cannot be determined. + It raises :exc:`NotImplementedError` if it cannot be determined. EXAMPLES:: @@ -1960,7 +1960,7 @@ cdef class FormalCompositeMap(Map): """ Tell whether ``self`` is surjective. - It raises :class:`NotImplementedError` if it cannot be determined. + It raises :exc:`NotImplementedError` if it cannot be determined. EXAMPLES:: diff --git a/src/sage/categories/morphism.pyx b/src/sage/categories/morphism.pyx index a6ac1274aa9..2ed9514a469 100644 --- a/src/sage/categories/morphism.pyx +++ b/src/sage/categories/morphism.pyx @@ -685,7 +685,7 @@ cdef class SetMorphism(Morphism): cpdef bint _eq_c_impl(self, Element other) noexcept: """ - Equality test + Equality test. EXAMPLES:: diff --git a/src/sage/categories/number_fields.py b/src/sage/categories/number_fields.py index 38cbb3f833b..09ab01c202f 100644 --- a/src/sage/categories/number_fields.py +++ b/src/sage/categories/number_fields.py @@ -96,7 +96,7 @@ def __contains__(self, x): def _call_(self, x): r""" Construct an object in this category from the data in ``x``, - or raise a :class:`TypeError`. + or raise a :exc:`TypeError`. EXAMPLES:: diff --git a/src/sage/categories/rings.py b/src/sage/categories/rings.py index aae4451c379..58a84e948cf 100644 --- a/src/sage/categories/rings.py +++ b/src/sage/categories/rings.py @@ -499,7 +499,7 @@ def _Hom_(self, Y, category): The sole purpose of this method is to construct the homset as a :class:`~sage.rings.homset.RingHomset`. If ``category`` is specified and is not a subcategory of - :class:`Rings() `, a :class:`TypeError` is raised instead + :class:`Rings() `, a :exc:`TypeError` is raised instead This method is not meant to be called directly. Please use :func:`sage.categories.homset.Hom` instead. @@ -1514,7 +1514,7 @@ def inverse_of_unit(self): def _divide_if_possible(self, y): """ Divide ``self`` by ``y`` if possible and raise a - :class:`ValueError` otherwise. + :exc:`ValueError` otherwise. EXAMPLES:: diff --git a/src/sage/categories/sets_cat.py b/src/sage/categories/sets_cat.py index d286d0975ac..e446424dac4 100644 --- a/src/sage/categories/sets_cat.py +++ b/src/sage/categories/sets_cat.py @@ -1061,7 +1061,7 @@ def an_element(self): This is used both for illustration and testing purposes. If the set ``self`` is empty, :meth:`an_element` should raise the exception - :class:`EmptySetError`. + :exc:`EmptySetError`. This default implementation calls :meth:`_an_element_` and caches the result. Any parent should implement either @@ -1823,7 +1823,7 @@ def __invert__(self): .. NOTE:: This is an optional method. A default implementation - raising :class:`NotImplementedError` could be provided instead. + raising :exc:`NotImplementedError` could be provided instead. """ def is_injective(self): diff --git a/src/sage/categories/sets_with_partial_maps.py b/src/sage/categories/sets_with_partial_maps.py index 01993c2fb82..8fb38cf894b 100644 --- a/src/sage/categories/sets_with_partial_maps.py +++ b/src/sage/categories/sets_with_partial_maps.py @@ -18,7 +18,7 @@ class SetsWithPartialMaps(Category_singleton): """ The category whose objects are sets and whose morphisms are - maps that are allowed to raise a :class:`ValueError` on some inputs. + maps that are allowed to raise a :exc:`ValueError` on some inputs. This category is equivalent to the category of pointed sets, via the equivalence sending an object X to X union {error}, diff --git a/src/sage/coding/ag_code.py b/src/sage/coding/ag_code.py index b7774bbbf73..5f77b346fa4 100644 --- a/src/sage/coding/ag_code.py +++ b/src/sage/coding/ag_code.py @@ -331,7 +331,7 @@ def designed_distance(self): """ Return the designed distance of the AG code. - If the code is of dimension zero, then a :class:`ValueError` is raised. + If the code is of dimension zero, then a :exc:`ValueError` is raised. EXAMPLES:: @@ -575,7 +575,7 @@ def designed_distance(self): """ Return the designed distance of the differential AG code. - If the code is of dimension zero, then a :class:`ValueError` is raised. + If the code is of dimension zero, then a :exc:`ValueError` is raised. EXAMPLES:: diff --git a/src/sage/coding/ag_code_decoders.pyx b/src/sage/coding/ag_code_decoders.pyx index e9076b6dcca..df59bad740d 100644 --- a/src/sage/coding/ag_code_decoders.pyx +++ b/src/sage/coding/ag_code_decoders.pyx @@ -1464,7 +1464,7 @@ cdef class Decoder_K(): - ``detect_Q_polynomial`` -- boolean; if ``True``, a Q-polynomial is detected for fast decoding - If decoding fails for some reason, ``DecodingError`` is raised. The + If decoding fails for some reason, :exc:`DecodingError` is raised. The message contained in the exception indicates the type of the decoding failure. diff --git a/src/sage/coding/code_bounds.py b/src/sage/coding/code_bounds.py index ef70c8dad64..a4771995a47 100644 --- a/src/sage/coding/code_bounds.py +++ b/src/sage/coding/code_bounds.py @@ -190,7 +190,7 @@ def _check_n_q_d(n, q, d, field_based=True): More precisely, this checks that the parameters are positive integers, that `q` is a prime power for codes over a field, or, more generally, that `q` is of size at least 2, and that `n >= d`. - This raises a :class:`ValueError` otherwise. + This raises a :exc:`ValueError` otherwise. TESTS:: diff --git a/src/sage/coding/code_constructions.py b/src/sage/coding/code_constructions.py index aecf30f058a..5767872b3e2 100644 --- a/src/sage/coding/code_constructions.py +++ b/src/sage/coding/code_constructions.py @@ -499,7 +499,7 @@ def QuadraticResidueCode(n,F): A quadratic residue code (or QR code) is a cyclic code whose generator polynomial is the product of the polynomials `x-\alpha^i` (`\alpha` is a primitive - `n`'th root of unity; `i` ranges over the set of + `n`-th root of unity; `i` ranges over the set of quadratic residues modulo `n`). See :class:`QuadraticResidueCodeEvenPair` and diff --git a/src/sage/coding/databases.py b/src/sage/coding/databases.py index 283cdcd4eb9..c3e76a206f1 100644 --- a/src/sage/coding/databases.py +++ b/src/sage/coding/databases.py @@ -147,8 +147,8 @@ def best_linear_code_in_codetables_dot_de(n, k, F, verbose=False): last modified: 2002-03-20 - This function raises an :class:`IOError` if an error occurs downloading data or - parsing it. It raises a :class:`ValueError` if the ``q`` input is invalid. + This function raises an :exc:`IOError` if an error occurs downloading data or + parsing it. It raises a :exc:`ValueError` if the ``q`` input is invalid. AUTHORS: diff --git a/src/sage/coding/encoder.py b/src/sage/coding/encoder.py index 12922fa1b8a..6ad764935c7 100644 --- a/src/sage/coding/encoder.py +++ b/src/sage/coding/encoder.py @@ -127,7 +127,7 @@ def encode(self, word): .. NOTE:: :meth:`encode` might be a partial function over ``self``'s :meth:`message_space`. - One should use the exception :class:`EncodingError` to catch attempts + One should use the exception :exc:`EncodingError` to catch attempts to encode words that are outside of the message space. One can use the following shortcut to encode a word with an encoder ``E``:: diff --git a/src/sage/coding/golay_code.py b/src/sage/coding/golay_code.py index 94cf366cdb5..3d52dade619 100644 --- a/src/sage/coding/golay_code.py +++ b/src/sage/coding/golay_code.py @@ -238,7 +238,7 @@ def covering_radius(self): def weight_distribution(self): r""" - Return the list whose `i`'th entry is the number of words of weight `i` + Return the list whose `i`-th entry is the number of words of weight `i` in ``self``. The weight distribution of all Golay codes are known, and are thus returned diff --git a/src/sage/coding/grs_code.py b/src/sage/coding/grs_code.py index 871effd136d..ee1c47e07eb 100644 --- a/src/sage/coding/grs_code.py +++ b/src/sage/coding/grs_code.py @@ -11,7 +11,7 @@ \{ (f(\alpha_1), \ldots, f(\alpha_n)) \mid f \in F[x], \deg f < k \} An RS code is often called "classical" if `\alpha_i = \alpha^{i-1}` and `\alpha` -is a primitive `n`'th root of unity. +is a primitive `n`-th root of unity. More generally, given also `n` "column multipliers" `\beta_1, \dots, \beta_n`, the corresponding Generalized Reed-Solomon code (GRS code) of dimension `k` is @@ -503,7 +503,7 @@ def covering_radius(self): @cached_method def weight_distribution(self): r""" - Return the list whose `i`'th entry is the number of words of weight `i` + Return the list whose `i`-th entry is the number of words of weight `i` in ``self``. Computing the weight distribution for a GRS code is very fast. Note that @@ -579,7 +579,7 @@ def ReedSolomonCode(base_field, length, dimension, primitive_root=None): A classical `[n,k]` Reed-Solomon code over `\GF{q}` with `1 \le k \le n` and `n | (q-1)` is a Reed-Solomon code whose evaluation points are the - consecutive powers of a primitive `n`'th root of unity `\alpha`, i.e. + consecutive powers of a primitive `n`-th root of unity `\alpha`, i.e. `\alpha_i = \alpha^{i-1}`, where `\alpha_1, \ldots, \alpha_n` are the evaluation points. A classical Reed-Solomon codes has all column multipliers equal `1`. @@ -600,7 +600,7 @@ def ReedSolomonCode(base_field, length, dimension, primitive_root=None): - ``dimension`` -- the dimension of the resulting code - - ``primitive_root`` -- (default: ``None``) a primitive `n`'th root of unity + - ``primitive_root`` -- (default: ``None``) a primitive `n`-th root of unity to use for constructing the classical Reed-Solomon code; if not supplied, one will be computed and can be recovered as ``C.evaluation_points()[1]`` where `C` is the code returned by this method @@ -623,12 +623,12 @@ def ReedSolomonCode(base_field, length, dimension, primitive_root=None): sage: C = codes.ReedSolomonCode(GF(64,'a'), 9, 4); C [9, 4, 6] Reed-Solomon Code over GF(64) - The primitive `n`'th root of unity can be recovered as the 2nd evaluation point of the code:: + The primitive `n`-th root of unity can be recovered as the 2nd evaluation point of the code:: sage: alpha = C.evaluation_points()[1]; alpha a^5 + a^4 + a^2 + a - We can also supply a different primitive `n`'th root of unity:: + We can also supply a different primitive `n`-th root of unity:: sage: beta = alpha^2; beta a^4 + a diff --git a/src/sage/coding/guruswami_sudan/interpolation.py b/src/sage/coding/guruswami_sudan/interpolation.py index 92d6d74bc68..c7855af3381 100644 --- a/src/sage/coding/guruswami_sudan/interpolation.py +++ b/src/sage/coding/guruswami_sudan/interpolation.py @@ -162,8 +162,8 @@ def _interpolation_matrix_problem(points, tau, parameters, wy): This linear system is returned as a matrix ``M`` and a list of monomials ``monomials``, where a vector in the right nullspace of ``M`` corresponds to an - interpolation polynomial `Q`, by mapping the `t`'th element of such a vector - to the coefficient to `x^iy^j`, where `(i,j)` is the `t`'th element of ``monomials``. + interpolation polynomial `Q`, by mapping the `t`-th element of such a vector + to the coefficient to `x^iy^j`, where `(i,j)` is the `t`-th element of ``monomials``. INPUT: @@ -296,7 +296,7 @@ def lee_osullivan_module(points, parameters, wy): The module is constructed in the following way: Let `R(x)` be the Lagrange interpolation polynomial through the sought interpolation points `(x_i, y_i)`, i.e. `R(x_i) = y_i`. Let `G(x) = \prod_{i=1}^n (x-x_i)`. Then the - `i`'th row of the basis matrix of the module is the coefficient-vector of + `i`-th row of the basis matrix of the module is the coefficient-vector of the following polynomial in `\GF{q}[x][y]`: `P_i(x,y) = G(x)^{[i-s]} (y - R(x))^{i - [i-s]} y^{[i-s]}` , diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py index f217fdb3642..2d8f8058c2b 100644 --- a/src/sage/coding/linear_code.py +++ b/src/sage/coding/linear_code.py @@ -1345,7 +1345,7 @@ def minimum_distance(self, algorithm=None): .. NOTE:: - When using GAP, this raises a :class:`NotImplementedError` if + When using GAP, this raises a :exc:`NotImplementedError` if the base field of the code has size greater than 256 due to limitations in GAP. diff --git a/src/sage/coding/linear_code_no_metric.py b/src/sage/coding/linear_code_no_metric.py index 934651945e4..326e432b1e6 100644 --- a/src/sage/coding/linear_code_no_metric.py +++ b/src/sage/coding/linear_code_no_metric.py @@ -1046,7 +1046,7 @@ class LinearCodeSystematicEncoder(Encoder): the range 0 to `n-1` where `n` is the length of the code and `k` its dimension. The `0`-th symbol of a message will then be at position ``systematic_positions[0]``, the 1st index at position - ``systematic_positions[1]``, etc. A :class:`ValueError` is raised at + ``systematic_positions[1]``, etc. A :exc:`ValueError` is raised at construction time if the supplied indices do not form an information set. EXAMPLES: diff --git a/src/sage/combinat/designs/block_design.py b/src/sage/combinat/designs/block_design.py index 7ee2cfa90e1..e5faaa11602 100644 --- a/src/sage/combinat/designs/block_design.py +++ b/src/sage/combinat/designs/block_design.py @@ -693,9 +693,9 @@ def projective_plane(n, check=True, existence=False): `n^2+n+1` points. For more information on finite projective planes, see the :wikipedia:`Projective_plane#Finite_projective_planes`. - If no construction is possible, then the function raises a :class:`EmptySetError`, + If no construction is possible, then the function raises a :exc:`EmptySetError`, whereas if no construction is available, the function raises a - :class:`NotImplementedError`. + :exc:`NotImplementedError`. INPUT: diff --git a/src/sage/combinat/designs/covering_design.py b/src/sage/combinat/designs/covering_design.py index 93d51ec74af..30bbeafb708 100644 --- a/src/sage/combinat/designs/covering_design.py +++ b/src/sage/combinat/designs/covering_design.py @@ -509,7 +509,7 @@ def best_known_covering_design_www(v, k, t, verbose=False): 2 3 6 2 4 5 - A :class:`ValueError` is raised if the ``(v, k, t)`` parameters are not + A :exc:`ValueError` is raised if the ``(v, k, t)`` parameters are not found in the database. """ v = int(v) diff --git a/src/sage/combinat/designs/difference_family.py b/src/sage/combinat/designs/difference_family.py index 5cc113c41d8..bb8bb30d5bc 100644 --- a/src/sage/combinat/designs/difference_family.py +++ b/src/sage/combinat/designs/difference_family.py @@ -3454,8 +3454,8 @@ def difference_family(v, k, l=1, existence=False, explain_construction=False, ch See also :wikipedia:`Difference_set`. - If there is no such difference family, an ``EmptySetError`` is raised and - if there is no construction at the moment :class:`NotImplementedError` + If there is no such difference family, an :exc:`EmptySetError` is raised and + if there is no construction at the moment :exc:`NotImplementedError` is raised. INPUT: diff --git a/src/sage/combinat/designs/latin_squares.py b/src/sage/combinat/designs/latin_squares.py index 072376a8716..c8b61827e90 100644 --- a/src/sage/combinat/designs/latin_squares.py +++ b/src/sage/combinat/designs/latin_squares.py @@ -298,7 +298,7 @@ def mutually_orthogonal_latin_squares(k, n, partitions=False, check=True): Unknown If you ask for such a MOLS then you will respectively get an informative - ``EmptySetError`` or :class:`NotImplementedError`:: + :exc:`EmptySetError` or :exc:`NotImplementedError`:: sage: designs.mutually_orthogonal_latin_squares(5, 5) Traceback (most recent call last): diff --git a/src/sage/combinat/designs/orthogonal_arrays.py b/src/sage/combinat/designs/orthogonal_arrays.py index e8f77c7b45b..0c29559650b 100644 --- a/src/sage/combinat/designs/orthogonal_arrays.py +++ b/src/sage/combinat/designs/orthogonal_arrays.py @@ -185,7 +185,7 @@ def transversal_design(k, n, resolvable=False, check=True, existence=False): Unknown If you ask for a transversal design that Sage is not able to build then an - ``EmptySetError`` or a :class:`NotImplementedError` is raised:: + :exc:`EmptySetError` or a :exc:`NotImplementedError` is raised:: sage: designs.transversal_design(47, 100) Traceback (most recent call last): @@ -2103,8 +2103,8 @@ class OAMainFunctions: 6 If you ask for an orthogonal array that does not exist, then you will - either obtain an ``EmptySetError`` (if it knows that such an orthogonal - array does not exist) or a :class:`NotImplementedError`:: + either obtain an :exc:`EmptySetError` (if it knows that such an orthogonal + array does not exist) or a :exc:`NotImplementedError`:: sage: designs.orthogonal_arrays.build(4,2) Traceback (most recent call last): diff --git a/src/sage/combinat/integer_lists/invlex.pyx b/src/sage/combinat/integer_lists/invlex.pyx index 8aff8c5b25b..6bef85031ce 100644 --- a/src/sage/combinat/integer_lists/invlex.pyx +++ b/src/sage/combinat/integer_lists/invlex.pyx @@ -862,7 +862,7 @@ If you know what you are doing, you can set check=False to skip this warning.""" ``None`` if this method finds a proof that there exists an upper bound on the length. Otherwise a - :class:`ValueError` is raised. + :exc:`ValueError` is raised. EXAMPLES:: diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index 70601e85354..5b02f944f42 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -6004,7 +6004,7 @@ def without_bounds(self): This is useful as an input for the method :meth:`order_complex`. If there is either no top or no bottom element, this - raises a :class:`TypeError`. + raises a :exc:`TypeError`. EXAMPLES:: diff --git a/src/sage/combinat/root_system/associahedron.py b/src/sage/combinat/root_system/associahedron.py index da44903b9d9..7b2752daa6d 100644 --- a/src/sage/combinat/root_system/associahedron.py +++ b/src/sage/combinat/root_system/associahedron.py @@ -337,7 +337,7 @@ class Associahedra_base: Importantly, the parent knows the dimension of the ambient space. If you try to construct an associahedron of a different - dimension, a :class:`ValueError` is raised:: + dimension, a :exc:`ValueError` is raised:: sage: parent(['A',3]) Traceback (most recent call last): diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 1ca2529bc41..c5dd27d7131 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -6117,7 +6117,7 @@ def principal_specialization(self, n=infinity, q=None): 1 Check that the stable principal specialization at `q = 1` - raises a :class:`ValueError`: + raises a :exc:`ValueError`: sage: def test_error(x): ....: message = "the stable principal specialization of %s at q=1 should raise a ValueError" diff --git a/src/sage/combinat/words/finite_word.py b/src/sage/combinat/words/finite_word.py index 1ac0e55cdd1..c0ead07ba7d 100644 --- a/src/sage/combinat/words/finite_word.py +++ b/src/sage/combinat/words/finite_word.py @@ -307,7 +307,7 @@ def coerce(self, other): Otherwise it will attempt to convert ``other`` to the domain of ``self``. If that fails, it will attempt to convert ``self`` to the domain of - ``other``. If both attempts fail, it raises a :class:`TypeError` + ``other``. If both attempts fail, it raises a :exc:`TypeError` to signal failure. EXAMPLES:: diff --git a/src/sage/combinat/words/morphism.py b/src/sage/combinat/words/morphism.py index 6dccf6c92f7..7ff3b53451c 100644 --- a/src/sage/combinat/words/morphism.py +++ b/src/sage/combinat/words/morphism.py @@ -3674,7 +3674,7 @@ def simplify_alphabet_size(self, Z=None): r""" If this morphism is simplifiable, return morphisms `h` and `k` such that this morphism is simplifiable with respect to `h` and `k`, otherwise - raise :class:`ValueError`. + raise :exc:`ValueError`. This method is quite fast if this morphism is non-injective, but very slow if it is injective. diff --git a/src/sage/combinat/words/word_datatypes.pyx b/src/sage/combinat/words/word_datatypes.pyx index 2886fa78b44..ddda24ab436 100644 --- a/src/sage/combinat/words/word_datatypes.pyx +++ b/src/sage/combinat/words/word_datatypes.pyx @@ -662,7 +662,7 @@ cdef class WordDatatype_str(WordDatatype): sage: w.split("32") [word: , word: 30301030, word: , word: 12, word: 30, word: , word: 1] - If the separator is not a string a :class:`ValueError` is raised:: + If the separator is not a string a :exc:`ValueError` is raised:: sage: w = Word("le papa du papa du papa etait un petit pioupiou") sage: w.split(Word(['p','a','p','a'])) diff --git a/src/sage/cpython/getattr.pyx b/src/sage/cpython/getattr.pyx index f590d826724..bebe646037f 100644 --- a/src/sage/cpython/getattr.pyx +++ b/src/sage/cpython/getattr.pyx @@ -38,7 +38,7 @@ cdef extern from "Python.h": cdef class AttributeErrorMessage: """ - Try to emulate the standard Python :class:`AttributeError` message. + Try to emulate the standard Python :exc:`AttributeError` message. .. NOTE:: @@ -69,7 +69,7 @@ cdef class AttributeErrorMessage: TESTS: - The error message used for the :class:`AttributeError` is a unique object + The error message used for the :exc:`AttributeError` is a unique object and is changed inplace. This is for reasons of efficiency. Hence, if one really needs the error message as a string, then one should make a copy of its string representation before it changes. :: @@ -241,7 +241,7 @@ cpdef getattr_from_other_class(self, cls, name): - ``name`` -- string - If ``self`` is an instance of cls, raises an :class:`AttributeError`, to + If ``self`` is an instance of cls, raises an :exc:`AttributeError`, to avoid a double lookup. This function is intended to be called from __getattr__, and so should not be called if name is an attribute of ``self``. @@ -301,7 +301,7 @@ cpdef getattr_from_other_class(self, cls, name): TypeError: descriptor '__weakref__' for 'A' objects doesn't apply to ...'sage.rings.integer.Integer' object - When this occurs, an :class:`AttributeError` is raised:: + When this occurs, an :exc:`AttributeError` is raised:: sage: getattr_from_other_class(1, A, "__weakref__") Traceback (most recent call last): @@ -368,7 +368,7 @@ cpdef getattr_from_other_class(self, cls, name): # Not a descriptor return attribute # Conditionally defined lazy_attributes don't work well with fake subclasses - # (a :class:`TypeError` is raised if the lazy attribute is not defined). + # (a :exc:`TypeError` is raised if the lazy attribute is not defined). # For the moment, we ignore that when this occurs. # Other descriptors (including __weakref__) also break. try: diff --git a/src/sage/crypto/sbox.pyx b/src/sage/crypto/sbox.pyx index a5dc4306bb3..fb698d6485e 100644 --- a/src/sage/crypto/sbox.pyx +++ b/src/sage/crypto/sbox.pyx @@ -417,7 +417,7 @@ cdef class SBox(SageObject): sage: all([x == id(x) for x in k]) True - Some examples for inputs that throw an :class:`TypeError`:: + Some examples for inputs that throw an :exc:`TypeError`:: sage: S([1]*10^6) Traceback (most recent call last): @@ -1063,7 +1063,7 @@ cdef class SBox(SageObject): field is of degree ``m``. If the output length does not match the input length then a - :class:`TypeError` is raised. + :exc:`TypeError` is raised. INPUT: @@ -1797,7 +1797,7 @@ cdef class SBox(SageObject): Return the inverse of this S-Box. Note that the S-Box must be invertible, otherwise it will raise - a :class:`TypeError`. + a :exc:`TypeError`. EXAMPLES:: diff --git a/src/sage/data_structures/bitset.pyx b/src/sage/data_structures/bitset.pyx index 9d5c99c4078..973102fc2a6 100644 --- a/src/sage/data_structures/bitset.pyx +++ b/src/sage/data_structures/bitset.pyx @@ -72,7 +72,7 @@ cdef class FrozenBitset: - ``string`` -- if a nonempty string, then the bitset is initialized by including an element if the index of the string is ``1``. If the - string is empty, then raise a :class:`ValueError`. + string is empty, then raise a :exc:`ValueError`. - ``iterable`` -- if an iterable, then it is assumed to contain a list of nonnegative integers and those integers are placed in the set @@ -1791,7 +1791,7 @@ cdef class Bitset(FrozenBitset): """ Update the bitset by removing ``n``. - This raises a :class:`KeyError` if ``n`` is not contained + This raises a :exc:`KeyError` if ``n`` is not contained in the bitset. EXAMPLES:: @@ -1866,7 +1866,7 @@ cdef class Bitset(FrozenBitset): """ Remove and return an arbitrary element from the set. - This raises a :class:`KeyError` if the set is empty. + This raises a :exc:`KeyError` if the set is empty. EXAMPLES:: diff --git a/src/sage/data_structures/bitset_base.pxd b/src/sage/data_structures/bitset_base.pxd index 0ffe4ed9af9..b2fb299dd9c 100644 --- a/src/sage/data_structures/bitset_base.pxd +++ b/src/sage/data_structures/bitset_base.pxd @@ -457,7 +457,7 @@ cdef inline bint bitset_remove(fused_bitset_t bits, mp_bitcnt_t n) except -1: """ Remove ``n`` from ``bits``. - This raises a :class:`KeyError` if ``n`` is not contained in ``bits``. + This raises a :exc:`KeyError` if ``n`` is not contained in ``bits``. """ if not bitset_in(bits, n): raise KeyError(n) @@ -562,7 +562,7 @@ cdef inline long bitset_pop(fused_bitset_t a) except -1: """ Remove and return an arbitrary element from the set. - This raises a :class:`KeyError` if the set is empty. + This raises a :exc:`KeyError` if the set is empty. """ cdef long i = bitset_first(a) if i == -1: diff --git a/src/sage/data_structures/bounded_integer_sequences.pyx b/src/sage/data_structures/bounded_integer_sequences.pyx index bced189b92d..1b23b5ed8a7 100644 --- a/src/sage/data_structures/bounded_integer_sequences.pyx +++ b/src/sage/data_structures/bounded_integer_sequences.pyx @@ -444,7 +444,7 @@ cdef class BoundedIntegerSequence: INPUT: - - ``bound`` -- nonnegative integer. When zero, a :class:`ValueError` + - ``bound`` -- nonnegative integer. When zero, a :exc:`ValueError` will be raised. Otherwise, the given bound is replaced by the power of two that is at least the given bound. - ``data`` -- list of integers diff --git a/src/sage/data_structures/mutable_poset.py b/src/sage/data_structures/mutable_poset.py index ecb23f34548..0acef5aca6e 100644 --- a/src/sage/data_structures/mutable_poset.py +++ b/src/sage/data_structures/mutable_poset.py @@ -2201,19 +2201,19 @@ def remove(self, key, raise_key_error=True): - ``key`` -- the key of an object - ``raise_key_error`` -- boolean (default: ``True``); switch raising - :class:`KeyError` on and off + :exc:`KeyError` on and off OUTPUT: nothing If the element is not a member and ``raise_key_error`` is set - (default), raise a :class:`KeyError`. + (default), raise a :exc:`KeyError`. .. NOTE:: As with Python's ``set``, the methods :meth:`remove` and :meth:`discard` only differ in their behavior when an element is not contained in the poset: :meth:`remove` - raises a :class:`KeyError` whereas :meth:`discard` does not + raises a :exc:`KeyError` whereas :meth:`discard` does not raise any exception. This default behavior can be overridden with the @@ -2379,19 +2379,19 @@ def discard(self, key, raise_key_error=False): - ``key`` -- the key of an object - ``raise_key_error`` -- boolean (default: ``False``); switch raising - :class:`KeyError` on and off + :exc:`KeyError` on and off OUTPUT: nothing If the element is not a member and ``raise_key_error`` is set - (not default), raise a :class:`KeyError`. + (not default), raise a :exc:`KeyError`. .. NOTE:: As with Python's ``set``, the methods :meth:`remove` and :meth:`discard` only differ in their behavior when an element is not contained in the poset: :meth:`remove` - raises a :class:`KeyError` whereas :meth:`discard` does not + raises a :exc:`KeyError` whereas :meth:`discard` does not raise any exception. This default behavior can be overridden with the diff --git a/src/sage/databases/conway.py b/src/sage/databases/conway.py index 04426daab9e..38458806b76 100644 --- a/src/sage/databases/conway.py +++ b/src/sage/databases/conway.py @@ -173,7 +173,7 @@ def __iter__(self): def polynomial(self, p, n): """ Return the Conway polynomial of degree ``n`` over ``GF(p)``, - or raise a :class:`RuntimeError` if this polynomial is not in the + or raise a :exc:`RuntimeError` if this polynomial is not in the database. .. NOTE:: diff --git a/src/sage/databases/cremona.py b/src/sage/databases/cremona.py index b2134dd1e3b..c0a8e08f57a 100644 --- a/src/sage/databases/cremona.py +++ b/src/sage/databases/cremona.py @@ -946,7 +946,7 @@ def elliptic_curve_from_ainvs(self, ainvs): Return the elliptic curve in the database of with minimal ``ainvs`` if it exists. - This raises a :class:`RuntimeError` exception otherwise. + This raises a :exc:`RuntimeError` exception otherwise. INPUT: diff --git a/src/sage/databases/sloane.py b/src/sage/databases/sloane.py index 3d18c86a301..e410f861f3a 100644 --- a/src/sage/databases/sloane.py +++ b/src/sage/databases/sloane.py @@ -307,7 +307,7 @@ def sequence_name(self, N): Return the name of sequence ``N`` in the encyclopedia. If sequence ``N`` does not exist, return ``''``. If the names - database is not installed, raise an :class:`IOError`. + database is not installed, raise an :exc:`IOError`. INPUT: diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index 57d5b704743..4908959e497 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -613,7 +613,7 @@ def second_on_modern_computer(self): Float. The wall time on your computer that would be equivalent to one second on a modern computer. Unless you have kick-ass hardware this should always be >= 1.0. This raises a - :class:`RuntimeError` if there are no stored timings to use as + :exc:`RuntimeError` if there are no stored timings to use as benchmark. EXAMPLES:: @@ -1117,7 +1117,7 @@ def source_baseline(self, source): def run_doctests(self): """ - Actually runs the doctests. + Actually run the doctests. This function is called by :meth:`run`. diff --git a/src/sage/doctest/parsing.py b/src/sage/doctest/parsing.py index c175e12f713..1649361be03 100644 --- a/src/sage/doctest/parsing.py +++ b/src/sage/doctest/parsing.py @@ -146,7 +146,7 @@ def parse_optional_tags( - ``string`` -- string - - ``return_string_sans_tags`` -- boolean (default: ``False``);; whether to + - ``return_string_sans_tags`` -- boolean (default: ``False``); whether to additionally return ``string`` with the optional tags removed but other comments kept and a boolean ``is_persistent`` diff --git a/src/sage/doctest/tests/fail_and_die.rst b/src/sage/doctest/tests/fail_and_die.rst index 90d7d3428e6..65e652f4f5e 100644 --- a/src/sage/doctest/tests/fail_and_die.rst +++ b/src/sage/doctest/tests/fail_and_die.rst @@ -1,4 +1,4 @@ -The ``NameError`` raised on the second line should be displayed, even +The :exc:`NameError` raised on the second line should be displayed, even if we crash immediately afterwards:: sage: import time, signal diff --git a/src/sage/doctest/tests/initial.rst b/src/sage/doctest/tests/initial.rst index 595cf2b54fa..f6eec87bec5 100644 --- a/src/sage/doctest/tests/initial.rst +++ b/src/sage/doctest/tests/initial.rst @@ -1,4 +1,4 @@ -One initial typo causes a ``NameError`` in the first test and many +One initial typo causes a :exc:`NameError` in the first test and many following failures:: sage: a = binomiak(10,5) # random to test that we still get the exception diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index f095a1d632f..8e821956956 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -3381,7 +3381,7 @@ def affine_preperiodic_model(self, m, n, return_conjugation=False): If the base ring of this dynamical system is finite, there may not be a model with affine preperiodic points, in which case a - :class:`ValueError` is raised. + :exc:`ValueError` is raised. INPUT: diff --git a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py index cb65d1cecf3..62522515fe5 100644 --- a/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py +++ b/src/sage/dynamics/arithmetic_dynamics/wehlerK3.py @@ -198,7 +198,7 @@ def _check_satisfies_equations(self, P): - ``P`` -- point in `\mathbb{P}^2 \times \mathbb{P}^2` - OUTPUT: ``True`` if the point is not on the surface; ``AttributeError`` + OUTPUT: ``True`` if the point is not on the surface; :exc:`AttributeError` otherwise EXAMPLES:: diff --git a/src/sage/ext/fast_callable.pyx b/src/sage/ext/fast_callable.pyx index ae30369f595..2fa8a234b9d 100644 --- a/src/sage/ext/fast_callable.pyx +++ b/src/sage/ext/fast_callable.pyx @@ -2672,7 +2672,7 @@ class FastCallableFloatWrapper: An instance of :class:`FastCallableFloatWrapper` that can be called just like ``ff``, but that always returns a :class:`float` - if no error is raised. A :class:`ValueError` is raised if the + if no error is raised. A :exc:`ValueError` is raised if the imaginary part of the result exceeds ``imag_tol``. EXAMPLES: @@ -2703,7 +2703,7 @@ class FastCallableFloatWrapper: TESTS: - Evaluation either returns a :class:`float`, or raises a :class:`ValueError`:: + Evaluation either returns a :class:`float`, or raises a :exc:`ValueError`:: sage: # needs sage.symbolic sage: from sage.ext.fast_callable import FastCallableFloatWrapper diff --git a/src/sage/ext/memory.pyx b/src/sage/ext/memory.pyx index b5d9e422410..76f51623d96 100644 --- a/src/sage/ext/memory.pyx +++ b/src/sage/ext/memory.pyx @@ -44,7 +44,7 @@ cdef extern from "Python.h": cdef void alloc_error(size_t size) noexcept nogil: """ - Jump back to ``sig_on()``, raising a :class:`MemoryError`. + Jump back to ``sig_on()``, raising a :exc:`MemoryError`. """ with gil: PyErr_Format(MemoryError, "failed to allocate %zu bytes", size) diff --git a/src/sage/features/__init__.py b/src/sage/features/__init__.py index 3da9f648aae..81602180d80 100644 --- a/src/sage/features/__init__.py +++ b/src/sage/features/__init__.py @@ -229,7 +229,7 @@ def _is_present(self): def require(self): r""" - Raise a :class:`FeatureNotPresentError` if the feature is not present. + Raise a :exc:`FeatureNotPresentError` if the feature is not present. EXAMPLES:: @@ -601,7 +601,7 @@ class FileFeature(Feature): True To work with the file described by the feature, use the method :meth:`absolute_filename`. - A :class:`FeatureNotPresentError` is raised if the file cannot be found:: + A :exc:`FeatureNotPresentError` is raised if the file cannot be found:: sage: Executable(name='does-not-exist', executable='does-not-exist-xxxxyxyyxyy').absolute_filename() Traceback (most recent call last): @@ -733,7 +733,7 @@ def absolute_filename(self) -> str: sage: Executable(name='sh', executable='sh').absolute_filename() '/...bin/sh' - A :class:`FeatureNotPresentError` is raised if the file cannot be found:: + A :exc:`FeatureNotPresentError` is raised if the file cannot be found:: sage: Executable(name='does-not-exist', executable='does-not-exist-xxxxyxyyxyy').absolute_filename() Traceback (most recent call last): @@ -816,7 +816,7 @@ def absolute_filename(self) -> str: sage: feature.absolute_filename() == file_path True - A :class:`FeatureNotPresentError` is raised if the file cannot be found:: + A :exc:`FeatureNotPresentError` is raised if the file cannot be found:: sage: from sage.features import StaticFile sage: StaticFile(name='no_such_file', filename='KaT1aihu',\ diff --git a/src/sage/features/threejs.py b/src/sage/features/threejs.py index c8f91b83f6c..56ad807babf 100644 --- a/src/sage/features/threejs.py +++ b/src/sage/features/threejs.py @@ -54,7 +54,7 @@ def required_version(self): Defining what version is required is delegated to the distribution package that provides the file ``threejs-version.txt`` in :mod:`sage.ext_data.threejs`. - If the file is not provided, :class:`FileNotFoundError` is raised. + If the file is not provided, :exc:`FileNotFoundError` is raised. EXAMPLES:: diff --git a/src/sage/functions/piecewise.py b/src/sage/functions/piecewise.py index 70db7b87712..8a8cbcb62b2 100644 --- a/src/sage/functions/piecewise.py +++ b/src/sage/functions/piecewise.py @@ -113,7 +113,7 @@ def __call__(self, function_pieces, **kwds): OUTPUT: - A piecewise-defined function. A :class:`ValueError` will be raised + A piecewise-defined function. A :exc:`ValueError` will be raised if the domains of the pieces are not pairwise disjoint. EXAMPLES:: diff --git a/src/sage/homology/chain_complex_morphism.py b/src/sage/homology/chain_complex_morphism.py index 336b2e16b4e..96080c9e33b 100644 --- a/src/sage/homology/chain_complex_morphism.py +++ b/src/sage/homology/chain_complex_morphism.py @@ -430,7 +430,7 @@ def __mul__(self, x): [2] Before :issue:`19065`, the following multiplication produced a - :class:`KeyError` because `f` was not explicitly defined in degree 2:: + :exc:`KeyError` because `f` was not explicitly defined in degree 2:: sage: C0 = ChainComplex({0: zero_matrix(ZZ, 0, 1)}) sage: C1 = ChainComplex({1: zero_matrix(ZZ, 0, 1)}) diff --git a/src/sage/knots/knotinfo.py b/src/sage/knots/knotinfo.py index 1be8f145b68..dbea352d8fc 100644 --- a/src/sage/knots/knotinfo.py +++ b/src/sage/knots/knotinfo.py @@ -1960,7 +1960,7 @@ def link(self, use_item=db.columns().pd_notation, snappy=False): the target of the conversion is the ``pip`` installable package `SnapPy `__ (explicitely, ``spherogram.links.invariants.Link``). - If SnapPy is not installed an :class:`ImportError` is raised. To + If SnapPy is not installed an :exc:`ImportError` is raised. To install SnapPy use ``sage -pip install snappy``. .. NOTE:: diff --git a/src/sage/knots/link.py b/src/sage/knots/link.py index fa5ebe82fc0..438c4911bc7 100644 --- a/src/sage/knots/link.py +++ b/src/sage/knots/link.py @@ -4082,7 +4082,7 @@ def get_knotinfo(self, mirror_version=True, unique=True): (that is: ``m`` is suppressed). If it is not possible to determine a unique result - a :class:`NotImplementedError` + a :exc:`NotImplementedError` will be raised. To avoid this you can set ``unique`` to ``False``. You will get a list of matching candidates instead. diff --git a/src/sage/manifolds/subsets/pullback.py b/src/sage/manifolds/subsets/pullback.py index 4604e82f6de..d62f9936368 100644 --- a/src/sage/manifolds/subsets/pullback.py +++ b/src/sage/manifolds/subsets/pullback.py @@ -501,7 +501,7 @@ def _coord_def(map, codomain_subset): instance of :class:`RealSet`; if ``map`` is a :class:`Chart`, the relative interior of a polyhedron - For other inputs, a :class:`NotImplementedError` will be raised. + For other inputs, a :exc:`NotImplementedError` will be raised. OUTPUT: diff --git a/src/sage/matroids/graphic_matroid.pyx b/src/sage/matroids/graphic_matroid.pyx index af6af225a87..a01cef13fe3 100644 --- a/src/sage/matroids/graphic_matroid.pyx +++ b/src/sage/matroids/graphic_matroid.pyx @@ -812,7 +812,7 @@ cdef class GraphicMatroid(Matroid): - ``X`` -- an iterable container of groundset elements OUTPUT: ``frozenset`` instance containing a subset of ``X``; - a :class:`ValueError` is raised if the set contains no circuit + a :exc:`ValueError` is raised if the set contains no circuit EXAMPLES:: diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index 5965a4455f9..bfcf7d361a2 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -659,7 +659,7 @@ cdef class Matroid(SageObject): OUTPUT: ``frozenset`` instance containing a subset of the groundset. - A :class:`ValueError` is raised if the set contains no circuit. + A :exc:`ValueError` is raised if the set contains no circuit. EXAMPLES:: @@ -793,7 +793,7 @@ cdef class Matroid(SageObject): OUTPUT: ``frozenset`` instance containing a subset of the groundset. - A :class:`ValueError` is raised if the set contains no cocircuit. + A :exc:`ValueError` is raised if the set contains no cocircuit. EXAMPLES:: diff --git a/src/sage/quadratic_forms/quadratic_form.py b/src/sage/quadratic_forms/quadratic_form.py index ba8975cf331..f21f31cebe3 100644 --- a/src/sage/quadratic_forms/quadratic_form.py +++ b/src/sage/quadratic_forms/quadratic_form.py @@ -1202,7 +1202,7 @@ def Gram_matrix(self): Q(x) = x^t\cdot A\cdot x, defined over the base ring of `Q`. If this is not possible, - then a :class:`TypeError` is raised. + then a :exc:`TypeError` is raised. EXAMPLES:: diff --git a/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py b/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py index 205ca57bc13..6e47726f08f 100644 --- a/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py +++ b/src/sage/quadratic_forms/quadratic_form__equivalence_testing.py @@ -445,7 +445,7 @@ def is_rationally_isometric(self, other, return_matrix=False): ... NotImplementedError: this only tests regular forms - Forms must have the same base ring otherwise a :class:`TypeError` is raised:: + Forms must have the same base ring otherwise a :exc:`TypeError` is raised:: sage: # needs sage.rings.number_field sage: K1. = QuadraticField(5) diff --git a/src/sage/sets/condition_set.py b/src/sage/sets/condition_set.py index e9719be1e3e..a0d618ebdde 100644 --- a/src/sage/sets/condition_set.py +++ b/src/sage/sets/condition_set.py @@ -373,7 +373,7 @@ def _an_element_(self): r""" Return an element of ``self``. - This may raise :class:`NotImplementedError`. + This may raise :exc:`NotImplementedError`. TESTS:: diff --git a/src/sage/sets/finite_enumerated_set.py b/src/sage/sets/finite_enumerated_set.py index 3e949e43161..ce959031800 100644 --- a/src/sage/sets/finite_enumerated_set.py +++ b/src/sage/sets/finite_enumerated_set.py @@ -380,7 +380,7 @@ def _element_constructor_(self, el): - ``el`` -- an element of ``self`` - If ``el`` is not an element of ``self``, a :class:`ValueError` + If ``el`` is not an element of ``self``, a :exc:`ValueError` is raised. TESTS:: diff --git a/src/sage/stats/basic_stats.py b/src/sage/stats/basic_stats.py index 2e161e8578d..61fce790fa2 100644 --- a/src/sage/stats/basic_stats.py +++ b/src/sage/stats/basic_stats.py @@ -368,7 +368,7 @@ def median(v): If `v` is empty, we define the median to be NaN, which is consistent with NumPy (note that R returns NULL). - If `v` is comprised of strings, :class:`TypeError` occurs. + If `v` is comprised of strings, :exc:`TypeError` occurs. For elements other than numbers, the median is a result of :func:`sorted`. This function is deprecated. Use :func:`numpy.median` or :func:`numpy.nanmedian` diff --git a/src/sage/stats/intlist.pyx b/src/sage/stats/intlist.pyx index 88a0ee9ff14..6f337badad5 100644 --- a/src/sage/stats/intlist.pyx +++ b/src/sage/stats/intlist.pyx @@ -414,7 +414,7 @@ cdef class IntList: def min(self, bint index=False): """ Return the smallest value in this integer list. If this - series has length 0 we raise a :class:`ValueError`. + series has length 0 we raise a :exc:`ValueError`. INPUT: @@ -452,7 +452,7 @@ cdef class IntList: def max(self, bint index=False): """ Return the largest value in this time series. If this series - has length 0 we raise a :class:`ValueError` + has length 0 we raise a :exc:`ValueError` INPUT: diff --git a/src/sage/stats/time_series.pyx b/src/sage/stats/time_series.pyx index 84fdf013665..c4e0310c07d 100644 --- a/src/sage/stats/time_series.pyx +++ b/src/sage/stats/time_series.pyx @@ -1466,7 +1466,7 @@ cdef class TimeSeries: {\sum_{t=0}^{n-1} (x_t - \mu)^2}. Note that the variance must be nonzero or you will get a - :class:`ZeroDivisionError`. + :exc:`ZeroDivisionError`. INPUT: @@ -1669,7 +1669,7 @@ cdef class TimeSeries: r""" Return the smallest value in this time series. - If this series has length 0, we raise a :class:`ValueError`. + If this series has length 0, we raise a :exc:`ValueError`. INPUT: @@ -1707,7 +1707,7 @@ cdef class TimeSeries: def max(self, bint index=False): r""" Return the largest value in this time series. If this series - has length 0 we raise a :class:`ValueError`. + has length 0 we raise a :exc:`ValueError`. INPUT: diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx index dc46fb77414..3c1c6ced140 100644 --- a/src/sage/structure/coerce.pyx +++ b/src/sage/structure/coerce.pyx @@ -31,7 +31,7 @@ If there is a coercion (see below) from one of the parents to the other, the operation is always performed in the codomain of that coercion. Otherwise a reasonable attempt to create a new parent with coercion maps from both original parents is made. The results of these discoveries are cached. -On failure, a :class:`TypeError` is always raised. +On failure, a :exc:`TypeError` is always raised. Some arithmetic operations (such as multiplication) can indicate an action rather than arithmetic in a common parent. For example:: @@ -695,7 +695,7 @@ cdef class CoercionModel: cpdef _record_exception(self): r""" - Pushes the last exception that occurred onto the stack for later reference, + Push the last exception that occurred onto the stack for later reference, for internal use. If the stack has not yet been flagged as cleared, we clear it now (rather @@ -1038,7 +1038,7 @@ cdef class CoercionModel: OUTPUT: A :class:`Parent` into which each input should coerce, or raises a - :class:`TypeError` if no such :class:`Parent` can be found. + :exc:`TypeError` if no such :class:`Parent` can be found. EXAMPLES:: @@ -1139,7 +1139,7 @@ cdef class CoercionModel: corresponding to ``op``, and failing that, it tries to coerce `x` and `y` into a common parent and calls ``op`` on them. - If it cannot make sense of the operation, a :class:`TypeError` is raised. + If it cannot make sense of the operation, a :exc:`TypeError` is raised. INPUT: diff --git a/src/sage/structure/coerce_dict.pyx b/src/sage/structure/coerce_dict.pyx index 03ae41b902e..e060bc73a28 100644 --- a/src/sage/structure/coerce_dict.pyx +++ b/src/sage/structure/coerce_dict.pyx @@ -276,7 +276,7 @@ cdef class MonoDict: - ``data`` -- (optional) iterable defining initial data, as dict or iterable of (key, value) pairs - - ``weak_values`` -- (optional) boolean (default: ``False``); if it is + - ``weak_values`` -- boolean (default: ``False``); if it is ``True``, weak references to the values in this dictionary will be used, when possible @@ -1006,7 +1006,7 @@ cdef class TripleDict: - ``data`` -- (optional) iterable defining initial data, as dict or iterable of (key, value) pairs - - ``weak_values`` -- (optional) boolean (default: ``False``); if it is + - ``weak_values`` -- boolean (default: ``False``); if it is ``True``, weak references to the values in this dictionary will be used, when possible diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index 0b81f7c3459..0a51c4516c5 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -1247,7 +1247,7 @@ cdef class Element(SageObject): This default Cython implementation of ``_add_`` calls the Python method ``self._add_`` if it exists. This method may be defined in the ``ElementMethods`` of the category of the parent. - If the method is not found, a ``TypeError`` is raised + If the method is not found, a :exc:`TypeError` is raised indicating that the operation is not supported. See :ref:`element_arithmetic`. @@ -1359,7 +1359,7 @@ cdef class Element(SageObject): This default Cython implementation of ``_sub_`` calls the Python method ``self._sub_`` if it exists. This method may be defined in the ``ElementMethods`` of the category of the parent. - If the method is not found, a ``TypeError`` is raised + If the method is not found, a :exc:`TypeError` is raised indicating that the operation is not supported. See :ref:`element_arithmetic`. @@ -1413,7 +1413,7 @@ cdef class Element(SageObject): This default Cython implementation of ``_neg_`` calls the Python method ``self._neg_`` if it exists. This method may be defined in the ``ElementMethods`` of the category of the parent. - If the method is not found, a ``TypeError`` is raised + If the method is not found, a :exc:`TypeError` is raised indicating that the operation is not supported. See :ref:`element_arithmetic`. @@ -1527,7 +1527,7 @@ cdef class Element(SageObject): This default Cython implementation of ``_mul_`` calls the Python method ``self._mul_`` if it exists. This method may be defined in the ``ElementMethods`` of the category of the parent. - If the method is not found, a ``TypeError`` is raised + If the method is not found, a :exc:`TypeError` is raised indicating that the operation is not supported. See :ref:`element_arithmetic`. @@ -1640,7 +1640,7 @@ cdef class Element(SageObject): This default Cython implementation of ``_matmul_`` calls the Python method ``self._matmul_`` if it exists. This method may be defined in the ``ElementMethods`` of the category of the - parent. If the method is not found, a ``TypeError`` is raised + parent. If the method is not found, a :exc:`TypeError` is raised indicating that the operation is not supported. See :ref:`element_arithmetic`. @@ -1743,7 +1743,7 @@ cdef class Element(SageObject): This default Cython implementation of ``_div_`` calls the Python method ``self._div_`` if it exists. This method may be defined in the ``ElementMethods`` of the category of the parent. - If the method is not found, a ``TypeError`` is raised + If the method is not found, a :exc:`TypeError` is raised indicating that the operation is not supported. See :ref:`element_arithmetic`. @@ -1843,7 +1843,7 @@ cdef class Element(SageObject): This default Cython implementation of ``_floordiv_`` calls the Python method ``self._floordiv_`` if it exists. This method may be defined in the ``ElementMethods`` of the category of the parent. - If the method is not found, a ``TypeError`` is raised + If the method is not found, a :exc:`TypeError` is raised indicating that the operation is not supported. See :ref:`element_arithmetic`. @@ -1943,7 +1943,7 @@ cdef class Element(SageObject): This default Cython implementation of ``_mod_`` calls the Python method ``self._mod_`` if it exists. This method may be defined in the ``ElementMethods`` of the category of the parent. - If the method is not found, a ``TypeError`` is raised + If the method is not found, a :exc:`TypeError` is raised indicating that the operation is not supported. See :ref:`element_arithmetic`. @@ -2070,7 +2070,7 @@ cdef class Element(SageObject): This default Cython implementation of ``_pow_`` calls the Python method ``self._pow_`` if it exists. This method may be defined in the ``ElementMethods`` of the category of the parent. - If the method is not found, a ``TypeError`` is raised + If the method is not found, a :exc:`TypeError` is raised indicating that the operation is not supported. See :ref:`element_arithmetic`. @@ -2100,7 +2100,7 @@ cdef class Element(SageObject): This default Cython implementation of ``_pow_int`` calls the Python method ``self._pow_int`` if it exists. This method may be defined in the ``ElementMethods`` of the category of the parent. - If the method is not found, a ``TypeError`` is raised + If the method is not found, a :exc:`TypeError` is raised indicating that the operation is not supported. See :ref:`element_arithmetic`. @@ -2715,7 +2715,7 @@ cdef class RingElement(ModuleElement): sage: 2r^(1/2) # needs sage.symbolic sqrt(2) - Exponent overflow should throw an :class:`OverflowError` (:issue:`2956`):: + Exponent overflow should throw an :exc:`OverflowError` (:issue:`2956`):: sage: K. = AA[] # needs sage.rings.number_field sage: x^(2^64 + 12345) # needs sage.rings.number_field @@ -2842,7 +2842,7 @@ cdef class RingElement(ModuleElement): def multiplicative_order(self): r""" Return the multiplicative order of ``self``, if ``self`` is a unit, - or raise ``ArithmeticError`` otherwise. + or raise :exc:`ArithmeticError` otherwise. """ if not self.is_unit(): raise ArithmeticError("self (=%s) must be a unit to have a multiplicative order.") diff --git a/src/sage/structure/factorization.py b/src/sage/structure/factorization.py index 0114637803f..517cde0ea6b 100644 --- a/src/sage/structure/factorization.py +++ b/src/sage/structure/factorization.py @@ -228,7 +228,7 @@ def __init__(self, x, unit=None, cr=False, sort=True, simplify=True): INPUT: - ``x`` -- list of pairs (p, e) with e an integer - otherwise a :class:`TypeError` is raised + otherwise a :exc:`TypeError` is raised - ``unit`` -- (default: 1) the unit part of the factorization @@ -556,7 +556,7 @@ def base_change(self, U): sage: F.base_change(P).universe() Univariate Polynomial Ring in x over Integer Ring - This method will return a :class:`TypeError` if the coercion is not + This method will return a :exc:`TypeError` if the coercion is not possible:: sage: g = x^2 - 1 @@ -1037,7 +1037,7 @@ def __mul__(self, other): If the two factorizations have different universes, this method will attempt to find a common universe for the - product. A :class:`TypeError` is raised if this is impossible. + product. A :exc:`TypeError` is raised if this is impossible. EXAMPLES:: @@ -1274,7 +1274,7 @@ def gcd(self, other): If the two factorizations have different universes, this method will attempt to find a common universe for the - gcd. A :class:`TypeError` is raised if this is impossible. + gcd. A :exc:`TypeError` is raised if this is impossible. EXAMPLES:: @@ -1316,7 +1316,7 @@ def lcm(self, other): If the two factorizations have different universes, this method will attempt to find a common universe for the - lcm. A :class:`TypeError` is raised if this is impossible. + lcm. A :exc:`TypeError` is raised if this is impossible. EXAMPLES:: @@ -1375,7 +1375,7 @@ def radical(self): Return the factorization of the radical of the value of ``self``. First, check that all exponents in the factorization are - positive, raise :class:`ValueError` otherwise. If all exponents are + positive, raise :exc:`ValueError` otherwise. If all exponents are positive, return ``self`` with all exponents set to 1 and with the unit set to 1. @@ -1400,7 +1400,7 @@ def radical_value(self): Return the product of the prime factors in ``self``. First, check that all exponents in the factorization are - positive, raise :class:`ValueError` otherwise. If all exponents are + positive, raise :exc:`ValueError` otherwise. If all exponents are positive, return the product of the prime factors in ``self``. This should be functionally equivalent to ``self.radical().value()``. diff --git a/src/sage/structure/list_clone.pyx b/src/sage/structure/list_clone.pyx index f7ff39fd3a4..03c0cd23530 100644 --- a/src/sage/structure/list_clone.pyx +++ b/src/sage/structure/list_clone.pyx @@ -295,7 +295,7 @@ cdef class ClonableElement(Element): """ Check that ``self`` is mutable. - Raise a ``ValueError`` if ``self`` is immutable. + Raise a :exc:`ValueError` if ``self`` is immutable. TESTS:: diff --git a/src/sage/structure/parent.pyx b/src/sage/structure/parent.pyx index ace65b67522..44c23ff8fb0 100644 --- a/src/sage/structure/parent.pyx +++ b/src/sage/structure/parent.pyx @@ -1345,7 +1345,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): Return the unique homomorphism from ``self`` to ``codomain`` that sends ``self.gens()`` to the entries of ``im_gens``. - This raises a :class:`TypeError` if there is no such homomorphism. + This raises a :exc:`TypeError` if there is no such homomorphism. INPUT: @@ -1409,7 +1409,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): To: Finite Field of size 5 There might not be a natural morphism, in which case a - ``TypeError`` is raised:: + :exc:`TypeError` is raised:: sage: QQ.hom(ZZ) Traceback (most recent call last): @@ -2766,7 +2766,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): This is used both for illustration and testing purposes. If the set ``self`` is empty, :meth:`an_element` raises the - exception :class:`EmptySetError`. + exception :exc:`EmptySetError`. This calls :meth:`_an_element_` (which see), and caches the result. Parent are thus encouraged to override :meth:`_an_element_`. @@ -2778,7 +2778,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): sage: ZZ[['t']].an_element() t - In case the set is empty, an :class:`EmptySetError` is raised:: + In case the set is empty, an :exc:`EmptySetError` is raised:: sage: Set([]).an_element() Traceback (most recent call last): diff --git a/src/sage/structure/parent_gens.pyx b/src/sage/structure/parent_gens.pyx index 8de3081e16f..b27002d1254 100644 --- a/src/sage/structure/parent_gens.pyx +++ b/src/sage/structure/parent_gens.pyx @@ -203,7 +203,7 @@ cdef class ParentWithGens(ParentWithBase): sends ``self.gens()`` to the entries of ``im_gens`` and induces the map ``base_map`` on the base ring. - This raises a :class:`TypeError` if there is no such homomorphism. + This raises a :exc:`TypeError` if there is no such homomorphism. INPUT: @@ -272,7 +272,7 @@ cdef class ParentWithGens(ParentWithBase): To: Finite Field of size 5 There might not be a natural morphism, in which case a - :class:`TypeError` exception is raised. + :exc:`TypeError` exception is raised. :: diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py index 4e95cc50e9a..957f684f833 100644 --- a/src/sage/tests/cmdline.py +++ b/src/sage/tests/cmdline.py @@ -71,7 +71,7 @@ def test_executable(args, input='', timeout=100.0, pydebug_ignore_warnings=False should end with a newline - ``timeout`` -- if the program produces no output for ``timeout`` - seconds, a :class:`RuntimeError` is raised + seconds, a :exc:`RuntimeError` is raised - ``pydebug_ignore_warnings`` -- boolean. Set the PYTHONWARNINGS environment variable to ignore Python warnings when on a Python debug build (`--with-pydebug`, e.g. from building with diff --git a/src/sage/topology/cubical_complex.py b/src/sage/topology/cubical_complex.py index f7bf2b92680..d027525a49b 100644 --- a/src/sage/topology/cubical_complex.py +++ b/src/sage/topology/cubical_complex.py @@ -109,7 +109,7 @@ class Cube(SageObject): Each cube is stored in a standard form: a tuple of tuples, with a nondegenerate interval ``[j,j]`` represented by ``(j,j)``, not ``(j,)``. (This is so that for any interval ``I``, ``I[1]`` will - produce a value, not an :class:`IndexError`.) + produce a value, not an :exc:`IndexError`.) EXAMPLES:: diff --git a/src/sage/topology/simplicial_complex.py b/src/sage/topology/simplicial_complex.py index 127cb3ad1fc..338b708e07b 100644 --- a/src/sage/topology/simplicial_complex.py +++ b/src/sage/topology/simplicial_complex.py @@ -1280,7 +1280,7 @@ def __call__(self, simplex): """ If ``simplex`` is a simplex in this complex, return it. - Otherwise, this raises a :class:`ValueError`. + Otherwise, this raises a :exc:`ValueError`. EXAMPLES::