| 1 |
import sys |
| 2 |
from _typeshed import AnyOrLiteralStr, BytesPath, FileDescriptorOrPath, StrOrBytesPath, StrPath |
| 3 |
from collections.abc import Iterable |
| 4 |
from genericpath import ( |
| 5 |
ALLOW_MISSING as ALLOW_MISSING, |
| 6 |
_AllowMissingType, |
| 7 |
commonprefix as commonprefix, |
| 8 |
exists as exists, |
| 9 |
getatime as getatime, |
| 10 |
getctime as getctime, |
| 11 |
getmtime as getmtime, |
| 12 |
getsize as getsize, |
| 13 |
isdir as isdir, |
| 14 |
isfile as isfile, |
| 15 |
samefile as samefile, |
| 16 |
sameopenfile as sameopenfile, |
| 17 |
samestat as samestat, |
| 18 |
) |
| 19 |
|
| 20 |
if sys.version_info >= (3, 13): |
| 21 |
from genericpath import isdevdrive as isdevdrive |
| 22 |
from os import PathLike |
| 23 |
from typing import AnyStr, overload |
| 24 |
from typing_extensions import LiteralString |
| 25 |
|
| 26 |
__all__ = [ |
| 27 |
"normcase", |
| 28 |
"isabs", |
| 29 |
"join", |
| 30 |
"splitdrive", |
| 31 |
"split", |
| 32 |
"splitext", |
| 33 |
"basename", |
| 34 |
"dirname", |
| 35 |
"commonprefix", |
| 36 |
"getsize", |
| 37 |
"getmtime", |
| 38 |
"getatime", |
| 39 |
"getctime", |
| 40 |
"islink", |
| 41 |
"exists", |
| 42 |
"lexists", |
| 43 |
"isdir", |
| 44 |
"isfile", |
| 45 |
"ismount", |
| 46 |
"expanduser", |
| 47 |
"expandvars", |
| 48 |
"normpath", |
| 49 |
"abspath", |
| 50 |
"samefile", |
| 51 |
"sameopenfile", |
| 52 |
"samestat", |
| 53 |
"curdir", |
| 54 |
"pardir", |
| 55 |
"sep", |
| 56 |
"pathsep", |
| 57 |
"defpath", |
| 58 |
"altsep", |
| 59 |
"extsep", |
| 60 |
"devnull", |
| 61 |
"realpath", |
| 62 |
"supports_unicode_filenames", |
| 63 |
"relpath", |
| 64 |
"commonpath", |
| 65 |
] |
| 66 |
__all__ += ["ALLOW_MISSING"] |
| 67 |
if sys.version_info >= (3, 12): |
| 68 |
__all__ += ["isjunction", "splitroot"] |
| 69 |
if sys.version_info >= (3, 13): |
| 70 |
__all__ += ["isdevdrive"] |
| 71 |
|
| 72 |
supports_unicode_filenames: bool |
| 73 |
|
| 74 |
curdir: LiteralString |
| 75 |
pardir: LiteralString |
| 76 |
sep: LiteralString |
| 77 |
altsep: LiteralString | None |
| 78 |
extsep: LiteralString |
| 79 |
pathsep: LiteralString |
| 80 |
defpath: LiteralString |
| 81 |
devnull: LiteralString |
| 82 |
|
| 83 |
|
| 84 |
@overload |
| 85 |
def abspath(path: PathLike[AnyStr]) -> AnyStr: ... |
| 86 |
@overload |
| 87 |
def abspath(path: AnyStr) -> AnyStr: ... |
| 88 |
@overload |
| 89 |
def basename(p: PathLike[AnyStr]) -> AnyStr: ... |
| 90 |
@overload |
| 91 |
def basename(p: AnyOrLiteralStr) -> AnyOrLiteralStr: ... |
| 92 |
@overload |
| 93 |
def dirname(p: PathLike[AnyStr]) -> AnyStr: ... |
| 94 |
@overload |
| 95 |
def dirname(p: AnyOrLiteralStr) -> AnyOrLiteralStr: ... |
| 96 |
@overload |
| 97 |
def expanduser(path: PathLike[AnyStr]) -> AnyStr: ... |
| 98 |
@overload |
| 99 |
def expanduser(path: AnyStr) -> AnyStr: ... |
| 100 |
@overload |
| 101 |
def expandvars(path: PathLike[AnyStr]) -> AnyStr: ... |
| 102 |
@overload |
| 103 |
def expandvars(path: AnyStr) -> AnyStr: ... |
| 104 |
@overload |
| 105 |
def normcase(s: PathLike[AnyStr]) -> AnyStr: ... |
| 106 |
@overload |
| 107 |
def normcase(s: AnyOrLiteralStr) -> AnyOrLiteralStr: ... |
| 108 |
@overload |
| 109 |
def normpath(path: PathLike[AnyStr]) -> AnyStr: ... |
| 110 |
@overload |
| 111 |
def normpath(path: AnyOrLiteralStr) -> AnyOrLiteralStr: ... |
| 112 |
@overload |
| 113 |
def commonpath(paths: Iterable[LiteralString]) -> LiteralString: ... |
| 114 |
@overload |
| 115 |
def commonpath(paths: Iterable[StrPath]) -> str: ... |
| 116 |
@overload |
| 117 |
def commonpath(paths: Iterable[BytesPath]) -> bytes: ... |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
@overload |
| 123 |
def join(a: LiteralString, /, *paths: LiteralString) -> LiteralString: ... |
| 124 |
@overload |
| 125 |
def join(a: StrPath, /, *paths: StrPath) -> str: ... |
| 126 |
@overload |
| 127 |
def join(a: BytesPath, /, *paths: BytesPath) -> bytes: ... |
| 128 |
@overload |
| 129 |
def realpath(filename: PathLike[AnyStr], *, strict: bool | _AllowMissingType = False) -> AnyStr: ... |
| 130 |
@overload |
| 131 |
def realpath(filename: AnyStr, *, strict: bool | _AllowMissingType = False) -> AnyStr: ... |
| 132 |
@overload |
| 133 |
def relpath(path: LiteralString, start: LiteralString | None = None) -> LiteralString: ... |
| 134 |
@overload |
| 135 |
def relpath(path: BytesPath, start: BytesPath | None = None) -> bytes: ... |
| 136 |
@overload |
| 137 |
def relpath(path: StrPath, start: StrPath | None = None) -> str: ... |
| 138 |
@overload |
| 139 |
def split(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ... |
| 140 |
@overload |
| 141 |
def split(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr]: ... |
| 142 |
@overload |
| 143 |
def splitdrive(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ... |
| 144 |
@overload |
| 145 |
def splitdrive(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr]: ... |
| 146 |
@overload |
| 147 |
def splitext(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr]: ... |
| 148 |
@overload |
| 149 |
def splitext(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr]: ... |
| 150 |
def isabs(s: StrOrBytesPath) -> bool: ... |
| 151 |
def islink(path: FileDescriptorOrPath) -> bool: ... |
| 152 |
def ismount(path: FileDescriptorOrPath) -> bool: ... |
| 153 |
def lexists(path: FileDescriptorOrPath) -> bool: ... |
| 154 |
|
| 155 |
if sys.version_info >= (3, 12): |
| 156 |
def isjunction(path: StrOrBytesPath) -> bool: ... |
| 157 |
@overload |
| 158 |
def splitroot(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ... |
| 159 |
@overload |
| 160 |
def splitroot(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr, AnyStr]: ... |