Skip to content

Commit

Permalink
pythongh-101100: Fix Sphinx reference warnings (pythonGH-112416)
Browse files Browse the repository at this point in the history
* Fix Sphinx warning in library/xml.rst

Direct use of the pyexpat module is deprecated, but this is how to check the version for security purposes

* Fix Sphinx warning in library/importlib.resources.rst

* Use italics for parameters

* Link to the exception

* Fix Sphinx warning in library/gzip.rst

* Document message and header defect base classes to fix Sphinx warning in library/email.headerregistry.rst

* Restore feed_eof() doc to fix Sphinx warning in library/asyncio-stream.rst

* Fix Sphinx warning in extending/newtypes.rst

* Fix Sphinx warning in c-api/set.rst

On stdtypes.rst, set and frozenset are documented together and the frozenset has the working refs
  • Loading branch information
hugovk authored Nov 25, 2023
1 parent 97f8f28 commit 3faf8e5
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Doc/c-api/set.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
Return ``1`` if found and removed, ``0`` if not found (no action taken), and ``-1`` if an
error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard`
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~frozenset.discard`
method, this function does not automatically convert unhashable sets into
temporary frozensets. Raise :exc:`SystemError` if *set* is not an
instance of :class:`set` or its subtype.
Expand Down
2 changes: 1 addition & 1 deletion Doc/extending/newtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` table
descriptors that are used at runtime is that any attribute defined this way can
have an associated doc string simply by providing the text in the table. An
application can use the introspection API to retrieve the descriptor from the
class object, and get the doc string using its :attr:`__doc__` attribute.
class object, and get the doc string using its :attr:`!__doc__` attribute.

As with the :c:member:`~PyTypeObject.tp_methods` table, a sentinel entry with a :c:member:`~PyMethodDef.ml_name` value
of ``NULL`` is required.
Expand Down
4 changes: 4 additions & 0 deletions Doc/library/asyncio-stream.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ StreamReader
directly; use :func:`open_connection` and :func:`start_server`
instead.

.. method:: feed_eof()

Acknowledge the EOF.

.. coroutinemethod:: read(n=-1)

Read up to *n* bytes from the stream.
Expand Down
9 changes: 9 additions & 0 deletions Doc/library/email.errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ The following exception classes are defined in the :mod:`email.errors` module:
:class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g.
:class:`~email.mime.image.MIMEImage`).

.. exception:: MessageDefect()

This is the base class for all defects found when parsing email messages.
It is derived from :exc:`ValueError`.

.. exception:: HeaderDefect()

This is the base class for all defects found when parsing email headers.
It is derived from :exc:`MessageDefect`.

Here is the list of the defects that the :class:`~email.parser.FeedParser`
can find while parsing messages. Note that the defects are added to the message
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/gzip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The module defines the following items:
should only be provided in compression mode. If omitted or ``None``, the
current time is used. See the :attr:`mtime` attribute for more details.

Calling a :class:`GzipFile` object's :meth:`close` method does not close
Calling a :class:`GzipFile` object's :meth:`!close` method does not close
*fileobj*, since you might wish to append more material after the compressed
data. This also allows you to pass an :class:`io.BytesIO` object opened for
writing as *fileobj*, and retrieve the resulting memory buffer using the
Expand Down
12 changes: 6 additions & 6 deletions Doc/library/importlib.resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ for example, a package and its resources can be imported from a zip file using
``get_resource_reader(fullname)`` method as specified by
:class:`importlib.resources.abc.ResourceReader`.

.. data:: Anchor
.. class:: Anchor

Represents an anchor for resources, either a :class:`module object
<types.ModuleType>` or a module name as a string. Defined as
Expand All @@ -63,7 +63,7 @@ for example, a package and its resources can be imported from a zip file using
(think files). A Traversable may contain other containers (think
subdirectories).

*anchor* is an optional :data:`Anchor`. If the anchor is a
*anchor* is an optional :class:`Anchor`. If the anchor is a
package, resources are resolved from that package. If a module,
resources are resolved adjacent to that module (in the same package
or the package root). If the anchor is omitted, the caller's module
Expand All @@ -72,10 +72,10 @@ for example, a package and its resources can be imported from a zip file using
.. versionadded:: 3.9

.. versionchanged:: 3.12
"package" parameter was renamed to "anchor". "anchor" can now
*package* parameter was renamed to *anchor*. *anchor* can now
be a non-package module and if omitted will default to the caller's
module. "package" is still accepted for compatibility but will raise
a DeprecationWarning. Consider passing the anchor positionally or
module. *package* is still accepted for compatibility but will raise
a :exc:`DeprecationWarning`. Consider passing the anchor positionally or
using ``importlib_resources >= 5.10`` for a compatible interface
on older Pythons.

Expand All @@ -96,4 +96,4 @@ for example, a package and its resources can be imported from a zip file using
.. versionadded:: 3.9

.. versionchanged:: 3.12
Added support for ``traversable`` representing a directory.
Added support for *traversable* representing a directory.
2 changes: 1 addition & 1 deletion Doc/library/xml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ decompression bomb Safe Safe Safe
1. Expat 2.4.1 and newer is not vulnerable to the "billion laughs" and
"quadratic blowup" vulnerabilities. Items still listed as vulnerable due to
potential reliance on system-provided libraries. Check
:const:`pyexpat.EXPAT_VERSION`.
:const:`!pyexpat.EXPAT_VERSION`.
2. :mod:`xml.etree.ElementTree` doesn't expand external entities and raises a
:exc:`~xml.etree.ElementTree.ParseError` when an entity occurs.
3. :mod:`xml.dom.minidom` doesn't expand external entities and simply returns
Expand Down
7 changes: 0 additions & 7 deletions Doc/tools/.nitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ Doc/c-api/memory.rst
Doc/c-api/memoryview.rst
Doc/c-api/module.rst
Doc/c-api/object.rst
Doc/c-api/set.rst
Doc/c-api/stable.rst
Doc/c-api/structures.rst
Doc/c-api/sys.rst
Doc/c-api/type.rst
Doc/c-api/typeobj.rst
Doc/extending/extending.rst
Doc/extending/newtypes.rst
Doc/glossary.rst
Doc/howto/descriptor.rst
Doc/howto/enum.rst
Expand All @@ -32,7 +30,6 @@ Doc/library/abc.rst
Doc/library/ast.rst
Doc/library/asyncio-extending.rst
Doc/library/asyncio-policy.rst
Doc/library/asyncio-stream.rst
Doc/library/asyncio-subprocess.rst
Doc/library/asyncio-task.rst
Doc/library/bdb.rst
Expand All @@ -51,7 +48,6 @@ Doc/library/decimal.rst
Doc/library/email.charset.rst
Doc/library/email.compat32-message.rst
Doc/library/email.errors.rst
Doc/library/email.headerregistry.rst
Doc/library/email.mime.rst
Doc/library/email.parser.rst
Doc/library/email.policy.rst
Expand All @@ -63,12 +59,10 @@ Doc/library/ftplib.rst
Doc/library/functions.rst
Doc/library/functools.rst
Doc/library/gettext.rst
Doc/library/gzip.rst
Doc/library/http.client.rst
Doc/library/http.cookiejar.rst
Doc/library/http.cookies.rst
Doc/library/http.server.rst
Doc/library/importlib.resources.rst
Doc/library/importlib.rst
Doc/library/inspect.rst
Doc/library/locale.rst
Expand Down Expand Up @@ -122,7 +116,6 @@ Doc/library/wsgiref.rst
Doc/library/xml.dom.minidom.rst
Doc/library/xml.dom.pulldom.rst
Doc/library/xml.dom.rst
Doc/library/xml.rst
Doc/library/xml.sax.handler.rst
Doc/library/xml.sax.reader.rst
Doc/library/xml.sax.rst
Expand Down

0 comments on commit 3faf8e5

Please sign in to comment.