[3.11] gh-86610: Use attribute directive in docs for pathlib.PurePath (GH-101114) (#101205)

(cherry picked from commit 01093b8203)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-01-20 14:28:21 -08:00 committed by GitHub
parent efc89f3454
commit db0eeb381e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -266,7 +266,7 @@ Accessing individual parts
To access the individual "parts" (components) of a path, use the following To access the individual "parts" (components) of a path, use the following
property: property:
.. data:: PurePath.parts .. attribute:: PurePath.parts
A tuple giving access to the path's various components:: A tuple giving access to the path's various components::
@ -290,7 +290,7 @@ Methods and properties
Pure paths provide the following methods and properties: Pure paths provide the following methods and properties:
.. data:: PurePath.drive .. attribute:: PurePath.drive
A string representing the drive letter or name, if any:: A string representing the drive letter or name, if any::
@ -306,7 +306,7 @@ Pure paths provide the following methods and properties:
>>> PureWindowsPath('//host/share/foo.txt').drive >>> PureWindowsPath('//host/share/foo.txt').drive
'\\\\host\\share' '\\\\host\\share'
.. data:: PurePath.root .. attribute:: PurePath.root
A string representing the (local or global) root, if any:: A string representing the (local or global) root, if any::
@ -342,7 +342,7 @@ Pure paths provide the following methods and properties:
an implementation-defined manner, although more than two leading slashes an implementation-defined manner, although more than two leading slashes
shall be treated as a single slash."* shall be treated as a single slash."*
.. data:: PurePath.anchor .. attribute:: PurePath.anchor
The concatenation of the drive and root:: The concatenation of the drive and root::
@ -356,7 +356,7 @@ Pure paths provide the following methods and properties:
'\\\\host\\share\\' '\\\\host\\share\\'
.. data:: PurePath.parents .. attribute:: PurePath.parents
An immutable sequence providing access to the logical ancestors of An immutable sequence providing access to the logical ancestors of
the path:: the path::
@ -372,7 +372,7 @@ Pure paths provide the following methods and properties:
.. versionchanged:: 3.10 .. versionchanged:: 3.10
The parents sequence now supports :term:`slices <slice>` and negative index values. The parents sequence now supports :term:`slices <slice>` and negative index values.
.. data:: PurePath.parent .. attribute:: PurePath.parent
The logical parent of the path:: The logical parent of the path::
@ -401,7 +401,7 @@ Pure paths provide the following methods and properties:
symlinks and eliminate ``".."`` components. symlinks and eliminate ``".."`` components.
.. data:: PurePath.name .. attribute:: PurePath.name
A string representing the final path component, excluding the drive and A string representing the final path component, excluding the drive and
root, if any:: root, if any::
@ -417,7 +417,7 @@ Pure paths provide the following methods and properties:
'' ''
.. data:: PurePath.suffix .. attribute:: PurePath.suffix
The file extension of the final component, if any:: The file extension of the final component, if any::
@ -429,7 +429,7 @@ Pure paths provide the following methods and properties:
'' ''
.. data:: PurePath.suffixes .. attribute:: PurePath.suffixes
A list of the path's file extensions:: A list of the path's file extensions::
@ -441,7 +441,7 @@ Pure paths provide the following methods and properties:
[] []
.. data:: PurePath.stem .. attribute:: PurePath.stem
The final path component, without its suffix:: The final path component, without its suffix::
@ -1323,11 +1323,11 @@ Below is a table mapping various :mod:`os` functions to their corresponding
:meth:`Path.group` :meth:`Path.group`
:func:`os.path.isabs` :meth:`PurePath.is_absolute` :func:`os.path.isabs` :meth:`PurePath.is_absolute`
:func:`os.path.join` :func:`PurePath.joinpath` :func:`os.path.join` :func:`PurePath.joinpath`
:func:`os.path.basename` :data:`PurePath.name` :func:`os.path.basename` :attr:`PurePath.name`
:func:`os.path.dirname` :data:`PurePath.parent` :func:`os.path.dirname` :attr:`PurePath.parent`
:func:`os.path.samefile` :meth:`Path.samefile` :func:`os.path.samefile` :meth:`Path.samefile`
:func:`os.path.splitext` :data:`PurePath.stem` and :func:`os.path.splitext` :attr:`PurePath.stem` and
:data:`PurePath.suffix` :attr:`PurePath.suffix`
==================================== ============================== ==================================== ==============================
.. rubric:: Footnotes .. rubric:: Footnotes