diff options
Diffstat (limited to 'Lib/pathlib/__init__.py')
-rw-r--r-- | Lib/pathlib/__init__.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/pathlib/__init__.py b/Lib/pathlib/__init__.py index 9d3fcd8..e70cfe9 100644 --- a/Lib/pathlib/__init__.py +++ b/Lib/pathlib/__init__.py @@ -257,7 +257,9 @@ class PurePath(_abc.PurePathBase): parsed = [sys.intern(str(x)) for x in rel.split(sep) if x and x != '.'] return drv, root, parsed - def _load_parts(self): + @property + def _raw_path(self): + """The joined but unnormalized path.""" paths = self._raw_paths if len(paths) == 0: path = '' @@ -265,7 +267,7 @@ class PurePath(_abc.PurePathBase): path = paths[0] else: path = self.pathmod.join(*paths) - self._drv, self._root, self._tail_cached = self._parse_path(path) + return path @property def drive(self): @@ -273,7 +275,7 @@ class PurePath(_abc.PurePathBase): try: return self._drv except AttributeError: - self._load_parts() + self._drv, self._root, self._tail_cached = self._parse_path(self._raw_path) return self._drv @property @@ -282,7 +284,7 @@ class PurePath(_abc.PurePathBase): try: return self._root except AttributeError: - self._load_parts() + self._drv, self._root, self._tail_cached = self._parse_path(self._raw_path) return self._root @property @@ -290,7 +292,7 @@ class PurePath(_abc.PurePathBase): try: return self._tail_cached except AttributeError: - self._load_parts() + self._drv, self._root, self._tail_cached = self._parse_path(self._raw_path) return self._tail_cached @property |