mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-31972: Improve docstrings for pathlib classes (#5310)
This commit is contained in:
parent
08a6926b25
commit
dfa015cf77
2 changed files with 30 additions and 1 deletions
|
@ -584,7 +584,9 @@ class _PathParents(Sequence):
|
||||||
|
|
||||||
|
|
||||||
class PurePath(object):
|
class PurePath(object):
|
||||||
"""PurePath represents a filesystem path and offers operations which
|
"""Base class for manipulating paths without I/O.
|
||||||
|
|
||||||
|
PurePath represents a filesystem path and offers operations which
|
||||||
don't imply any actual filesystem I/O. Depending on your system,
|
don't imply any actual filesystem I/O. Depending on your system,
|
||||||
instantiating a PurePath will return either a PurePosixPath or a
|
instantiating a PurePath will return either a PurePosixPath or a
|
||||||
PureWindowsPath object. You can also instantiate either of these classes
|
PureWindowsPath object. You can also instantiate either of these classes
|
||||||
|
@ -939,11 +941,21 @@ os.PathLike.register(PurePath)
|
||||||
|
|
||||||
|
|
||||||
class PurePosixPath(PurePath):
|
class PurePosixPath(PurePath):
|
||||||
|
"""PurePath subclass for non-Windows systems.
|
||||||
|
|
||||||
|
On a POSIX system, instantiating a PurePath should return this object.
|
||||||
|
However, you can also instantiate it directly on any system.
|
||||||
|
"""
|
||||||
_flavour = _posix_flavour
|
_flavour = _posix_flavour
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
|
|
||||||
class PureWindowsPath(PurePath):
|
class PureWindowsPath(PurePath):
|
||||||
|
"""PurePath subclass for Windows systems.
|
||||||
|
|
||||||
|
On a Windows system, instantiating a PurePath should return this object.
|
||||||
|
However, you can also instantiate it directly on any system.
|
||||||
|
"""
|
||||||
_flavour = _windows_flavour
|
_flavour = _windows_flavour
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
|
@ -952,6 +964,14 @@ class PureWindowsPath(PurePath):
|
||||||
|
|
||||||
|
|
||||||
class Path(PurePath):
|
class Path(PurePath):
|
||||||
|
"""PurePath subclass that can make system calls.
|
||||||
|
|
||||||
|
Path represents a filesystem path but unlike PurePath, also offers
|
||||||
|
methods to do system calls on path objects. Depending on your system,
|
||||||
|
instantiating a Path will return either a PosixPath or a WindowsPath
|
||||||
|
object. You can also instantiate a PosixPath or WindowsPath directly,
|
||||||
|
but cannot instantiate a WindowsPath on a POSIX system or vice versa.
|
||||||
|
"""
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
'_accessor',
|
'_accessor',
|
||||||
'_closed',
|
'_closed',
|
||||||
|
@ -1427,9 +1447,17 @@ class Path(PurePath):
|
||||||
|
|
||||||
|
|
||||||
class PosixPath(Path, PurePosixPath):
|
class PosixPath(Path, PurePosixPath):
|
||||||
|
"""Path subclass for non-Windows systems.
|
||||||
|
|
||||||
|
On a POSIX system, instantiating a Path should return this object.
|
||||||
|
"""
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
class WindowsPath(Path, PureWindowsPath):
|
class WindowsPath(Path, PureWindowsPath):
|
||||||
|
"""Path subclass for Windows systems.
|
||||||
|
|
||||||
|
On a Windows system, instantiating a Path should return this object.
|
||||||
|
"""
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
def owner(self):
|
def owner(self):
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Improve docstrings for `pathlib.PurePath` subclasses.
|
Loading…
Add table
Add a link
Reference in a new issue