Skip to content

Commit

Permalink
Merge branch 'main' into pathlib_abc
Browse files Browse the repository at this point in the history
  • Loading branch information
barneygale committed Jan 6, 2024
2 parents affd6e1 + 3375dfe commit b596839
Show file tree
Hide file tree
Showing 61 changed files with 2,634 additions and 2,317 deletions.
6 changes: 3 additions & 3 deletions Doc/library/doctest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ searched. Objects imported into the module are not searched.
In addition, there are cases when you want tests to be part of a module but not part
of the help text, which requires that the tests not be included in the docstring.
Doctest looks for a module-level variable called ``__test__`` and uses it to locate other
tests. If ``M.__test__`` exists and is truthy, it must be a dict, and each
tests. If ``M.__test__`` exists, it must be a dict, and each
entry maps a (string) name to a function object, class object, or string.
Function and class object docstrings found from ``M.__test__`` are searched, and
strings are treated as if they were docstrings. In output, a key ``K`` in
Expand Down Expand Up @@ -944,8 +944,8 @@ and :ref:`doctest-simple-testfile`.
(or module :mod:`__main__` if *m* is not supplied or is ``None``), starting with
``m.__doc__``.

Also test examples reachable from dict ``m.__test__``, if it exists and is not
``None``. ``m.__test__`` maps names (strings) to functions, classes and
Also test examples reachable from dict ``m.__test__``, if it exists.
``m.__test__`` maps names (strings) to functions, classes and
strings; function and class docstrings are searched for examples; strings are
searched directly, as if they were docstrings.

Expand Down
103 changes: 56 additions & 47 deletions Doc/library/pyclbr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,106 +58,115 @@ of these classes.

Function Objects
----------------
Class :class:`Function` instances describe functions defined by def
statements. They have the following attributes:

.. class:: Function

.. attribute:: Function.file
Class :class:`!Function` instances describe functions defined by def
statements. They have the following attributes:

Name of the file in which the function is defined.

.. attribute:: file

.. attribute:: Function.module
Name of the file in which the function is defined.

The name of the module defining the function described.

.. attribute:: module

.. attribute:: Function.name
The name of the module defining the function described.

The name of the function.

.. attribute:: name

.. attribute:: Function.lineno
The name of the function.

The line number in the file where the definition starts.

.. attribute:: lineno

.. attribute:: Function.parent
The line number in the file where the definition starts.

For top-level functions, None. For nested functions, the parent.

.. versionadded:: 3.7
.. attribute:: parent

For top-level functions, ``None``. For nested functions, the parent.

.. attribute:: Function.children
.. versionadded:: 3.7

A dictionary mapping names to descriptors for nested functions and
classes.

.. versionadded:: 3.7
.. attribute:: children

A :class:`dictionary <dict>` mapping names to descriptors for nested functions and
classes.

.. attribute:: Function.is_async
.. versionadded:: 3.7

``True`` for functions that are defined with the ``async`` prefix, ``False`` otherwise.

.. versionadded:: 3.10
.. attribute:: is_async

``True`` for functions that are defined with the
:keyword:`async <async def>` prefix, ``False`` otherwise.

.. versionadded:: 3.10


.. _pyclbr-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
classes.
A dictionary mapping names to descriptors for nested functions and
classes.

.. versionadded:: 3.7
.. versionadded:: 3.7


.. attribute:: Class.super
.. attribute:: super

A list of :class:`Class` objects which describe the immediate base
classes of the class being described. Classes which are named as
superclasses but which are not discoverable by :func:`readmodule_ex`
are listed as a string with the class name instead of as
:class:`Class` objects.
A list of :class:`!Class` objects which describe the immediate base
classes of the class being described. Classes which are named as
superclasses but which are not discoverable by :func:`readmodule_ex`
are listed as a string with the class name instead of as
:class:`!Class` objects.


.. attribute:: Class.methods
.. attribute:: methods

A dictionary mapping method names to line numbers. This can be
derived from the newer children dictionary, but remains for
back-compatibility.
A :class:`dictionary <dict>` mapping method names to line numbers.
This can be derived from the newer :attr:`children` dictionary,
but remains for
back-compatibility.
4 changes: 2 additions & 2 deletions Doc/library/subprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1461,8 +1461,8 @@ Return code handling translates as follows::
print("There were some errors")


Replacing functions from the :mod:`popen2` module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Replacing functions from the :mod:`!popen2` module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. note::

Expand Down
1 change: 0 additions & 1 deletion Doc/tools/.nitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ Doc/library/pickletools.rst
Doc/library/platform.rst
Doc/library/plistlib.rst
Doc/library/profile.rst
Doc/library/pyclbr.rst
Doc/library/pydoc.rst
Doc/library/pyexpat.rst
Doc/library/readline.rst
Expand Down
8 changes: 4 additions & 4 deletions Doc/whatsnew/2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1095,8 +1095,8 @@ module.
GNU gettext message catalog library. (Integrated by Barry Warsaw, from separate
contributions by Martin von Löwis, Peter Funk, and James Henstridge.)

* :mod:`linuxaudiodev`: Support for the :file:`/dev/audio` device on Linux, a
twin to the existing :mod:`sunaudiodev` module. (Contributed by Peter Bosch,
* :mod:`!linuxaudiodev`: Support for the :file:`/dev/audio` device on Linux, a
twin to the existing :mod:`!sunaudiodev` module. (Contributed by Peter Bosch,
with fixes by Jeremy Hylton.)

* :mod:`mmap`: An interface to memory-mapped files on both Windows and Unix. A
Expand Down Expand Up @@ -1139,8 +1139,8 @@ module.
Unix, not to be confused with :program:`gzip`\ -format files (which are
supported by the :mod:`gzip` module) (Contributed by James C. Ahlstrom.)

* :mod:`imputil`: A module that provides a simpler way for writing customized
import hooks, in comparison to the existing :mod:`ihooks` module. (Implemented
* :mod:`!imputil`: A module that provides a simpler way for writing customized
import hooks, in comparison to the existing :mod:`!ihooks` module. (Implemented
by Greg Stein, with much discussion on python-dev along the way.)

.. ======================================================================
Expand Down
4 changes: 2 additions & 2 deletions Doc/whatsnew/2.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ To make the set of types complete, new type objects such as :func:`dict` and
return fcntl.lockf(self.fileno(), operation,
length, start, whence)

The now-obsolete :mod:`posixfile` module contained a class that emulated all of
a file object's methods and also added a :meth:`lock` method, but this class
The now-obsolete :mod:`!posixfile` module contained a class that emulated all of
a file object's methods and also added a :meth:`!lock` method, but this class
couldn't be passed to internal functions that expected a built-in file,
something which is possible with our new :class:`LockableFile`.

Expand Down
8 changes: 4 additions & 4 deletions Doc/whatsnew/2.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,13 @@ The standard library provides a number of ways to execute a subprocess, offering
different features and different levels of complexity.
``os.system(command)`` is easy to use, but slow (it runs a shell process
which executes the command) and dangerous (you have to be careful about escaping
the shell's metacharacters). The :mod:`popen2` module offers classes that can
the shell's metacharacters). The :mod:`!popen2` module offers classes that can
capture standard output and standard error from the subprocess, but the naming
is confusing. The :mod:`subprocess` module cleans this up, providing a unified
interface that offers all the features you might need.

Instead of :mod:`popen2`'s collection of classes, :mod:`subprocess` contains a
single class called :class:`Popen` whose constructor supports a number of
Instead of :mod:`!popen2`'s collection of classes, :mod:`subprocess` contains a
single class called :class:`subprocess.Popen` whose constructor supports a number of
different keyword arguments. ::

class Popen(args, bufsize=0, executable=None,
Expand Down Expand Up @@ -1529,7 +1529,7 @@ code:
will now always be unequal, and relative comparisons (``<``, ``>``) will raise
a :exc:`TypeError`.

* :func:`dircache.listdir` now passes exceptions to the caller instead of
* :func:`!dircache.listdir` now passes exceptions to the caller instead of
returning empty lists.

* :func:`LexicalHandler.startDTD` used to receive the public and system IDs in
Expand Down
6 changes: 3 additions & 3 deletions Doc/whatsnew/2.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,7 @@ The ctypes package

The :mod:`ctypes` package, written by Thomas Heller, has been added to the
standard library. :mod:`ctypes` lets you call arbitrary functions in shared
libraries or DLLs. Long-time users may remember the :mod:`dl` module, which
libraries or DLLs. Long-time users may remember the :mod:`!dl` module, which
provides functions for loading shared libraries and calling functions in them.
The :mod:`ctypes` package is much fancier.

Expand Down Expand Up @@ -1877,12 +1877,12 @@ The hashlib package
-------------------

A new :mod:`hashlib` module, written by Gregory P. Smith, has been added to
replace the :mod:`md5` and :mod:`sha` modules. :mod:`hashlib` adds support for
replace the :mod:`!md5` and :mod:`!sha` modules. :mod:`hashlib` adds support for
additional secure hashes (SHA-224, SHA-256, SHA-384, and SHA-512). When
available, the module uses OpenSSL for fast platform optimized implementations
of algorithms.

The old :mod:`md5` and :mod:`sha` modules still exist as wrappers around hashlib
The old :mod:`!md5` and :mod:`!sha` modules still exist as wrappers around hashlib
to preserve backwards compatibility. The new module's interface is very close
to that of the old modules, but not identical. The most significant difference
is that the constructor functions for creating new hashing objects are named
Expand Down
70 changes: 35 additions & 35 deletions Doc/whatsnew/2.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2916,60 +2916,60 @@ Deprecations and Removals

* Changes to the :class:`Exception` interface
as dictated by :pep:`352` continue to be made. For 2.6,
the :attr:`message` attribute is being deprecated in favor of the
:attr:`args` attribute.
the :attr:`!message` attribute is being deprecated in favor of the
:attr:`~BaseException.args` attribute.

* (3.0-warning mode) Python 3.0 will feature a reorganized standard
library that will drop many outdated modules and rename others.
Python 2.6 running in 3.0-warning mode will warn about these modules
when they are imported.

The list of deprecated modules is:
:mod:`audiodev`,
:mod:`bgenlocations`,
:mod:`buildtools`,
:mod:`bundlebuilder`,
:mod:`Canvas`,
:mod:`compiler`,
:mod:`dircache`,
:mod:`dl`,
:mod:`fpformat`,
:mod:`gensuitemodule`,
:mod:`ihooks`,
:mod:`imageop`,
:mod:`imgfile`,
:mod:`linuxaudiodev`,
:mod:`mhlib`,
:mod:`mimetools`,
:mod:`multifile`,
:mod:`new`,
:mod:`pure`,
:mod:`statvfs`,
:mod:`sunaudiodev`,
:mod:`test.testall`, and
:mod:`toaiff`.

* The :mod:`gopherlib` module has been removed.

* The :mod:`MimeWriter` module and :mod:`mimify` module
:mod:`!audiodev`,
:mod:`!bgenlocations`,
:mod:`!buildtools`,
:mod:`!bundlebuilder`,
:mod:`!Canvas`,
:mod:`!compiler`,
:mod:`!dircache`,
:mod:`!dl`,
:mod:`!fpformat`,
:mod:`!gensuitemodule`,
:mod:`!ihooks`,
:mod:`!imageop`,
:mod:`!imgfile`,
:mod:`!linuxaudiodev`,
:mod:`!mhlib`,
:mod:`!mimetools`,
:mod:`!multifile`,
:mod:`!new`,
:mod:`!pure`,
:mod:`!statvfs`,
:mod:`!sunaudiodev`,
:mod:`!test.testall`, and
:mod:`!toaiff`.

* The :mod:`!gopherlib` module has been removed.

* The :mod:`!MimeWriter` module and :mod:`!mimify` module
have been deprecated; use the :mod:`email`
package instead.

* The :mod:`md5` module has been deprecated; use the :mod:`hashlib` module
* The :mod:`!md5` module has been deprecated; use the :mod:`hashlib` module
instead.

* The :mod:`posixfile` module has been deprecated; :func:`fcntl.lockf`
* The :mod:`!posixfile` module has been deprecated; :func:`fcntl.lockf`
provides better locking.

* The :mod:`popen2` module has been deprecated; use the :mod:`subprocess`
* The :mod:`!popen2` module has been deprecated; use the :mod:`subprocess`
module.

* The :mod:`rgbimg` module has been removed.
* The :mod:`!rgbimg` module has been removed.

* The :mod:`sets` module has been deprecated; it's better to
* The :mod:`!sets` module has been deprecated; it's better to
use the built-in :class:`set` and :class:`frozenset` types.

* The :mod:`sha` module has been deprecated; use the :mod:`hashlib` module
* The :mod:`!sha` module has been deprecated; use the :mod:`hashlib` module
instead.


Expand Down
6 changes: 3 additions & 3 deletions Doc/whatsnew/2.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1315,9 +1315,9 @@ changes, or look through the Subversion logs for all the details.
giving the source address that will be used for the connection.
(Contributed by Eldon Ziegler; :issue:`3972`.)

* The :mod:`ihooks` module now supports relative imports. Note that
:mod:`ihooks` is an older module for customizing imports,
superseded by the :mod:`imputil` module added in Python 2.0.
* The :mod:`!ihooks` module now supports relative imports. Note that
:mod:`!ihooks` is an older module for customizing imports,
superseded by the :mod:`!imputil` module added in Python 2.0.
(Relative import support added by Neil Schemenauer.)

.. revision 75423
Expand Down
Loading

0 comments on commit b596839

Please sign in to comment.