summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib/_abc.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pathlib/_abc.py')
-rw-r--r--Lib/pathlib/_abc.py65
1 files changed, 0 insertions, 65 deletions
diff --git a/Lib/pathlib/_abc.py b/Lib/pathlib/_abc.py
index 4d5f798..e6ff3fe 100644
--- a/Lib/pathlib/_abc.py
+++ b/Lib/pathlib/_abc.py
@@ -205,21 +205,6 @@ class PurePathBase:
passing to system calls."""
raise NotImplementedError
- def as_posix(self):
- """Return the string representation of the path with forward (/)
- slashes."""
- return str(self).replace(self.parser.sep, '/')
-
- @property
- def drive(self):
- """The drive prefix (letter or UNC path), if any."""
- return self.parser.splitdrive(self.anchor)[0]
-
- @property
- def root(self):
- """The root of the path, if any."""
- return self.parser.splitdrive(self.anchor)[1]
-
@property
def anchor(self):
"""The concatenation of the drive and root, or ''."""
@@ -291,51 +276,6 @@ class PurePathBase:
else:
return self.with_name(stem + suffix)
- def relative_to(self, other, *, walk_up=False):
- """Return the relative path to another path identified by the passed
- arguments. If the operation is not possible (because this is not
- related to the other path), raise ValueError.
-
- The *walk_up* parameter controls whether `..` may be used to resolve
- the path.
- """
- if not isinstance(other, PurePathBase):
- other = self.with_segments(other)
- anchor0, parts0 = _explode_path(self)
- anchor1, parts1 = _explode_path(other)
- if anchor0 != anchor1:
- raise ValueError(f"{str(self)!r} and {str(other)!r} have different anchors")
- while parts0 and parts1 and parts0[-1] == parts1[-1]:
- parts0.pop()
- parts1.pop()
- for part in parts1:
- if not part or part == '.':
- pass
- elif not walk_up:
- raise ValueError(f"{str(self)!r} is not in the subpath of {str(other)!r}")
- elif part == '..':
- raise ValueError(f"'..' segment in {str(other)!r} cannot be walked")
- else:
- parts0.append('..')
- return self.with_segments(*reversed(parts0))
-
- def is_relative_to(self, other):
- """Return True if the path is relative to another path or False.
- """
- if not isinstance(other, PurePathBase):
- other = self.with_segments(other)
- anchor0, parts0 = _explode_path(self)
- anchor1, parts1 = _explode_path(other)
- if anchor0 != anchor1:
- return False
- while parts0 and parts1 and parts0[-1] == parts1[-1]:
- parts0.pop()
- parts1.pop()
- for part in parts1:
- if part and part != '.':
- return False
- return True
-
@property
def parts(self):
"""An object providing sequence-like access to the
@@ -387,11 +327,6 @@ class PurePathBase:
parent = split(path)[0]
return tuple(parents)
- def is_absolute(self):
- """True if the path is absolute (has both a root and, if applicable,
- a drive)."""
- return self.parser.isabs(str(self))
-
def match(self, path_pattern, *, case_sensitive=None):
"""
Return True if this path matches the given pattern. If the pattern is