From cd9032b5af0b47d0685a26657c34d455b676218e Mon Sep 17 00:00:00 2001 From: Michael Anckaert Date: Wed, 14 Aug 2019 20:57:36 +0200 Subject: [PATCH 1/4] Updated documentation for inspect module: some module attributes were missing --- Doc/library/inspect.rst | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 700cd9122cd34c..5aa0726b628404 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -40,11 +40,27 @@ attributes: +-----------+-------------------+---------------------------+ | Type | Attribute | Description | +===========+===================+===========================+ -| module | __doc__ | documentation string | +| module | __cached__ | the path where a compiled | +| | | version is stored | ++-----------+-------------------+---------------------------+ +| | __doc__ | documentation string | +-----------+-------------------+---------------------------+ | | __file__ | filename (missing for | | | | built-in modules) | +-----------+-------------------+---------------------------+ +| | __loader__ | loader used to load the | +| | | module | ++-----------+-------------------+---------------------------+ +| | __name__ | name of the module | ++-----------+-------------------+---------------------------+ +| | __path__ | list of strings specifying| +| | | the search path within a | +| | | package (not set for | +| | | modules) | ++-----------+-------------------+---------------------------+ +| | __package__ | parent package for the | +| | | module/package | ++-----------+-------------------+---------------------------+ | class | __doc__ | documentation string | +-----------+-------------------+---------------------------+ | | __name__ | name with which this | From a93e8558d9cca84c62c4b5646e505dcd85dadf36 Mon Sep 17 00:00:00 2001 From: slateny <46876382+slateny@users.noreply.github.com> Date: Sat, 8 Oct 2022 20:51:25 -0700 Subject: [PATCH 2/4] Add box on __spec__ --- Doc/library/inspect.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 5aa0726b628404..063fb0b3fa40a0 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -61,6 +61,11 @@ attributes: | | __package__ | parent package for the | | | | module/package | +-----------+-------------------+---------------------------+ +| | __spec__ | specification for the | +| | | module's | +| | | import-system-related | +| | | state | ++-----------+-------------------+---------------------------+ | class | __doc__ | documentation string | +-----------+-------------------+---------------------------+ | | __name__ | name with which this | From 0bf5d335fb9867adf0bead27b3c3fb6d360a80ed Mon Sep 17 00:00:00 2001 From: slateny <46876382+slateny@users.noreply.github.com> Date: Wed, 12 Oct 2022 15:38:58 -0700 Subject: [PATCH 3/4] Add note about deprecation of module attributes --- Doc/library/inspect.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 063fb0b3fa40a0..ea6974c7246d9b 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -32,7 +32,8 @@ The :func:`getmembers` function retrieves the members of an object such as a class or module. The functions whose names begin with "is" are mainly provided as convenient choices for the second argument to :func:`getmembers`. They also help you determine when you can expect to find the following special -attributes: +attributes, but note that some module attributes are in the process of being +depreciated (see `this issue `_). .. this function name is too big to fit in the ascii-art table below .. |coroutine-origin-link| replace:: :func:`sys.set_coroutine_origin_tracking_depth` From 17b50b311a13ede71435ce25edd52ac4e717db7e Mon Sep 17 00:00:00 2001 From: slateny <46876382+slateny@users.noreply.github.com> Date: Wed, 19 Oct 2022 08:22:17 -0700 Subject: [PATCH 4/4] Remove module table, add link to reference --- Doc/library/inspect.rst | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index ea6974c7246d9b..7308a8e0a3bdb8 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -32,8 +32,7 @@ The :func:`getmembers` function retrieves the members of an object such as a class or module. The functions whose names begin with "is" are mainly provided as convenient choices for the second argument to :func:`getmembers`. They also help you determine when you can expect to find the following special -attributes, but note that some module attributes are in the process of being -depreciated (see `this issue `_). +attributes (see :ref:`import-mod-attrs` for module attributes): .. this function name is too big to fit in the ascii-art table below .. |coroutine-origin-link| replace:: :func:`sys.set_coroutine_origin_tracking_depth` @@ -41,32 +40,6 @@ depreciated (see `this issue `_) +-----------+-------------------+---------------------------+ | Type | Attribute | Description | +===========+===================+===========================+ -| module | __cached__ | the path where a compiled | -| | | version is stored | -+-----------+-------------------+---------------------------+ -| | __doc__ | documentation string | -+-----------+-------------------+---------------------------+ -| | __file__ | filename (missing for | -| | | built-in modules) | -+-----------+-------------------+---------------------------+ -| | __loader__ | loader used to load the | -| | | module | -+-----------+-------------------+---------------------------+ -| | __name__ | name of the module | -+-----------+-------------------+---------------------------+ -| | __path__ | list of strings specifying| -| | | the search path within a | -| | | package (not set for | -| | | modules) | -+-----------+-------------------+---------------------------+ -| | __package__ | parent package for the | -| | | module/package | -+-----------+-------------------+---------------------------+ -| | __spec__ | specification for the | -| | | module's | -| | | import-system-related | -| | | state | -+-----------+-------------------+---------------------------+ | class | __doc__ | documentation string | +-----------+-------------------+---------------------------+ | | __name__ | name with which this |