| 1 |
import sys |
| 2 |
from _typeshed import BytesPath, StrOrBytesPath, StrPath |
| 3 |
from genericpath import ( |
| 4 |
ALLOW_MISSING as ALLOW_MISSING, |
| 5 |
_AllowMissingType, |
| 6 |
commonprefix as commonprefix, |
| 7 |
exists as exists, |
| 8 |
getatime as getatime, |
| 9 |
getctime as getctime, |
| 10 |
getmtime as getmtime, |
| 11 |
getsize as getsize, |
| 12 |
isdir as isdir, |
| 13 |
isfile as isfile, |
| 14 |
samefile as samefile, |
| 15 |
sameopenfile as sameopenfile, |
| 16 |
samestat as samestat, |
| 17 |
) |
| 18 |
from os import PathLike |
| 19 |
|
| 20 |
|
| 21 |
from posixpath import ( |
| 22 |
abspath as abspath, |
| 23 |
basename as basename, |
| 24 |
commonpath as commonpath, |
| 25 |
curdir as curdir, |
| 26 |
defpath as defpath, |
| 27 |
devnull as devnull, |
| 28 |
dirname as dirname, |
| 29 |
expanduser as expanduser, |
| 30 |
expandvars as expandvars, |
| 31 |
extsep as extsep, |
| 32 |
isabs as isabs, |
| 33 |
islink as islink, |
| 34 |
ismount as ismount, |
| 35 |
lexists as lexists, |
| 36 |
normcase as normcase, |
| 37 |
normpath as normpath, |
| 38 |
pardir as pardir, |
| 39 |
pathsep as pathsep, |
| 40 |
relpath as relpath, |
| 41 |
sep as sep, |
| 42 |
split as split, |
| 43 |
splitdrive as splitdrive, |
| 44 |
splitext as splitext, |
| 45 |
supports_unicode_filenames as supports_unicode_filenames, |
| 46 |
) |
| 47 |
from typing import AnyStr, overload |
| 48 |
from typing_extensions import LiteralString |
| 49 |
|
| 50 |
if sys.version_info >= (3, 12): |
| 51 |
from posixpath import isjunction as isjunction, splitroot as splitroot |
| 52 |
if sys.version_info >= (3, 13): |
| 53 |
from genericpath import isdevdrive as isdevdrive |
| 54 |
|
| 55 |
__all__ = [ |
| 56 |
"normcase", |
| 57 |
"isabs", |
| 58 |
"join", |
| 59 |
"splitdrive", |
| 60 |
"split", |
| 61 |
"splitext", |
| 62 |
"basename", |
| 63 |
"dirname", |
| 64 |
"commonprefix", |
| 65 |
"getsize", |
| 66 |
"getmtime", |
| 67 |
"getatime", |
| 68 |
"getctime", |
| 69 |
"islink", |
| 70 |
"exists", |
| 71 |
"lexists", |
| 72 |
"isdir", |
| 73 |
"isfile", |
| 74 |
"ismount", |
| 75 |
"expanduser", |
| 76 |
"expandvars", |
| 77 |
"normpath", |
| 78 |
"abspath", |
| 79 |
"curdir", |
| 80 |
"pardir", |
| 81 |
"sep", |
| 82 |
"pathsep", |
| 83 |
"defpath", |
| 84 |
"altsep", |
| 85 |
"extsep", |
| 86 |
"devnull", |
| 87 |
"realpath", |
| 88 |
"supports_unicode_filenames", |
| 89 |
"relpath", |
| 90 |
"samefile", |
| 91 |
"sameopenfile", |
| 92 |
"samestat", |
| 93 |
"commonpath", |
| 94 |
"ALLOW_MISSING", |
| 95 |
] |
| 96 |
if sys.version_info >= (3, 12): |
| 97 |
__all__ += ["isjunction", "splitroot"] |
| 98 |
if sys.version_info >= (3, 13): |
| 99 |
__all__ += ["isdevdrive", "isreserved"] |
| 100 |
|
| 101 |
altsep: LiteralString |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
@overload |
| 107 |
def join(path: LiteralString, /, *paths: LiteralString) -> LiteralString: ... |
| 108 |
@overload |
| 109 |
def join(path: StrPath, /, *paths: StrPath) -> str: ... |
| 110 |
@overload |
| 111 |
def join(path: BytesPath, /, *paths: BytesPath) -> bytes: ... |
| 112 |
|
| 113 |
if sys.platform == "win32": |
| 114 |
@overload |
| 115 |
def realpath(path: PathLike[AnyStr], *, strict: bool | _AllowMissingType = False) -> AnyStr: ... |
| 116 |
@overload |
| 117 |
def realpath(path: AnyStr, *, strict: bool | _AllowMissingType = False) -> AnyStr: ... |
| 118 |
|
| 119 |
else: |
| 120 |
realpath = abspath |
| 121 |
|
| 122 |
if sys.version_info >= (3, 13): |
| 123 |
def isreserved(path: StrOrBytesPath) -> bool: ... |