path.pyi 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. from typing import Any, AnyStr, Callable, ContextManager, Generic, IO, Iterable, Iterator, List, Optional, Text, Type, Union
  2. from typing_extensions import Final, Literal
  3. import os
  4. import sys
  5. class _FNMatcher(Generic[AnyStr]):
  6. pattern: AnyStr = ...
  7. def __init__(self, pattern: AnyStr) -> None: ...
  8. def __call__(self, path: local) -> bool: ...
  9. class _Stat:
  10. path: Final[local] = ...
  11. mode: Final[int]
  12. ino: Final[int]
  13. dev: Final[int]
  14. nlink: Final[int]
  15. uid: Final[int]
  16. gid: Final[int]
  17. size: Final[int]
  18. atime: Final[float]
  19. mtime: Final[float]
  20. ctime: Final[float]
  21. atime_ns: Final[int]
  22. mtime_ns: Final[int]
  23. ctime_ns: Final[int]
  24. if sys.version_info >= (3, 8) and sys.platform == "win32":
  25. reparse_tag: Final[int]
  26. blocks: Final[int]
  27. blksize: Final[int]
  28. rdev: Final[int]
  29. flags: Final[int]
  30. gen: Final[int]
  31. birthtime: Final[int]
  32. rsize: Final[int]
  33. creator: Final[int]
  34. type: Final[int]
  35. if sys.platform != 'win32':
  36. @property
  37. def owner(self) -> str: ...
  38. @property
  39. def group(self) -> str: ...
  40. def isdir(self) -> bool: ...
  41. def isfile(self) -> bool: ...
  42. def islink(self) -> bool: ...
  43. if sys.version_info >= (3, 6):
  44. _PathLike = os.PathLike
  45. else:
  46. class _PathLike(Generic[AnyStr]):
  47. def __fspath__(self) -> AnyStr: ...
  48. _PathType = Union[bytes, Text, _PathLike[str], _PathLike[bytes], local]
  49. class local(_PathLike[str]):
  50. class ImportMismatchError(ImportError): ...
  51. sep: Final[str]
  52. strpath: Final[str]
  53. def __init__(self, path: _PathType = ..., expanduser: bool = ...) -> None: ...
  54. def __hash__(self) -> int: ...
  55. def __eq__(self, other: object) -> bool: ...
  56. def __ne__(self, other: object) -> bool: ...
  57. def __lt__(self, other: object) -> bool: ...
  58. def __gt__(self, other: object) -> bool: ...
  59. def __add__(self, other: object) -> local: ...
  60. def __cmp__(self, other: object) -> int: ...
  61. def __div__(self, other: _PathType) -> local: ...
  62. def __truediv__(self, other: _PathType) -> local: ...
  63. def __fspath__(self) -> str: ...
  64. @classmethod
  65. def get_temproot(cls) -> local: ...
  66. @classmethod
  67. def make_numbered_dir(
  68. cls,
  69. prefix: str = ...,
  70. rootdir: Optional[local] = ...,
  71. keep: Optional[int] = ...,
  72. lock_timeout: int = ...,
  73. ) -> local: ...
  74. @classmethod
  75. def mkdtemp(cls, rootdir: Optional[local] = ...) -> local: ...
  76. @classmethod
  77. def sysfind(
  78. cls,
  79. name: _PathType,
  80. checker: Optional[Callable[[local], bool]] = ...,
  81. paths: Optional[Iterable[_PathType]] = ...,
  82. ) -> Optional[local]: ...
  83. @property
  84. def basename(self) -> str: ...
  85. @property
  86. def dirname(self) -> str: ...
  87. @property
  88. def purebasename(self) -> str: ...
  89. @property
  90. def ext(self) -> str: ...
  91. def as_cwd(self) -> ContextManager[Optional[local]]: ...
  92. def atime(self) -> float: ...
  93. def bestrelpath(self, dest: local) -> str: ...
  94. def chdir(self) -> local: ...
  95. def check(
  96. self,
  97. *,
  98. basename: int = ..., notbasename: int = ...,
  99. basestarts: int = ..., notbasestarts: int = ...,
  100. dir: int = ..., notdir: int = ...,
  101. dotfile: int = ..., notdotfile: int = ...,
  102. endswith: int = ..., notendswith: int = ...,
  103. exists: int = ..., notexists: int = ...,
  104. ext: int = ..., notext: int = ...,
  105. file: int = ..., notfile: int = ...,
  106. fnmatch: int = ..., notfnmatch: int = ...,
  107. link: int = ..., notlink: int = ...,
  108. relto: int = ..., notrelto: int = ...,
  109. ) -> bool: ...
  110. def chmod(self, mode: int, rec: Union[int, str, Text, Callable[[local], bool]] = ...) -> None: ...
  111. if sys.platform != 'win32':
  112. def chown(self, user: Union[int, str], group: Union[int, str], rec: int = ...) -> None: ...
  113. def common(self, other: local) -> Optional[local]: ...
  114. def computehash(self, hashtype: str = ..., chunksize: int = ...) -> str: ...
  115. def copy(self, target: local, mode: bool = ..., stat: bool = ...) -> None: ...
  116. def dirpath(self, *args: _PathType, abs: int = ...) -> local: ...
  117. def dump(self, obj: Any, bin: Optional[int] = ...) -> None: ...
  118. def ensure(self, *args: _PathType, dir: int = ...) -> local: ...
  119. def ensure_dir(self, *args: _PathType) -> local: ...
  120. def exists(self) -> bool: ...
  121. def fnmatch(self, pattern: str): _FNMatcher
  122. def isdir(self) -> bool: ...
  123. def isfile(self) -> bool: ...
  124. def islink(self) -> bool: ...
  125. def join(self, *args: _PathType, abs: int = ...) -> local: ...
  126. def listdir(
  127. self,
  128. fil: Optional[Union[str, Text, Callable[[local], bool]]] = ...,
  129. sort: Optional[bool] = ...,
  130. ) -> List[local]: ...
  131. def load(self) -> Any: ...
  132. def lstat(self) -> _Stat: ...
  133. def mkdir(self, *args: _PathType) -> local: ...
  134. if sys.platform != 'win32':
  135. def mklinkto(self, oldname: Union[str, local]) -> None: ...
  136. def mksymlinkto(self, value: local, absolute: int = ...) -> None: ...
  137. def move(self, target: local) -> None: ...
  138. def mtime(self) -> float: ...
  139. def new(
  140. self,
  141. *,
  142. drive: str = ...,
  143. dirname: str = ...,
  144. basename: str = ...,
  145. purebasename: str = ...,
  146. ext: str = ...,
  147. ) -> local: ...
  148. def open(self, mode: str = ..., ensure: bool = ..., encoding: Optional[str] = ...) -> IO[Any]: ...
  149. def parts(self, reverse: bool = ...) -> List[local]: ...
  150. def pyimport(
  151. self,
  152. modname: Optional[str] = ...,
  153. ensuresyspath: Union[bool, Literal["append", "importlib"]] = ...,
  154. ) -> Any: ...
  155. def pypkgpath(self) -> Optional[local]: ...
  156. def read(self, mode: str = ...) -> Union[Text, bytes]: ...
  157. def read_binary(self) -> bytes: ...
  158. def read_text(self, encoding: str) -> Text: ...
  159. def readlines(self, cr: int = ...) -> List[str]: ...
  160. if sys.platform != 'win32':
  161. def readlink(self) -> str: ...
  162. def realpath(self) -> local: ...
  163. def relto(self, relpath: Union[str, local]) -> str: ...
  164. def remove(self, rec: int = ..., ignore_errors: bool = ...) -> None: ...
  165. def rename(self, target: _PathType) -> None: ...
  166. def samefile(self, other: _PathType) -> bool: ...
  167. def setmtime(self, mtime: Optional[float] = ...) -> None: ...
  168. def size(self) -> int: ...
  169. def stat(self, raising: bool = ...) -> _Stat: ...
  170. def sysexec(self, *argv: Any, **popen_opts: Any) -> Text: ...
  171. def visit(
  172. self,
  173. fil: Optional[Union[str, Text, Callable[[local], bool]]] = ...,
  174. rec: Optional[Union[Literal[1, True], str, Text, Callable[[local], bool]]] = ...,
  175. ignore: Type[Exception] = ...,
  176. bf: bool = ...,
  177. sort: bool = ...,
  178. ) -> Iterator[local]: ...
  179. def write(self, data: Any, mode: str = ..., ensure: bool = ...) -> None: ...
  180. def write_binary(self, data: bytes, ensure: bool = ...) -> None: ...
  181. def write_text(self, data: Union[str, Text], encoding: str, ensure: bool = ...) -> None: ...
  182. # Untyped types below here.
  183. svnwc: Any
  184. svnurl: Any
  185. SvnAuth: Any