Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,9 @@ def __repr__(self):


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,
instantiating a PurePath will return either a PurePosixPath or a
PureWindowsPath object. You can also instantiate either of these classes
Expand Down Expand Up @@ -955,11 +957,21 @@ def match(self, path_pattern):


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
__slots__ = ()


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
__slots__ = ()

Expand All @@ -968,6 +980,14 @@ class PureWindowsPath(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__ = (
'_accessor',
'_closed',
Expand Down Expand Up @@ -1422,9 +1442,17 @@ def expanduser(self):


class PosixPath(Path, PurePosixPath):
"""Path subclass for non-Windows systems.

On a POSIX system, instantiating a Path should return this object.
"""
__slots__ = ()

class WindowsPath(Path, PureWindowsPath):
"""Path subclass for Windows systems.

On a Windows system, instantiating a Path should return this object.
"""
__slots__ = ()

def owner(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve docstrings for `pathlib.PurePath` subclasses.