Return an absolute version of this path No normalization or symlink resolution is performed. Use resolve() to resolve symlinks and remove '..' segments.
(self)
| 1090 | yield self._from_parsed_string(path_str), dirnames, filenames |
| 1091 | |
| 1092 | def absolute(self): |
| 1093 | """Return an absolute version of this path |
| 1094 | No normalization or symlink resolution is performed. |
| 1095 | |
| 1096 | Use resolve() to resolve symlinks and remove '..' segments. |
| 1097 | """ |
| 1098 | if self.is_absolute(): |
| 1099 | return self |
| 1100 | if self.root: |
| 1101 | drive = os.path.splitroot(os.getcwd())[0] |
| 1102 | return self._from_parsed_parts(drive, self.root, self._tail) |
| 1103 | if self.drive: |
| 1104 | # There is a CWD on each drive-letter drive. |
| 1105 | cwd = os.path.abspath(self.drive) |
| 1106 | else: |
| 1107 | cwd = os.getcwd() |
| 1108 | if not self._tail: |
| 1109 | # Fast path for "empty" paths, e.g. Path("."), Path("") or Path(). |
| 1110 | # We pass only one argument to with_segments() to avoid the cost |
| 1111 | # of joining, and we exploit the fact that getcwd() returns a |
| 1112 | # fully-normalized string by storing it in _str. This is used to |
| 1113 | # implement Path.cwd(). |
| 1114 | return self._from_parsed_string(cwd) |
| 1115 | drive, root, rel = os.path.splitroot(cwd) |
| 1116 | if not rel: |
| 1117 | return self._from_parsed_parts(drive, root, self._tail) |
| 1118 | tail = rel.split(self.parser.sep) |
| 1119 | tail.extend(self._tail) |
| 1120 | return self._from_parsed_parts(drive, root, tail) |
| 1121 | |
| 1122 | @classmethod |
| 1123 | def cwd(cls): |