mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-09 19:21:26 +08:00
use _typeshed's Path aliases (#4214)
This commit is contained in:
@@ -1,19 +1,16 @@
|
||||
# Stubs for compileall (Python 2)
|
||||
|
||||
from typing import Any, Optional, Pattern, Union
|
||||
|
||||
_Path = Union[str, bytes]
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Optional, Pattern
|
||||
|
||||
# rx can be any object with a 'search' method; once we have Protocols we can change the type
|
||||
def compile_dir(
|
||||
dir: _Path,
|
||||
dir: AnyPath,
|
||||
maxlevels: int = ...,
|
||||
ddir: Optional[_Path] = ...,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
) -> int: ...
|
||||
def compile_file(
|
||||
fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...,
|
||||
fullname: AnyPath, ddir: Optional[AnyPath] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...,
|
||||
) -> int: ...
|
||||
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# Stubs for os
|
||||
# Ron Murawski <ron@horizonchess.com>
|
||||
|
||||
from builtins import OSError as error
|
||||
from io import TextIOWrapper as _TextIOWrapper
|
||||
from posix import listdir as listdir, stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
|
||||
@@ -9,9 +6,13 @@ from typing import (
|
||||
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr,
|
||||
Optional, Generic, Set, Callable, Text, Sequence, IO, NamedTuple, NoReturn, TypeVar
|
||||
)
|
||||
from _typeshed import AnyPath
|
||||
from . import path as path
|
||||
|
||||
_T = TypeVar('_T')
|
||||
# We need to use something from path, or flake8 and pytype get unhappy
|
||||
_supports_unicode_filenames = path.supports_unicode_filenames
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
# ----- os variables -----
|
||||
|
||||
@@ -134,8 +135,6 @@ TMP_MAX: int # Undocumented, but used by tempfile
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike as PathLike # See comment in builtins
|
||||
|
||||
_PathType = path._PathType
|
||||
|
||||
class _StatVFS(NamedTuple):
|
||||
f_bsize: int
|
||||
f_frsize: int
|
||||
@@ -196,42 +195,42 @@ def dup2(fd: int, fd2: int) -> None: ...
|
||||
def fstat(fd: int) -> Any: ...
|
||||
def fsync(fd: int) -> None: ...
|
||||
def lseek(fd: int, pos: int, how: int) -> int: ...
|
||||
def open(file: _PathType, flags: int, mode: int = ...) -> int: ...
|
||||
def open(file: AnyPath, flags: int, mode: int = ...) -> int: ...
|
||||
def pipe() -> Tuple[int, int]: ...
|
||||
def read(fd: int, n: int) -> bytes: ...
|
||||
def write(fd: int, string: Union[bytes, buffer]) -> int: ...
|
||||
def access(path: _PathType, mode: int) -> bool: ...
|
||||
def chdir(path: _PathType) -> None: ...
|
||||
def access(path: AnyPath, mode: int) -> bool: ...
|
||||
def chdir(path: AnyPath) -> None: ...
|
||||
def fchdir(fd: int) -> None: ...
|
||||
def getcwd() -> str: ...
|
||||
def getcwdu() -> unicode: ...
|
||||
def chmod(path: _PathType, mode: int) -> None: ...
|
||||
def link(src: _PathType, link_name: _PathType) -> None: ...
|
||||
def lstat(path: _PathType) -> Any: ...
|
||||
def mknod(filename: _PathType, mode: int = ..., device: int = ...) -> None: ...
|
||||
def chmod(path: AnyPath, mode: int) -> None: ...
|
||||
def link(src: AnyPath, link_name: AnyPath) -> None: ...
|
||||
def lstat(path: AnyPath) -> Any: ...
|
||||
def mknod(filename: AnyPath, mode: int = ..., device: int = ...) -> None: ...
|
||||
def major(device: int) -> int: ...
|
||||
def minor(device: int) -> int: ...
|
||||
def makedev(major: int, minor: int) -> int: ...
|
||||
def mkdir(path: _PathType, mode: int = ...) -> None: ...
|
||||
def makedirs(path: _PathType, mode: int = ...) -> None: ...
|
||||
def mkdir(path: AnyPath, mode: int = ...) -> None: ...
|
||||
def makedirs(path: AnyPath, mode: int = ...) -> None: ...
|
||||
def readlink(path: AnyStr) -> AnyStr: ...
|
||||
def remove(path: _PathType) -> None: ...
|
||||
def removedirs(path: _PathType) -> None: ...
|
||||
def rename(src: _PathType, dst: _PathType) -> None: ...
|
||||
def renames(old: _PathType, new: _PathType) -> None: ...
|
||||
def rmdir(path: _PathType) -> None: ...
|
||||
def stat(path: _PathType) -> Any: ...
|
||||
def remove(path: AnyPath) -> None: ...
|
||||
def removedirs(path: AnyPath) -> None: ...
|
||||
def rename(src: AnyPath, dst: AnyPath) -> None: ...
|
||||
def renames(old: AnyPath, new: AnyPath) -> None: ...
|
||||
def rmdir(path: AnyPath) -> None: ...
|
||||
def stat(path: AnyPath) -> Any: ...
|
||||
@overload
|
||||
def stat_float_times() -> bool: ...
|
||||
@overload
|
||||
def stat_float_times(newvalue: bool) -> None: ...
|
||||
def symlink(source: _PathType, link_name: _PathType) -> None: ...
|
||||
def unlink(path: _PathType) -> None: ...
|
||||
def symlink(source: AnyPath, link_name: AnyPath) -> None: ...
|
||||
def unlink(path: AnyPath) -> None: ...
|
||||
# TODO: add ns, dir_fd, follow_symlinks argument
|
||||
if sys.version_info >= (3, 0):
|
||||
def utime(path: _PathType, times: Optional[Tuple[float, float]] = ...) -> None: ...
|
||||
def utime(path: AnyPath, times: Optional[Tuple[float, float]] = ...) -> None: ...
|
||||
else:
|
||||
def utime(path: _PathType, times: Optional[Tuple[float, float]]) -> None: ...
|
||||
def utime(path: AnyPath, times: Optional[Tuple[float, float]]) -> None: ...
|
||||
|
||||
if sys.platform != 'win32':
|
||||
# Unix only
|
||||
@@ -247,15 +246,15 @@ if sys.platform != 'win32':
|
||||
def tcgetpgrp(fd: int) -> int: ...
|
||||
def tcsetpgrp(fd: int, pg: int) -> None: ...
|
||||
def ttyname(fd: int) -> str: ...
|
||||
def chflags(path: _PathType, flags: int) -> None: ...
|
||||
def chroot(path: _PathType) -> None: ...
|
||||
def chown(path: _PathType, uid: int, gid: int) -> None: ...
|
||||
def lchflags(path: _PathType, flags: int) -> None: ...
|
||||
def lchmod(path: _PathType, mode: int) -> None: ...
|
||||
def lchown(path: _PathType, uid: int, gid: int) -> None: ...
|
||||
def mkfifo(path: _PathType, mode: int = ...) -> None: ...
|
||||
def pathconf(path: _PathType, name: Union[str, int]) -> int: ...
|
||||
def statvfs(path: _PathType) -> _StatVFS: ...
|
||||
def chflags(path: AnyPath, flags: int) -> None: ...
|
||||
def chroot(path: AnyPath) -> None: ...
|
||||
def chown(path: AnyPath, uid: int, gid: int) -> None: ...
|
||||
def lchflags(path: AnyPath, flags: int) -> None: ...
|
||||
def lchmod(path: AnyPath, mode: int) -> None: ...
|
||||
def lchown(path: AnyPath, uid: int, gid: int) -> None: ...
|
||||
def mkfifo(path: AnyPath, mode: int = ...) -> None: ...
|
||||
def pathconf(path: AnyPath, name: Union[str, int]) -> int: ...
|
||||
def statvfs(path: AnyPath) -> _StatVFS: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
def walk(top: Union[AnyStr, PathLike[AnyStr]], topdown: bool = ...,
|
||||
@@ -269,20 +268,20 @@ else:
|
||||
|
||||
def abort() -> NoReturn: ...
|
||||
# These are defined as execl(file, *args) but the first *arg is mandatory.
|
||||
def execl(file: _PathType, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
|
||||
def execlp(file: _PathType, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
|
||||
def execl(file: AnyPath, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
|
||||
def execlp(file: AnyPath, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
|
||||
|
||||
# These are: execle(file, *args, env) but env is pulled from the last element of the args.
|
||||
def execle(file: _PathType, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
|
||||
def execlpe(file: _PathType, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
|
||||
def execle(file: AnyPath, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
|
||||
def execlpe(file: AnyPath, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
|
||||
|
||||
# The docs say `args: tuple or list of strings`
|
||||
# The implementation enforces tuple or list so we can't use Sequence.
|
||||
_ExecVArgs = Union[Tuple[Union[bytes, Text], ...], List[bytes], List[Text], List[Union[bytes, Text]]]
|
||||
def execv(path: _PathType, args: _ExecVArgs) -> NoReturn: ...
|
||||
def execve(path: _PathType, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
|
||||
def execvp(file: _PathType, args: _ExecVArgs) -> NoReturn: ...
|
||||
def execvpe(file: _PathType, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
|
||||
def execv(path: AnyPath, args: _ExecVArgs) -> NoReturn: ...
|
||||
def execve(path: AnyPath, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
|
||||
def execvp(file: AnyPath, args: _ExecVArgs) -> NoReturn: ...
|
||||
def execvpe(file: AnyPath, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
|
||||
|
||||
def _exit(n: int) -> NoReturn: ...
|
||||
def kill(pid: int, sig: int) -> None: ...
|
||||
@@ -307,25 +306,25 @@ else:
|
||||
def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ...
|
||||
def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
|
||||
|
||||
def spawnl(mode: int, path: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
|
||||
def spawnle(mode: int, path: _PathType, arg0: Union[bytes, Text],
|
||||
def spawnl(mode: int, path: AnyPath, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
|
||||
def spawnle(mode: int, path: AnyPath, arg0: Union[bytes, Text],
|
||||
*args: Any) -> int: ... # Imprecise sig
|
||||
def spawnv(mode: int, path: _PathType, args: List[Union[bytes, Text]]) -> int: ...
|
||||
def spawnve(mode: int, path: _PathType, args: List[Union[bytes, Text]],
|
||||
def spawnv(mode: int, path: AnyPath, args: List[Union[bytes, Text]]) -> int: ...
|
||||
def spawnve(mode: int, path: AnyPath, args: List[Union[bytes, Text]],
|
||||
env: Mapping[str, str]) -> int: ...
|
||||
def system(command: _PathType) -> int: ...
|
||||
def system(command: AnyPath) -> int: ...
|
||||
def times() -> Tuple[float, float, float, float, float]: ...
|
||||
def waitpid(pid: int, options: int) -> Tuple[int, int]: ...
|
||||
def urandom(n: int) -> bytes: ...
|
||||
|
||||
if sys.platform == 'win32':
|
||||
def startfile(path: _PathType, operation: Optional[str] = ...) -> None: ...
|
||||
def startfile(path: AnyPath, operation: Optional[str] = ...) -> None: ...
|
||||
else:
|
||||
# Unix only
|
||||
def spawnlp(mode: int, file: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
|
||||
def spawnlpe(mode: int, file: _PathType, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise signature
|
||||
def spawnvp(mode: int, file: _PathType, args: List[Union[bytes, Text]]) -> int: ...
|
||||
def spawnvpe(mode: int, file: _PathType, args: List[Union[bytes, Text]], env: Mapping[str, str]) -> int: ...
|
||||
def spawnlp(mode: int, file: AnyPath, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
|
||||
def spawnlpe(mode: int, file: AnyPath, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise signature
|
||||
def spawnvp(mode: int, file: AnyPath, args: List[Union[bytes, Text]]) -> int: ...
|
||||
def spawnvpe(mode: int, file: AnyPath, args: List[Union[bytes, Text]], env: Mapping[str, str]) -> int: ...
|
||||
def wait() -> Tuple[int, int]: ...
|
||||
def wait3(options: int) -> Tuple[int, int, Any]: ...
|
||||
def wait4(pid: int, options: int) -> Tuple[int, int, Any]: ...
|
||||
|
||||
@@ -1,23 +1,14 @@
|
||||
# NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent!
|
||||
# Stubs for os.path
|
||||
# Ron Murawski <ron@horizonchess.com>
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
|
||||
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Text, Callable, Optional
|
||||
from genericpath import exists as exists
|
||||
from _typeshed import StrPath, BytesPath, AnyPath
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike
|
||||
_PathType = Union[bytes, Text, _PathLike]
|
||||
_StrPath = Union[Text, _PathLike[Text]]
|
||||
_BytesPath = Union[bytes, _PathLike[bytes]]
|
||||
else:
|
||||
_PathType = Union[bytes, Text]
|
||||
_StrPath = Text
|
||||
_BytesPath = bytes
|
||||
|
||||
# ----- os.path variables -----
|
||||
supports_unicode_filenames: bool
|
||||
@@ -90,31 +81,31 @@ else:
|
||||
def realpath(filename: AnyStr) -> AnyStr: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
# In reality it returns str for sequences of _StrPath and bytes for sequences
|
||||
# of _BytesPath, but mypy does not accept such a signature.
|
||||
def commonpath(paths: Sequence[_PathType]) -> Any: ...
|
||||
# In reality it returns str for sequences of StrPath and bytes for sequences
|
||||
# of BytesPath, but mypy does not accept such a signature.
|
||||
def commonpath(paths: Sequence[AnyPath]) -> Any: ...
|
||||
elif sys.version_info >= (3, 5):
|
||||
def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ...
|
||||
|
||||
# NOTE: Empty lists results in '' (str) regardless of contained type.
|
||||
# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes
|
||||
# So, fall back to Any
|
||||
def commonprefix(m: Sequence[_PathType]) -> Any: ...
|
||||
def commonprefix(m: Sequence[AnyPath]) -> Any: ...
|
||||
|
||||
def lexists(path: _PathType) -> bool: ...
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: _PathType) -> float: ...
|
||||
def getmtime(filename: _PathType) -> float: ...
|
||||
def getctime(filename: _PathType) -> float: ...
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
|
||||
def getsize(filename: _PathType) -> int: ...
|
||||
def isabs(s: _PathType) -> bool: ...
|
||||
def isfile(path: _PathType) -> bool: ...
|
||||
def isdir(s: _PathType) -> bool: ...
|
||||
def islink(path: _PathType) -> bool: ...
|
||||
def ismount(path: _PathType) -> bool: ...
|
||||
def getsize(filename: AnyPath) -> int: ...
|
||||
def isabs(s: AnyPath) -> bool: ...
|
||||
def isfile(path: AnyPath) -> bool: ...
|
||||
def isdir(s: AnyPath) -> bool: ...
|
||||
def islink(path: AnyPath) -> bool: ...
|
||||
def ismount(path: AnyPath) -> bool: ...
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
@@ -124,28 +115,27 @@ if sys.version_info < (3, 0):
|
||||
@overload
|
||||
def join(__p1: bytes, *p: bytes) -> bytes: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: _PathType) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: _PathType) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ...
|
||||
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: Text, *p: _PathType) -> Text: ...
|
||||
def join(__p1: Text, *p: AnyPath) -> Text: ...
|
||||
elif sys.version_info >= (3, 6):
|
||||
# Mypy complains that the signatures overlap (same for relpath below), but things seem to behave correctly anyway.
|
||||
@overload
|
||||
def join(a: _StrPath, *paths: _StrPath) -> Text: ...
|
||||
def join(a: StrPath, *paths: StrPath) -> Text: ...
|
||||
@overload
|
||||
def join(a: _BytesPath, *paths: _BytesPath) -> bytes: ...
|
||||
def join(a: BytesPath, *paths: BytesPath) -> bytes: ...
|
||||
else:
|
||||
def join(a: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
|
||||
@overload
|
||||
def relpath(path: _BytesPath, start: Optional[_BytesPath] = ...) -> bytes: ...
|
||||
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
|
||||
@overload
|
||||
def relpath(path: _StrPath, start: Optional[_StrPath] = ...) -> Text: ...
|
||||
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
|
||||
|
||||
def samefile(f1: _PathType, f2: _PathType) -> bool: ...
|
||||
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
|
||||
|
||||
|
||||
@@ -1,23 +1,14 @@
|
||||
# NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent!
|
||||
# Stubs for os.path
|
||||
# Ron Murawski <ron@horizonchess.com>
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
|
||||
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Text, Callable, Optional
|
||||
from genericpath import exists as exists
|
||||
from _typeshed import StrPath, BytesPath, AnyPath
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike
|
||||
_PathType = Union[bytes, Text, _PathLike]
|
||||
_StrPath = Union[Text, _PathLike[Text]]
|
||||
_BytesPath = Union[bytes, _PathLike[bytes]]
|
||||
else:
|
||||
_PathType = Union[bytes, Text]
|
||||
_StrPath = Text
|
||||
_BytesPath = bytes
|
||||
|
||||
# ----- os.path variables -----
|
||||
supports_unicode_filenames: bool
|
||||
@@ -90,31 +81,31 @@ else:
|
||||
def realpath(filename: AnyStr) -> AnyStr: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
# In reality it returns str for sequences of _StrPath and bytes for sequences
|
||||
# of _BytesPath, but mypy does not accept such a signature.
|
||||
def commonpath(paths: Sequence[_PathType]) -> Any: ...
|
||||
# In reality it returns str for sequences of StrPath and bytes for sequences
|
||||
# of BytesPath, but mypy does not accept such a signature.
|
||||
def commonpath(paths: Sequence[AnyPath]) -> Any: ...
|
||||
elif sys.version_info >= (3, 5):
|
||||
def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ...
|
||||
|
||||
# NOTE: Empty lists results in '' (str) regardless of contained type.
|
||||
# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes
|
||||
# So, fall back to Any
|
||||
def commonprefix(m: Sequence[_PathType]) -> Any: ...
|
||||
def commonprefix(m: Sequence[AnyPath]) -> Any: ...
|
||||
|
||||
def lexists(path: _PathType) -> bool: ...
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: _PathType) -> float: ...
|
||||
def getmtime(filename: _PathType) -> float: ...
|
||||
def getctime(filename: _PathType) -> float: ...
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
|
||||
def getsize(filename: _PathType) -> int: ...
|
||||
def isabs(s: _PathType) -> bool: ...
|
||||
def isfile(path: _PathType) -> bool: ...
|
||||
def isdir(s: _PathType) -> bool: ...
|
||||
def islink(path: _PathType) -> bool: ...
|
||||
def ismount(path: _PathType) -> bool: ...
|
||||
def getsize(filename: AnyPath) -> int: ...
|
||||
def isabs(s: AnyPath) -> bool: ...
|
||||
def isfile(path: AnyPath) -> bool: ...
|
||||
def isdir(s: AnyPath) -> bool: ...
|
||||
def islink(path: AnyPath) -> bool: ...
|
||||
def ismount(path: AnyPath) -> bool: ...
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
@@ -124,28 +115,27 @@ if sys.version_info < (3, 0):
|
||||
@overload
|
||||
def join(__p1: bytes, *p: bytes) -> bytes: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: _PathType) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: _PathType) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: Text, *p: _PathType) -> Text: ...
|
||||
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: Text, *p: _PathType) -> Text: ...
|
||||
def join(__p1: Text, *p: AnyPath) -> Text: ...
|
||||
elif sys.version_info >= (3, 6):
|
||||
# Mypy complains that the signatures overlap (same for relpath below), but things seem to behave correctly anyway.
|
||||
@overload
|
||||
def join(a: _StrPath, *paths: _StrPath) -> Text: ...
|
||||
def join(a: StrPath, *paths: StrPath) -> Text: ...
|
||||
@overload
|
||||
def join(a: _BytesPath, *paths: _BytesPath) -> bytes: ...
|
||||
def join(a: BytesPath, *paths: BytesPath) -> bytes: ...
|
||||
else:
|
||||
def join(a: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
|
||||
@overload
|
||||
def relpath(path: _BytesPath, start: Optional[_BytesPath] = ...) -> bytes: ...
|
||||
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
|
||||
@overload
|
||||
def relpath(path: _StrPath, start: Optional[_StrPath] = ...) -> Text: ...
|
||||
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
|
||||
|
||||
def samefile(f1: _PathType, f2: _PathType) -> bool: ...
|
||||
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user