cpython
cpython copied to clipboard
GH-114575: Rename `PurePath.pathmod` to `PurePath.parser`
And rename the private base class from PathModuleBase to ParserBase.
No news or deprecation period needed as this attribute is new in 3.13.
- Downstream issue: https://github.com/barneygale/pathlib-abc/issues/19
- Issue: gh-114575
📚 Documentation preview 📚: https://cpython-previews--116513.org.readthedocs.build/
For ease of reference, here's the API:
class ParserBase:
"""Base class for path parsers, which do low-level path manipulation."""
@property
def sep(self) --> str:
"""The character used to separate path components."""
def join(self, path: str, *paths: str) -> str:
"""Join path segments."""
def split(self, path: str) -> tuple[str, str]:
"""Split the path into a pair (head, tail), where *head* is everything
before the final path separator, and *tail* is everything after.
Either part may be empty.
"""
def splitdrive(self, path: str) -> tuple[str, str]:
"""Split the path into a 2-item tuple (drive, tail), where *drive* is
a device name or mount point, and *tail* is everything after the
drive. Either part may be empty."""
def normcase(self, path: str) -> str:
"""Normalize the case of the path."""
def isabs(self, path: str) -> bool:
"""Returns whether the path is absolute, i.e. unaffected by the
current directory or drive."""
We may add splitext() at some point.