Skip to content

Commit a9cb852

Browse files
author
Release Manager
committed
gh-36336: add some class roles for linking Errors in doc this is adding a few `class` roles so that errors in the doc are linked to python documentation Here done mostly for `TypeError` ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. URL: #36336 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents 247ea88 + 93e54a5 commit a9cb852

File tree

20 files changed

+53
-42
lines changed

20 files changed

+53
-42
lines changed

src/sage/databases/conway.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def __iter__(self):
179179
def polynomial(self, p, n):
180180
"""
181181
Return the Conway polynomial of degree ``n`` over ``GF(p)``,
182-
or raise a RuntimeError if this polynomial is not in the
182+
or raise a :class:`RuntimeError` if this polynomial is not in the
183183
database.
184184
185185
.. NOTE::

src/sage/graphs/generic_graph.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,8 @@ def adjacency_matrix(self, sparse=None, vertices=None, *, base_ring=None, **kwds
19111911
matrix. By default, the ordering given by
19121912
:meth:`GenericGraph.vertices` with ``sort=True`` is used.
19131913
If the vertices are not comparable, the keyword ``vertices`` must be
1914-
used to specify an ordering, or a TypeError exception will be raised.
1914+
used to specify an ordering, or a :class:`TypeError` exception will
1915+
be raised.
19151916

19161917
- ``base_ring`` -- a ring (default: ``ZZ``); the base ring of the matrix
19171918
space to use.

src/sage/interfaces/singular.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def eval(self, x, allow_semicolon=True, strip=True, **kwds):
584584
- ``x`` - string (of code)
585585
586586
- ``allow_semicolon`` - default: False; if False then
587-
raise a TypeError if the input line contains a semicolon.
587+
raise a :class:`TypeError` if the input line contains a semicolon.
588588
589589
- ``strip`` - ignored
590590

src/sage/matrix/matrix_cyclo_dense.pyx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,9 @@ cdef class Matrix_cyclo_dense(Matrix_dense):
680680

681681
cdef long _hash_(self) except -1:
682682
"""
683-
Return hash of an immutable matrix. Raise a TypeError if input
684-
matrix is mutable.
683+
Return hash of an immutable matrix.
684+
685+
This raises a :class:`TypeError` if input matrix is mutable.
685686
686687
EXAMPLES:
687688

src/sage/matrix/matrix_space.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,8 +1343,8 @@ def _latex_(self):
13431343
def __len__(self):
13441344
"""
13451345
Return number of elements of this matrix space if it fits in
1346-
an int; raise a TypeError if there are infinitely many
1347-
elements, and raise an OverflowError if there are finitely
1346+
an int; raise a :class:`TypeError` if there are infinitely many
1347+
elements, and raise an :class:`OverflowError` if there are finitely
13481348
many but more than the size of an int.
13491349
13501350
EXAMPLES::

src/sage/modular/abvar/abvar.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -611,16 +611,19 @@ def newform_label(self):
611611

612612
def elliptic_curve(self):
613613
"""
614-
Return an elliptic curve isogenous to self. If self is not dimension 1
615-
with rational base ring, raise a ValueError.
614+
Return an elliptic curve isogenous to ``self``.
616615
617-
The elliptic curve is found by looking it up in the CremonaDatabase.
618-
The CremonaDatabase contains all curves up to some large conductor. If
619-
a curve is not found in the CremonaDatabase, a RuntimeError will be
620-
raised. In practice, only the most committed users will see this
621-
RuntimeError.
616+
If ``self`` is not dimension 1
617+
with rational base ring, this raises a :class:`ValueError`.
622618
623-
OUTPUT: an elliptic curve isogenous to self.
619+
The elliptic curve is found by looking it up in the
620+
CremonaDatabase. The CremonaDatabase contains all curves up
621+
to some large conductor. If a curve is not found in the
622+
CremonaDatabase, a :class:`RuntimeError` will be raised. In
623+
practice, only the most committed users will see this
624+
:class:`RuntimeError`.
625+
626+
OUTPUT: an elliptic curve isogenous to ``self``.
624627
625628
EXAMPLES::
626629
@@ -4183,7 +4186,8 @@ def modular_symbols(self, sign=0):
41834186
"""
41844187
Return space of modular symbols (with given sign) associated to
41854188
this modular abelian variety, if it can be found by cutting down
4186-
using Hecke operators. Otherwise raise a RuntimeError exception.
4189+
using Hecke operators. Otherwise raise a :class:`RuntimeError`
4190+
exception.
41874191
41884192
EXAMPLES::
41894193

src/sage/modular/overconvergent/genus0.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,10 @@ def change_ring(self, ring):
422422

423423
def base_extend(self, ring):
424424
r"""
425-
Return the base extension of self to the given base ring. There must be
426-
a canonical map to this ring from the current base ring, otherwise a
427-
TypeError will be raised.
425+
Return the base extension of ``self`` to the given base ring.
426+
427+
There must be a canonical map to this ring from the current
428+
base ring, otherwise a :class:`TypeError` will be raised.
428429
429430
EXAMPLES::
430431

src/sage/modular/pollack_stevens/dist.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ cdef class Dist_vector(Dist):
853853
sage: QQ(d)
854854
4/3
855855
856-
We get a TypeError if there is more than 1 moment::
856+
We get a :class:`TypeError` if there is more than 1 moment::
857857
858858
sage: D = Symk(1); d = D([1,2]); d
859859
(1, 2)

src/sage/modules/vector_space_homspace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def __call__(self, A, check=True, **kwds):
365365
sage: H.zero().is_zero()
366366
True
367367
368-
Previously the above code resulted in a TypeError because the
368+
Previously the above code resulted in a :class:`TypeError` because the
369369
dimensions of the matrix were incorrect.
370370
"""
371371
from .vector_space_morphism import is_VectorSpaceMorphism, VectorSpaceMorphism

src/sage/numerical/gauss_legendre.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def integrate_vector_N(f, prec, N=3):
304304
The nodes and weights are calculated in the real field with ``prec``
305305
bits of precision. If the vector space in which ``f`` takes values
306306
is over a field which is incompatible with this field (e.g. a finite
307-
field) then a TypeError occurs.
307+
field) then a :class:`TypeError` occurs.
308308
"""
309309
# We use nodes_uncached, because caching takes up memory, and numerics in
310310
# Bruin-DisneyHogg-Gao suggest that caching provides little benefit in the

0 commit comments

Comments
 (0)