[3.12] gh-101100: Fix Sphinx warnings in library/pyclbr.rst (GH-113739) (#113748)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-01-05 20:36:31 +01:00 committed by GitHub
parent 99d8dfd430
commit 05a2546e85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 50 deletions

View file

@ -58,48 +58,52 @@ of these classes.
Function Objects Function Objects
---------------- ----------------
Class :class:`Function` instances describe functions defined by def
.. class:: Function
Class :class:`!Function` instances describe functions defined by def
statements. They have the following attributes: statements. They have the following attributes:
.. attribute:: Function.file .. attribute:: file
Name of the file in which the function is defined. Name of the file in which the function is defined.
.. attribute:: Function.module .. attribute:: module
The name of the module defining the function described. The name of the module defining the function described.
.. attribute:: Function.name .. attribute:: name
The name of the function. The name of the function.
.. attribute:: Function.lineno .. attribute:: lineno
The line number in the file where the definition starts. The line number in the file where the definition starts.
.. attribute:: Function.parent .. attribute:: parent
For top-level functions, None. For nested functions, the parent. For top-level functions, ``None``. For nested functions, the parent.
.. versionadded:: 3.7 .. versionadded:: 3.7
.. attribute:: Function.children .. attribute:: children
A dictionary mapping names to descriptors for nested functions and A :class:`dictionary <dict>` mapping names to descriptors for nested functions and
classes. classes.
.. versionadded:: 3.7 .. versionadded:: 3.7
.. attribute:: Function.is_async .. attribute:: is_async
``True`` for functions that are defined with the ``async`` prefix, ``False`` otherwise. ``True`` for functions that are defined with the
:keyword:`async <async def>` prefix, ``False`` otherwise.
.. versionadded:: 3.10 .. versionadded:: 3.10
@ -108,38 +112,42 @@ statements. They have the following attributes:
Class Objects Class Objects
------------- -------------
Class :class:`Class` instances describe classes defined by class
statements. They have the same attributes as Functions and two more. .. class:: Class
Class :class:`!Class` instances describe classes defined by class
statements. They have the same attributes as :class:`Functions <Function>`
and two more.
.. attribute:: Class.file .. attribute:: file
Name of the file in which the class is defined. Name of the file in which the class is defined.
.. attribute:: Class.module .. attribute:: module
The name of the module defining the class described. The name of the module defining the class described.
.. attribute:: Class.name .. attribute:: name
The name of the class. The name of the class.
.. attribute:: Class.lineno .. attribute:: lineno
The line number in the file where the definition starts. The line number in the file where the definition starts.
.. attribute:: Class.parent .. attribute:: parent
For top-level classes, None. For nested classes, the parent. For top-level classes, None. For nested classes, the parent.
.. versionadded:: 3.7 .. versionadded:: 3.7
.. attribute:: Class.children .. attribute:: children
A dictionary mapping names to descriptors for nested functions and A dictionary mapping names to descriptors for nested functions and
classes. classes.
@ -147,17 +155,18 @@ statements. They have the same attributes as Functions and two more.
.. versionadded:: 3.7 .. versionadded:: 3.7
.. attribute:: Class.super .. attribute:: super
A list of :class:`Class` objects which describe the immediate base A list of :class:`!Class` objects which describe the immediate base
classes of the class being described. Classes which are named as classes of the class being described. Classes which are named as
superclasses but which are not discoverable by :func:`readmodule_ex` superclasses but which are not discoverable by :func:`readmodule_ex`
are listed as a string with the class name instead of as are listed as a string with the class name instead of as
:class:`Class` objects. :class:`!Class` objects.
.. attribute:: Class.methods .. attribute:: methods
A dictionary mapping method names to line numbers. This can be A :class:`dictionary <dict>` mapping method names to line numbers.
derived from the newer children dictionary, but remains for This can be derived from the newer :attr:`children` dictionary,
but remains for
back-compatibility. back-compatibility.

View file

@ -78,7 +78,6 @@ Doc/library/pickletools.rst
Doc/library/platform.rst Doc/library/platform.rst
Doc/library/plistlib.rst Doc/library/plistlib.rst
Doc/library/profile.rst Doc/library/profile.rst
Doc/library/pyclbr.rst
Doc/library/pydoc.rst Doc/library/pydoc.rst
Doc/library/pyexpat.rst Doc/library/pyexpat.rst
Doc/library/readline.rst Doc/library/readline.rst

View file

@ -1316,8 +1316,8 @@ pyclbr
------ ------
Add an ``end_lineno`` attribute to the ``Function`` and ``Class`` Add an ``end_lineno`` attribute to the ``Function`` and ``Class``
objects in the tree returned by :func:`pyclbr.readline` and objects in the tree returned by :func:`pyclbr.readmodule` and
:func:`pyclbr.readline_ex`. It matches the existing (start) ``lineno``. :func:`pyclbr.readmodule_ex`. It matches the existing (start) ``lineno``.
(Contributed by Aviral Srivastava in :issue:`38307`.) (Contributed by Aviral Srivastava in :issue:`38307`.)
shelve shelve