Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Add missing sphinx reference roles #24393

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/reference/arrays.nditer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ because the nditer must copy this buffer data back to the original array once
iteration is finished, you must signal when the iteration is ended, by one of two
methods. You may either:

- used the nditer as a context manager using the `with` statement, and
- used the nditer as a context manager using the :keyword:`with` statement, and
the temporary data will be written back when the context is exited.
- call the iterator's `close` method once finished iterating, which will trigger
the write-back.
Expand Down
8 changes: 4 additions & 4 deletions doc/source/reference/c-api/array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ Converting data types

Convert a sequence of Python objects contained in *op* to an array
of ndarrays each having the same data type. The type is selected
in the same way as `PyArray_ResultType`. The length of the sequence is
in the same way as :c:func:`PyArray_ResultType`. The length of the sequence is
returned in *n*, and an *n* -length array of :c:type:`PyArrayObject`
pointers is the return value (or ``NULL`` if an error occurs).
The returned array must be freed by the caller of this routine
Expand Down Expand Up @@ -1249,7 +1249,7 @@ Special functions for NPY_OBJECT
strides, ordering, etc.) Sets the :c:data:`NPY_ARRAY_WRITEBACKIFCOPY` flag
and ``arr->base``, and set ``base`` to READONLY. Call
:c:func:`PyArray_ResolveWritebackIfCopy` before calling
`Py_DECREF` in order copy any changes back to ``base`` and
:c:func:`Py_DECREF` in order copy any changes back to ``base`` and
reset the READONLY flag.

Returns 0 for success, -1 for failure.
Expand Down Expand Up @@ -1580,7 +1580,7 @@ Conversion
Equivalent to :meth:`ndarray.getfield<numpy.ndarray.getfield>`
(*self*, *dtype*, *offset*). This function `steals a reference
<https://docs.python.org/3/c-api/intro.html?reference-count-details>`_
to `PyArray_Descr` and returns a new array of the given `dtype` using
to :c:func:`PyArray_Descr` and returns a new array of the given `dtype` using
the data in the current array at a specified `offset` in bytes. The
`offset` plus the itemsize of the new array type must be less than
``self->descr->elsize`` or an error is raised. The same shape and strides
Expand Down Expand Up @@ -2575,7 +2575,7 @@ cost of a slight overhead.
was repeated. For example, for the array [1, 2, 3, 4], x[-2] will
be 3, x[-2] will be 4, x[4] will be 1, x[5] will be 2, etc...

If the mode is constant filling (`NPY_NEIGHBORHOOD_ITER_CONSTANT_PADDING`),
If the mode is constant filling (:c:macro:`NPY_NEIGHBORHOOD_ITER_CONSTANT_PADDING`),
fill_value should point to an array object which holds the filling value
(the first item will be the filling value if the array contains more than
one item). For other cases, fill_value may be NULL.
Expand Down
6 changes: 3 additions & 3 deletions doc/source/reference/c-api/iterator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ Construction and Destruction
Causes the iterator to track a multi-index.
This prevents the iterator from coalescing axes to
produce bigger inner loops. If the loop is also not buffered
and no index is being tracked (`NpyIter_RemoveAxis` can be called),
and no index is being tracked (:c:func:`NpyIter_RemoveAxis` can be called),
then the iterator size can be ``-1`` to indicate that the iterator
is too large. This can happen due to complex broadcasting and
will result in errors being created when the setting the iterator
Expand Down Expand Up @@ -956,9 +956,9 @@ Construction and Destruction

Returns the number of elements being iterated. This is the product
of all the dimensions in the shape. When a multi index is being tracked
(and `NpyIter_RemoveAxis` may be called) the size may be ``-1`` to
(and :c:func:`NpyIter_RemoveAxis` may be called) the size may be ``-1`` to
indicate an iterator is too large. Such an iterator is invalid, but
may become valid after `NpyIter_RemoveAxis` is called. It is not
may become valid after :c:func:`NpyIter_RemoveAxis` is called. It is not
necessary to check for this case.

.. c:function:: npy_intp NpyIter_GetIterIndex(NpyIter* iter)
Expand Down
2 changes: 1 addition & 1 deletion doc/source/reference/c-api/ufunc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Functions
int nin, int nout, int identity, char *name, char *doc, int unused, \
char *signature, PyObject *identity_value)

This function is very similar to `PyUFunc_FromFuncAndDataAndSignature` above,
This function is very similar to :c:func:`PyUFunc_FromFuncAndDataAndSignature` above,
but has an extra *identity_value* argument, to define an arbitrary identity
for the ufunc when ``identity`` is passed as ``PyUFunc_IdentityValue``.

Expand Down
2 changes: 1 addition & 1 deletion numpy/core/_add_newdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4480,7 +4480,7 @@
A compatibility alias for `~ndarray.tobytes`, with exactly the same
behavior.

Despite its name, it returns `bytes` not `str`\ s.
Despite its name, it returns :class:`bytes` not :class:`str`\ s.

.. deprecated:: 1.19.0
"""))
Expand Down
12 changes: 6 additions & 6 deletions numpy/core/_add_newdocs_scalars.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def add_newdoc_for_scalar_type(obj, fixed_aliases, doc):

add_newdoc_for_scalar_type('int_', [],
"""
Signed integer type, compatible with Python `int` and C ``long``.
Signed integer type, compatible with Python :class:`int` and C ``long``.
""")

add_newdoc_for_scalar_type('longlong', [],
Expand Down Expand Up @@ -167,8 +167,8 @@ def add_newdoc_for_scalar_type(obj, fixed_aliases, doc):

add_newdoc_for_scalar_type('double', ['float_'],
"""
Double-precision floating-point number type, compatible with Python `float`
and C ``double``.
Double-precision floating-point number type, compatible with Python
:class:`float` and C ``double``.
""")

add_newdoc_for_scalar_type('longdouble', ['longfloat'],
Expand All @@ -186,7 +186,7 @@ def add_newdoc_for_scalar_type(obj, fixed_aliases, doc):
add_newdoc_for_scalar_type('cdouble', ['cfloat', 'complex_'],
"""
Complex number type composed of two double-precision floating-point
numbers, compatible with Python `complex`.
numbers, compatible with Python :class:`complex`.
""")

add_newdoc_for_scalar_type('clongdouble', ['clongfloat', 'longcomplex'],
Expand All @@ -210,8 +210,8 @@ def add_newdoc_for_scalar_type(obj, fixed_aliases, doc):
>>> s
'abc'

Unlike the builtin `str`, this supports the :ref:`python:bufferobjects`, exposing its
contents as UCS4:
Unlike the builtin :class:`str`, this supports the
:ref:`python:bufferobjects`, exposing its contents as UCS4:

>>> m = memoryview(np.str_("abc"))
>>> m.format
Expand Down
5 changes: 3 additions & 2 deletions numpy/core/_ufunc_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ def seterr(all=None, divide=None, over=None, under=None, invalid=None):
Set treatment for all types of floating-point errors at once:

- ignore: Take no action when the exception occurs.
- warn: Print a `RuntimeWarning` (via the Python `warnings` module).
- raise: Raise a `FloatingPointError`.
- warn: Print a :exc:`RuntimeWarning` (via the Python `warnings`
module).
- raise: Raise a :exc:`FloatingPointError`.
- call: Call a function specified using the `seterrcall` function.
- print: Print a warning directly to ``stdout``.
- log: Record error in a Log object specified by `seterrcall`.
Expand Down
Loading
Loading