Debian Codegraph @

jedi/third_party/typeshed/stdlib/genericpath.pyi

raw symbols SCIP
1 import os
2 import sys
3 from _typeshed import BytesPath, FileDescriptorOrPath, StrOrBytesPath, StrPath, SupportsRichComparisonT
4 from collections.abc import Sequence
5 from typing import Literal, NewType, overload
6 from typing_extensions import LiteralString
7
8 __all__ = [
9 "commonprefix",
10 "exists",
11 "getatime",
12 "getctime",
13 "getmtime",
14 "getsize",
15 "isdir",
16 "isfile",
17 "samefile",
18 "sameopenfile",
19 "samestat",
20 "ALLOW_MISSING",
21 ]
22 if sys.version_info >= (3, 12):
23 __all__ += ["islink"]
24 if sys.version_info >= (3, 13):
25 __all__ += ["isjunction", "isdevdrive", "lexists"]
26
27 # All overloads can return empty string. Ideally, Literal[""] would be a valid
28 # Iterable[T], so that list[T] | Literal[""] could be used as a return
29 # type. But because this only works when T is str, we need Sequence[T] instead.
30 @overload
31 def commonprefix(m: Sequence[LiteralString]) -> LiteralString: ...
32 @overload
33 def commonprefix(m: Sequence[StrPath]) -> str: ...
34 @overload
35 def commonprefix(m: Sequence[BytesPath]) -> bytes | Literal[""]: ...
36 @overload
37 def commonprefix(m: Sequence[list[SupportsRichComparisonT]]) -> Sequence[SupportsRichComparisonT]: ...
38 @overload
39 def commonprefix(m: Sequence[tuple[SupportsRichComparisonT, ...]]) -> Sequence[SupportsRichComparisonT]: ...
40 def exists(path: FileDescriptorOrPath) -> bool: ...
41 def getsize(filename: FileDescriptorOrPath) -> int: ...
42 def isfile(path: FileDescriptorOrPath) -> bool: ...
43 def isdir(s: FileDescriptorOrPath) -> bool: ...
44
45 if sys.version_info >= (3, 12):
46 def islink(path: StrOrBytesPath) -> bool: ...
47
48 # These return float if os.stat_float_times() == True,
49 # but int is a subclass of float.
50 def getatime(filename: FileDescriptorOrPath) -> float: ...
51 def getmtime(filename: FileDescriptorOrPath) -> float: ...
52 def getctime(filename: FileDescriptorOrPath) -> float: ...
53 def samefile(f1: FileDescriptorOrPath, f2: FileDescriptorOrPath) -> bool: ...
54 def sameopenfile(fp1: int, fp2: int) -> bool: ...
55 def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
56
57 if sys.version_info >= (3, 13):
58 def isjunction(path: StrOrBytesPath) -> bool: ...
59 def isdevdrive(path: StrOrBytesPath) -> bool: ...
60 def lexists(path: StrOrBytesPath) -> bool: ...
61
62 # Added in Python 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.4
63 _AllowMissingType = NewType("_AllowMissingType", object)
64 ALLOW_MISSING: _AllowMissingType