mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +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: ...
|
||||
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
import io
|
||||
import sys
|
||||
from os.path import _PathType
|
||||
from typing import IO, Any, Optional, TextIO, Union, overload, TypeVar
|
||||
from _typeshed import AnyPath
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
|
||||
_PathOrFile = Union[_PathType, IO[bytes]]
|
||||
_PathOrFile = Union[AnyPath, IO[bytes]]
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def compress(data: bytes, compresslevel: int = ...) -> bytes: ...
|
||||
@@ -28,7 +24,7 @@ if sys.version_info >= (3, 3):
|
||||
) -> BZ2File: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: _PathType,
|
||||
filename: AnyPath,
|
||||
mode: _OpenTextMode,
|
||||
compresslevel: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, Optional, Text, TypeVar, Union
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Callable, Dict, Optional, TypeVar, Union
|
||||
|
||||
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
def runctx(statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
|
||||
_SelfT = TypeVar('_SelfT', bound=Profile)
|
||||
_T = TypeVar('_T')
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[bytes, Text, os.PathLike[Any]]
|
||||
else:
|
||||
_Path = Union[bytes, Text]
|
||||
|
||||
class Profile:
|
||||
def __init__(self, timer: Callable[[], float] = ..., timeunit: float = ..., subcalls: bool = ..., builtins: bool = ...) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def print_stats(self, sort: Union[str, int] = ...) -> None: ...
|
||||
def dump_stats(self, file: _Path) -> None: ...
|
||||
def dump_stats(self, file: AnyPath) -> None: ...
|
||||
def create_stats(self) -> None: ...
|
||||
def snapshot_stats(self) -> None: ...
|
||||
def run(self: _SelfT, cmd: str) -> _SelfT: ...
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
|
||||
from typing import Dict, Any, List, Tuple, Optional, Callable, Type, Union, IO, AnyStr, TypeVar
|
||||
from typing import Dict, Any, List, Tuple, Optional, Callable, Type, IO
|
||||
from types import FrameType, TracebackType
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
_Path = Union[_T, PathLike[_T]]
|
||||
else:
|
||||
_Path = Union[_T]
|
||||
|
||||
|
||||
def reset() -> str: ... # undocumented
|
||||
def small(text: str) -> str: ... # undocumented
|
||||
@@ -23,11 +14,10 @@ def html(einfo: _ExcInfo, context: int = ...) -> str: ...
|
||||
def text(einfo: _ExcInfo, context: int = ...) -> str: ...
|
||||
|
||||
class Hook: # undocumented
|
||||
|
||||
def __init__(self, display: int = ..., logdir: Optional[_Path[AnyStr]] = ..., context: int = ..., file: Optional[IO[str]] = ..., format: str = ...) -> None: ...
|
||||
def __init__(self, display: int = ..., logdir: Optional[AnyPath] = ..., context: int = ..., file: Optional[IO[str]] = ..., format: str = ...) -> None: ...
|
||||
def __call__(self, etype: Optional[Type[BaseException]], evalue: Optional[BaseException], etb: Optional[TracebackType]) -> None: ...
|
||||
def handle(self, info: Optional[_ExcInfo] = ...) -> None: ...
|
||||
|
||||
def handler(info: Optional[_ExcInfo] = ...) -> None: ...
|
||||
|
||||
def enable(display: int = ..., logdir: Optional[_Path[AnyStr]] = ..., context: int = ..., format: str = ...) -> None: ...
|
||||
def enable(display: int = ..., logdir: Optional[AnyPath] = ..., context: int = ..., format: str = ...) -> None: ...
|
||||
|
||||
@@ -1,30 +1,24 @@
|
||||
from typing import Iterable, Callable, IO, AnyStr, Generic, Any, Text, Union, Iterator, Optional
|
||||
|
||||
import os
|
||||
from typing import Iterable, Callable, IO, AnyStr, Generic, Any, Union, Iterator, Optional
|
||||
from _typeshed import AnyPath
|
||||
import sys
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[Text, bytes, os.PathLike[Any]]
|
||||
else:
|
||||
_Path = Union[Text, bytes]
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def input(
|
||||
files: Union[_Path, Iterable[_Path], None] = ...,
|
||||
files: Union[AnyPath, Iterable[AnyPath], None] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
*,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[_Path, str], IO[AnyStr]] = ...,
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
|
||||
) -> FileInput[AnyStr]: ...
|
||||
else:
|
||||
def input(
|
||||
files: Union[_Path, Iterable[_Path], None] = ...,
|
||||
files: Union[AnyPath, Iterable[AnyPath], None] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
bufsize: int = ...,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[_Path, str], IO[AnyStr]] = ...,
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
|
||||
) -> FileInput[AnyStr]: ...
|
||||
|
||||
def close() -> None: ...
|
||||
@@ -40,22 +34,22 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(
|
||||
self,
|
||||
files: Union[None, _Path, Iterable[_Path]] = ...,
|
||||
files: Union[None, AnyPath, Iterable[AnyPath]] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
*,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[_Path, str], IO[AnyStr]] = ...
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
files: Union[None, _Path, Iterable[_Path]] = ...,
|
||||
files: Union[None, AnyPath, Iterable[AnyPath]] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
bufsize: int = ...,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[_Path, str], IO[AnyStr]] = ...
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...
|
||||
) -> None: ...
|
||||
|
||||
def __del__(self) -> None: ...
|
||||
@@ -75,8 +69,8 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
|
||||
def isfirstline(self) -> bool: ...
|
||||
def isstdin(self) -> bool: ...
|
||||
|
||||
def hook_compressed(filename: _Path, mode: str) -> IO[Any]: ...
|
||||
def hook_compressed(filename: AnyPath, mode: str) -> IO[Any]: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def hook_encoded(encoding: str, errors: Optional[str] = ...) -> Callable[[_Path, str], IO[Any]]: ...
|
||||
def hook_encoded(encoding: str, errors: Optional[str] = ...) -> Callable[[AnyPath, str], IO[Any]]: ...
|
||||
else:
|
||||
def hook_encoded(encoding: str) -> Callable[[_Path, str], IO[Any]]: ...
|
||||
def hook_encoded(encoding: str) -> Callable[[AnyPath, str], IO[Any]]: ...
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# Stubs for lib2to3.pgen2 (Python 3.6)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Text, Union
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[Text, os.PathLike]
|
||||
else:
|
||||
_Path = Text
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
# Stubs for lib2to3.pgen2.driver (Python 3.6)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Callable, IO, Iterable, List, Optional, Text, Tuple, Union
|
||||
from _typeshed import StrPath
|
||||
from typing import Any, IO, Iterable, Optional, Text
|
||||
|
||||
from logging import Logger
|
||||
from lib2to3.pytree import _Convert, _NL
|
||||
from lib2to3.pgen2 import _Path
|
||||
from lib2to3.pgen2.grammar import Grammar
|
||||
|
||||
|
||||
@@ -18,7 +14,7 @@ class Driver:
|
||||
def parse_tokens(self, tokens: Iterable[Any], debug: bool = ...) -> _NL: ...
|
||||
def parse_stream_raw(self, stream: IO[Text], debug: bool = ...) -> _NL: ...
|
||||
def parse_stream(self, stream: IO[Text], debug: bool = ...) -> _NL: ...
|
||||
def parse_file(self, filename: _Path, encoding: Optional[Text] = ..., debug: bool = ...) -> _NL: ...
|
||||
def parse_file(self, filename: StrPath, encoding: Optional[Text] = ..., debug: bool = ...) -> _NL: ...
|
||||
def parse_string(self, text: Text, debug: bool = ...) -> _NL: ...
|
||||
|
||||
def load_grammar(gt: Text = ..., gp: Optional[Text] = ..., save: bool = ..., force: bool = ..., logger: Optional[Logger] = ...) -> Grammar: ...
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
# Stubs for lib2to3.pgen2.grammar (Python 3.6)
|
||||
|
||||
from lib2to3.pgen2 import _Path
|
||||
|
||||
from typing import Any, Dict, List, Optional, Text, Tuple, TypeVar
|
||||
from _typeshed import StrPath
|
||||
from typing import Dict, List, Optional, Text, Tuple, TypeVar
|
||||
|
||||
_P = TypeVar('_P')
|
||||
_Label = Tuple[int, Optional[Text]]
|
||||
@@ -20,8 +17,8 @@ class Grammar:
|
||||
symbol2label: Dict[Text, int]
|
||||
start: int
|
||||
def __init__(self) -> None: ...
|
||||
def dump(self, filename: _Path) -> None: ...
|
||||
def load(self, filename: _Path) -> None: ...
|
||||
def dump(self, filename: StrPath) -> None: ...
|
||||
def load(self, filename: StrPath) -> None: ...
|
||||
def copy(self: _P) -> _P: ...
|
||||
def report(self) -> None: ...
|
||||
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
# Stubs for lib2to3.pgen2.pgen (Python 3.6)
|
||||
|
||||
from _typeshed import StrPath
|
||||
from typing import (
|
||||
Any, Dict, IO, Iterable, Iterator, List, NoReturn, Optional, Text, Tuple
|
||||
)
|
||||
|
||||
from lib2to3.pgen2 import _Path, grammar
|
||||
from lib2to3.pgen2 import grammar
|
||||
from lib2to3.pgen2.tokenize import _TokenInfo
|
||||
|
||||
class PgenGrammar(grammar.Grammar): ...
|
||||
|
||||
class ParserGenerator:
|
||||
filename: _Path
|
||||
filename: StrPath
|
||||
stream: IO[Text]
|
||||
generator: Iterator[_TokenInfo]
|
||||
first: Dict[Text, Dict[Text, int]]
|
||||
def __init__(self, filename: _Path, stream: Optional[IO[Text]] = ...) -> None: ...
|
||||
def __init__(self, filename: StrPath, stream: Optional[IO[Text]] = ...) -> None: ...
|
||||
def make_grammar(self) -> PgenGrammar: ...
|
||||
def make_first(self, c: PgenGrammar, name: Text) -> Dict[int, int]: ...
|
||||
def make_label(self, c: PgenGrammar, label: Text) -> int: ...
|
||||
@@ -47,4 +46,4 @@ class DFAState:
|
||||
def unifystate(self, old: DFAState, new: DFAState) -> None: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
|
||||
def generate_grammar(filename: _Path = ...) -> PgenGrammar: ...
|
||||
def generate_grammar(filename: StrPath = ...) -> PgenGrammar: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Stubs for logging (Python 3.7)
|
||||
|
||||
from _typeshed import StrPath
|
||||
from typing import (
|
||||
Any, Callable, Dict, Iterable, List, Mapping, MutableMapping, Optional, IO,
|
||||
Sequence, Tuple, Text, Union, overload,
|
||||
@@ -19,11 +18,6 @@ else:
|
||||
_ArgsType = Union[Tuple[Any, ...], Mapping[str, Any]]
|
||||
_FilterType = Union[Filter, Callable[[LogRecord], int]]
|
||||
_Level = Union[int, Text]
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
_Path = Union[str, PathLike[str]]
|
||||
else:
|
||||
_Path = str
|
||||
|
||||
raiseExceptions: bool
|
||||
logThreads: bool
|
||||
@@ -474,12 +468,12 @@ def getLevelName(level: Union[int, str]) -> Any: ...
|
||||
def makeLogRecord(dict: Mapping[str, Any]) -> LogRecord: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def basicConfig(*, filename: Optional[_Path] = ..., filemode: str = ...,
|
||||
def basicConfig(*, filename: Optional[StrPath] = ..., filemode: str = ...,
|
||||
format: str = ..., datefmt: Optional[str] = ..., style: str = ...,
|
||||
level: Optional[_Level] = ..., stream: Optional[IO[str]] = ...,
|
||||
handlers: Optional[Iterable[Handler]] = ..., force: bool = ...) -> None: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def basicConfig(*, filename: Optional[_Path] = ..., filemode: str = ...,
|
||||
def basicConfig(*, filename: Optional[StrPath] = ..., filemode: str = ...,
|
||||
format: str = ..., datefmt: Optional[str] = ..., style: str = ...,
|
||||
level: Optional[_Level] = ..., stream: Optional[IO[str]] = ...,
|
||||
handlers: Optional[Iterable[Handler]] = ...) -> None: ...
|
||||
@@ -518,7 +512,7 @@ class FileHandler(StreamHandler):
|
||||
mode: str # undocumented
|
||||
encoding: Optional[str] # undocumented
|
||||
delay: bool # undocumented
|
||||
def __init__(self, filename: _Path, mode: str = ...,
|
||||
def __init__(self, filename: StrPath, mode: str = ...,
|
||||
encoding: Optional[str] = ..., delay: bool = ...) -> None: ...
|
||||
def _open(self) -> IO[Any]: ...
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Stubs for logging.config (Python 3.4)
|
||||
|
||||
from _typeshed import AnyPath, StrPath
|
||||
from typing import Any, Callable, Dict, Optional, IO, Union
|
||||
from threading import Thread
|
||||
import sys
|
||||
@@ -7,15 +6,11 @@ if sys.version_info >= (3,):
|
||||
from configparser import RawConfigParser
|
||||
else:
|
||||
from ConfigParser import RawConfigParser
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
_Path = Union[str, bytes, PathLike[str]]
|
||||
elif sys.version_info >= (3, 6):
|
||||
_Path = Union[str, PathLike[str]]
|
||||
_Path = AnyPath
|
||||
else:
|
||||
_Path = str
|
||||
_Path = StrPath
|
||||
|
||||
|
||||
def dictConfig(config: Dict[str, Any]) -> None: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Stubs for logging.handlers (Python 2.4)
|
||||
|
||||
from _typeshed import StrPath
|
||||
import datetime
|
||||
from logging import Handler, FileHandler, LogRecord
|
||||
from socket import SocketType
|
||||
@@ -15,11 +14,6 @@ else:
|
||||
|
||||
# TODO update socket stubs to add SocketKind
|
||||
_SocketKind = int
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
_Path = Union[str, PathLike[str]]
|
||||
else:
|
||||
_Path = str
|
||||
|
||||
DEFAULT_TCP_LOGGING_PORT: int
|
||||
DEFAULT_UDP_LOGGING_PORT: int
|
||||
@@ -31,7 +25,7 @@ SYSLOG_TCP_PORT: int
|
||||
class WatchedFileHandler(FileHandler):
|
||||
dev: int
|
||||
ino: int
|
||||
def __init__(self, filename: _Path, mode: str = ..., encoding: Optional[str] = ...,
|
||||
def __init__(self, filename: StrPath, mode: str = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ...) -> None: ...
|
||||
def _statstream(self) -> None: ...
|
||||
|
||||
@@ -41,7 +35,7 @@ if sys.version_info >= (3,):
|
||||
terminator: str
|
||||
namer: Optional[Callable[[str], str]]
|
||||
rotator: Optional[Callable[[str, str], None]]
|
||||
def __init__(self, filename: _Path, mode: str,
|
||||
def __init__(self, filename: StrPath, mode: str,
|
||||
encoding: Optional[str] = ...,
|
||||
delay: bool = ...) -> None: ...
|
||||
def rotation_filename(self, default_name: str) -> None: ...
|
||||
@@ -50,7 +44,7 @@ if sys.version_info >= (3,):
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
class RotatingFileHandler(BaseRotatingHandler):
|
||||
def __init__(self, filename: _Path, mode: str = ..., maxBytes: int = ...,
|
||||
def __init__(self, filename: StrPath, mode: str = ..., maxBytes: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ...) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
@@ -65,7 +59,7 @@ else:
|
||||
if sys.version_info >= (3,):
|
||||
class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||
if sys.version_info >= (3, 4):
|
||||
def __init__(self, filename: _Path, when: str = ...,
|
||||
def __init__(self, filename: StrPath, when: str = ...,
|
||||
interval: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ..., utc: bool = ...,
|
||||
|
||||
@@ -4,19 +4,13 @@
|
||||
import os
|
||||
import sys
|
||||
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
|
||||
from _typeshed import StrPath, BytesPath, AnyPath
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
_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
|
||||
@@ -79,26 +73,26 @@ if sys.version_info < (3, 8):
|
||||
# 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: ...
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
def exists(path: Union[_PathType, int]) -> bool: ...
|
||||
def exists(path: Union[AnyPath, int]) -> bool: ...
|
||||
else:
|
||||
def exists(path: _PathType) -> bool: ...
|
||||
def lexists(path: _PathType) -> bool: ...
|
||||
def exists(path: AnyPath) -> 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(s: _PathType) -> bool: ...
|
||||
def ismount(s: _PathType) -> bool: ...
|
||||
def getsize(filename: AnyPath) -> int: ...
|
||||
def isabs(s: AnyPath) -> bool: ...
|
||||
def isfile(path: AnyPath) -> bool: ...
|
||||
def isdir(s: AnyPath) -> bool: ...
|
||||
def islink(s: AnyPath) -> bool: ...
|
||||
def ismount(s: AnyPath) -> bool: ...
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
@@ -108,23 +102,23 @@ if sys.version_info < (3, 8):
|
||||
@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, but things seem to behave correctly anyway.
|
||||
@overload
|
||||
def join(s: _StrPath, *paths: _StrPath) -> Text: ...
|
||||
def join(s: StrPath, *paths: StrPath) -> Text: ...
|
||||
@overload
|
||||
def join(s: _BytesPath, *paths: _BytesPath) -> bytes: ...
|
||||
def join(s: BytesPath, *paths: BytesPath) -> bytes: ...
|
||||
else:
|
||||
def join(s: AnyStr, *paths: AnyStr) -> AnyStr: ...
|
||||
|
||||
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,19 +1,8 @@
|
||||
|
||||
from typing import Optional, Union, Text, AnyStr, Callable, IO, Any, Iterator, List, Tuple, TypeVar, Protocol, Dict, Sequence, Iterable, Generic, Type, Mapping, overload
|
||||
from types import TracebackType
|
||||
import sys
|
||||
import email
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike
|
||||
_PathType = Union[bytes, Text, _PathLike]
|
||||
else:
|
||||
_PathType = Union[bytes, Text]
|
||||
from _typeshed import AnyPath
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_MessageType = TypeVar("_MessageType", bound=Message)
|
||||
@@ -32,7 +21,7 @@ class Mailbox(Generic[_MessageType]):
|
||||
_path: Union[bytes, str] # undocumented
|
||||
_factory: Optional[Callable[[IO[Any]], _MessageType]] # undocumented
|
||||
|
||||
def __init__(self, path: _PathType, factory: Optional[Callable[[IO[Any]], _MessageType]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], _MessageType]] = ..., create: bool = ...) -> None: ...
|
||||
def add(self, message: _MessageData) -> str: ...
|
||||
def remove(self, key: str) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
@@ -73,7 +62,7 @@ class Maildir(Mailbox[MaildirMessage]):
|
||||
|
||||
colon: str
|
||||
|
||||
def __init__(self, dirname: _PathType, factory: Optional[Callable[[IO[Any]], MaildirMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], MaildirMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def get_file(self, key: str) -> _ProxyFile[bytes]: ...
|
||||
|
||||
def list_folders(self) -> List[str]: ...
|
||||
@@ -91,28 +80,28 @@ class _mboxMMDF(_singlefileMailbox[_MessageType]):
|
||||
|
||||
class mbox(_mboxMMDF[mboxMessage]):
|
||||
|
||||
def __init__(self, dirname: _PathType, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...) -> None: ...
|
||||
|
||||
class MMDF(_mboxMMDF[MMDFMessage]):
|
||||
|
||||
def __init__(self, dirname: _PathType, factory: Optional[Callable[[IO[Any]], MMDFMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], MMDFMessage]] = ..., create: bool = ...) -> None: ...
|
||||
|
||||
class MH(Mailbox[MHMessage]):
|
||||
|
||||
def __init__(self, dirname: _PathType, factory: Optional[Callable[[IO[Any]], MHMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], MHMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def get_file(self, key: str) -> _ProxyFile[bytes]: ...
|
||||
|
||||
def list_folders(self) -> List[str]: ...
|
||||
def get_folder(self, folder: _PathType) -> MH: ...
|
||||
def add_folder(self, folder: _PathType) -> MH: ...
|
||||
def remove_folder(self, folder: _PathType) -> None: ...
|
||||
def get_folder(self, folder: AnyPath) -> MH: ...
|
||||
def add_folder(self, folder: AnyPath) -> MH: ...
|
||||
def remove_folder(self, folder: AnyPath) -> None: ...
|
||||
def get_sequences(self) -> Dict[str, List[int]]: ...
|
||||
def set_sequences(self, sequences: Mapping[str, Sequence[int]]) -> None: ...
|
||||
def pack(self) -> None: ...
|
||||
|
||||
class Babyl(_singlefileMailbox[BabylMessage]):
|
||||
|
||||
def __init__(self, dirname: _PathType, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...) -> None: ...
|
||||
|
||||
def get_file(self, key: str) -> IO[bytes]: ...
|
||||
def get_labels(self) -> List[str]: ...
|
||||
|
||||
@@ -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,13 +1,6 @@
|
||||
from typing import Any, List, Sequence, Text, Tuple, Union
|
||||
from typing import Any, List, Sequence, Text, Tuple
|
||||
from types import CodeType
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike
|
||||
_Path = Union[str, bytes, _PathLike]
|
||||
else:
|
||||
_Path = Union[str, bytes]
|
||||
from _typeshed import AnyPath
|
||||
|
||||
def expr(source: Text) -> STType: ...
|
||||
def suite(source: Text) -> STType: ...
|
||||
@@ -15,14 +8,14 @@ def sequence2st(sequence: Sequence[Any]) -> STType: ...
|
||||
def tuple2st(sequence: Sequence[Any]) -> STType: ...
|
||||
def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
|
||||
def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ...
|
||||
def compilest(st: STType, filename: _Path = ...) -> CodeType: ...
|
||||
def compilest(st: STType, filename: AnyPath = ...) -> CodeType: ...
|
||||
def isexpr(st: STType) -> bool: ...
|
||||
def issuite(st: STType) -> bool: ...
|
||||
|
||||
class ParserError(Exception): ...
|
||||
|
||||
class STType:
|
||||
def compile(self, filename: _Path = ...) -> CodeType: ...
|
||||
def compile(self, filename: AnyPath = ...) -> CodeType: ...
|
||||
def isexpr(self) -> bool: ...
|
||||
def issuite(self) -> bool: ...
|
||||
def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# Stubs for plistlib
|
||||
|
||||
from typing import (
|
||||
Any, IO, Mapping, MutableMapping, Optional, overload, Union,
|
||||
Type, TypeVar,
|
||||
Type, TypeVar, Text
|
||||
)
|
||||
from typing import Dict as DictT
|
||||
import sys
|
||||
@@ -17,10 +15,7 @@ if sys.version_info >= (3,):
|
||||
|
||||
mm = MutableMapping[str, Any]
|
||||
_D = TypeVar('_D', bound=mm)
|
||||
if sys.version_info >= (3,):
|
||||
_Path = str
|
||||
else:
|
||||
_Path = Union[str, unicode]
|
||||
_Path = Union[str, Text]
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@overload
|
||||
|
||||
@@ -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,16 +1,11 @@
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, Optional, Text, TypeVar, Union
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Callable, Dict, Optional, TypeVar, Union
|
||||
|
||||
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
def runctx(statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
|
||||
_SelfT = TypeVar('_SelfT', bound=Profile)
|
||||
_T = TypeVar('_T')
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[bytes, Text, os.PathLike[Any]]
|
||||
else:
|
||||
_Path = Union[bytes, Text]
|
||||
|
||||
class Profile:
|
||||
bias: int
|
||||
@@ -20,7 +15,7 @@ class Profile:
|
||||
def simulate_call(self, name: str) -> None: ...
|
||||
def simulate_cmd_complete(self) -> None: ...
|
||||
def print_stats(self, sort: Union[str, int] = ...) -> None: ...
|
||||
def dump_stats(self, file: _Path) -> None: ...
|
||||
def dump_stats(self, file: AnyPath) -> None: ...
|
||||
def create_stats(self) -> None: ...
|
||||
def snapshot_stats(self) -> None: ...
|
||||
def run(self: _SelfT, cmd: str) -> _SelfT: ...
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
from profile import Profile
|
||||
from cProfile import Profile as _cProfile
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Dict, IO, Iterable, List, Optional, Text, Tuple, TypeVar, Union, overload
|
||||
|
||||
_Selector = Union[str, float, int]
|
||||
_T = TypeVar('_T', bound=Stats)
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[bytes, Text, os.PathLike[Any]]
|
||||
else:
|
||||
_Path = Union[bytes, Text]
|
||||
|
||||
class Stats:
|
||||
sort_arg_dict_default: Dict[str, Tuple[Any, str]]
|
||||
@@ -20,7 +15,7 @@ class Stats:
|
||||
def load_stats(self, arg: Union[None, str, Text, Profile, _cProfile]) -> None: ...
|
||||
def get_top_level_stats(self) -> None: ...
|
||||
def add(self: _T, *arg_list: Union[None, str, Text, Profile, _cProfile, _T]) -> _T: ...
|
||||
def dump_stats(self, filename: _Path) -> None: ...
|
||||
def dump_stats(self, filename: AnyPath) -> None: ...
|
||||
def get_sort_arg_defs(self) -> Dict[str, Tuple[Tuple[Tuple[int, int], ...], str]]: ...
|
||||
@overload
|
||||
def sort_stats(self: _T, field: int) -> _T: ...
|
||||
|
||||
@@ -6,24 +6,22 @@ import sys
|
||||
# cases don't use them.
|
||||
|
||||
from typing import (
|
||||
List, Iterable, Callable, Any, Tuple, Sequence, NamedTuple, IO,
|
||||
List, Iterable, Callable, Any, Tuple, Sequence, NamedTuple,
|
||||
AnyStr, Optional, Union, Set, TypeVar, overload, Type, Protocol, Text
|
||||
)
|
||||
from _typeshed import StrPath
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[str, os.PathLike[str]]
|
||||
_AnyStr = str
|
||||
_AnyPath = TypeVar("_AnyPath", str, os.PathLike[str])
|
||||
# Return value of some functions that may either return a path-like object that was passed in or
|
||||
# a string
|
||||
_PathReturn = Any
|
||||
elif sys.version_info >= (3,):
|
||||
_Path = str
|
||||
_AnyStr = str
|
||||
_AnyPath = str
|
||||
_PathReturn = str
|
||||
else:
|
||||
_Path = Text
|
||||
_AnyStr = TypeVar("_AnyStr", str, unicode)
|
||||
_AnyPath = TypeVar("_AnyPath", str, unicode)
|
||||
_PathReturn = Type[None]
|
||||
@@ -53,40 +51,40 @@ def copyfileobj(fsrc: _Reader[AnyStr], fdst: _Writer[AnyStr],
|
||||
length: int = ...) -> None: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
def copyfile(src: _Path, dst: _AnyPath, *,
|
||||
def copyfile(src: StrPath, dst: _AnyPath, *,
|
||||
follow_symlinks: bool = ...) -> _AnyPath: ...
|
||||
def copymode(src: _Path, dst: _Path, *,
|
||||
def copymode(src: StrPath, dst: StrPath, *,
|
||||
follow_symlinks: bool = ...) -> None: ...
|
||||
def copystat(src: _Path, dst: _Path, *,
|
||||
def copystat(src: StrPath, dst: StrPath, *,
|
||||
follow_symlinks: bool = ...) -> None: ...
|
||||
def copy(src: _Path, dst: _Path, *,
|
||||
def copy(src: StrPath, dst: StrPath, *,
|
||||
follow_symlinks: bool = ...) -> _PathReturn: ...
|
||||
def copy2(src: _Path, dst: _Path, *,
|
||||
def copy2(src: StrPath, dst: StrPath, *,
|
||||
follow_symlinks: bool = ...) -> _PathReturn: ...
|
||||
else:
|
||||
def copyfile(src: _Path, dst: _Path) -> None: ...
|
||||
def copymode(src: _Path, dst: _Path) -> None: ...
|
||||
def copystat(src: _Path, dst: _Path) -> None: ...
|
||||
def copy(src: _Path, dst: _Path) -> _PathReturn: ...
|
||||
def copy2(src: _Path, dst: _Path) -> _PathReturn: ...
|
||||
def copyfile(src: StrPath, dst: StrPath) -> None: ...
|
||||
def copymode(src: StrPath, dst: StrPath) -> None: ...
|
||||
def copystat(src: StrPath, dst: StrPath) -> None: ...
|
||||
def copy(src: StrPath, dst: StrPath) -> _PathReturn: ...
|
||||
def copy2(src: StrPath, dst: StrPath) -> _PathReturn: ...
|
||||
|
||||
def ignore_patterns(*patterns: _Path) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
|
||||
def ignore_patterns(*patterns: StrPath) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def copytree(
|
||||
src: _Path,
|
||||
dst: _Path,
|
||||
src: StrPath,
|
||||
dst: StrPath,
|
||||
symlinks: bool = ...,
|
||||
ignore: Union[None, Callable[[str, List[str]], Iterable[str]], Callable[[_Path, List[str]], Iterable[str]]] = ...,
|
||||
ignore: Union[None, Callable[[str, List[str]], Iterable[str]], Callable[[StrPath, List[str]], Iterable[str]]] = ...,
|
||||
copy_function: Callable[[str, str], None] = ...,
|
||||
ignore_dangling_symlinks: bool = ...,
|
||||
dirs_exist_ok: bool = ...,
|
||||
) -> _PathReturn: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def copytree(src: _Path, dst: _Path, symlinks: bool = ...,
|
||||
def copytree(src: StrPath, dst: StrPath, symlinks: bool = ...,
|
||||
ignore: Union[None,
|
||||
Callable[[str, List[str]], Iterable[str]],
|
||||
Callable[[_Path, List[str]], Iterable[str]]] = ...,
|
||||
Callable[[StrPath, List[str]], Iterable[str]]] = ...,
|
||||
copy_function: Callable[[str, str], None] = ...,
|
||||
ignore_dangling_symlinks: bool = ...) -> _PathReturn: ...
|
||||
else:
|
||||
@@ -96,42 +94,42 @@ else:
|
||||
Iterable[AnyStr]]] = ...) -> _PathReturn: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
def rmtree(path: Union[bytes, _Path], ignore_errors: bool = ...,
|
||||
def rmtree(path: Union[bytes, StrPath], ignore_errors: bool = ...,
|
||||
onerror: Optional[Callable[[Any, Any, Any], Any]] = ...) -> None: ...
|
||||
else:
|
||||
def rmtree(path: _AnyPath, ignore_errors: bool = ...,
|
||||
onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...) -> None: ...
|
||||
|
||||
_CopyFn = Union[Callable[[str, str], None], Callable[[_Path, _Path], None]]
|
||||
_CopyFn = Union[Callable[[str, str], None], Callable[[StrPath, StrPath], None]]
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def move(src: _Path, dst: _Path,
|
||||
def move(src: StrPath, dst: StrPath,
|
||||
copy_function: _CopyFn = ...) -> _PathReturn: ...
|
||||
elif sys.version_info >= (3, 5):
|
||||
# See https://bugs.python.org/issue32689
|
||||
def move(src: str, dst: _Path,
|
||||
def move(src: str, dst: StrPath,
|
||||
copy_function: _CopyFn = ...) -> _PathReturn: ...
|
||||
else:
|
||||
def move(src: _Path, dst: _Path) -> _PathReturn: ...
|
||||
def move(src: StrPath, dst: StrPath) -> _PathReturn: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
class _ntuple_diskusage(NamedTuple):
|
||||
total: int
|
||||
used: int
|
||||
free: int
|
||||
def disk_usage(path: _Path) -> _ntuple_diskusage: ...
|
||||
def chown(path: _Path, user: Optional[str] = ...,
|
||||
def disk_usage(path: StrPath) -> _ntuple_diskusage: ...
|
||||
def chown(path: StrPath, user: Optional[str] = ...,
|
||||
group: Optional[str] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
def which(cmd: _Path, mode: int = ..., path: Optional[_Path] = ...) -> Optional[str]: ...
|
||||
def which(cmd: StrPath, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[str]: ...
|
||||
@overload
|
||||
def which(cmd: bytes, mode: int = ..., path: Optional[_Path] = ...) -> Optional[bytes]: ...
|
||||
def which(cmd: bytes, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[bytes]: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def which(cmd: _Path, mode: int = ..., path: Optional[_Path] = ...) -> Optional[str]: ...
|
||||
def which(cmd: StrPath, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[str]: ...
|
||||
|
||||
def make_archive(base_name: _AnyStr, format: str, root_dir: Optional[_Path] = ...,
|
||||
base_dir: Optional[_Path] = ..., verbose: bool = ...,
|
||||
def make_archive(base_name: _AnyStr, format: str, root_dir: Optional[StrPath] = ...,
|
||||
base_dir: Optional[StrPath] = ..., verbose: bool = ...,
|
||||
dry_run: bool = ..., owner: Optional[str] = ..., group: Optional[str] = ...,
|
||||
logger: Optional[Any] = ...) -> _AnyStr: ...
|
||||
def get_archive_formats() -> List[Tuple[str, str]]: ...
|
||||
@@ -143,11 +141,11 @@ def unregister_archive_format(name: str) -> None: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
if sys.version_info >= (3, 7):
|
||||
def unpack_archive(filename: _Path, extract_dir: Optional[_Path] = ...,
|
||||
def unpack_archive(filename: StrPath, extract_dir: Optional[StrPath] = ...,
|
||||
format: Optional[str] = ...) -> None: ...
|
||||
else:
|
||||
# See http://bugs.python.org/issue30218
|
||||
def unpack_archive(filename: str, extract_dir: Optional[_Path] = ...,
|
||||
def unpack_archive(filename: str, extract_dir: Optional[StrPath] = ...,
|
||||
format: Optional[str] = ...) -> None: ...
|
||||
def register_unpack_format(name: str, extensions: List[str], function: Any,
|
||||
extra_args: Sequence[Tuple[str, Any]] = ...,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# Stubs for sndhdr (Python 2 and 3)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, NamedTuple, Optional, Tuple, Union
|
||||
from _typeshed import AnyPath
|
||||
from typing import NamedTuple, Optional, Tuple, Union
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
class SndHeaders(NamedTuple):
|
||||
@@ -15,10 +13,5 @@ if sys.version_info >= (3, 5):
|
||||
else:
|
||||
_SndHeaders = Tuple[str, int, int, int, Union[int, str]]
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[str, bytes, os.PathLike[Any]]
|
||||
else:
|
||||
_Path = Union[str, bytes]
|
||||
|
||||
def what(filename: _Path) -> Optional[_SndHeaders]: ...
|
||||
def whathdr(filename: _Path) -> Optional[_SndHeaders]: ...
|
||||
def what(filename: AnyPath) -> Optional[_SndHeaders]: ...
|
||||
def whathdr(filename: AnyPath) -> Optional[_SndHeaders]: ...
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
# Stubs for ssl
|
||||
|
||||
from _typeshed import StrPath
|
||||
from typing import (
|
||||
Any, Callable, ClassVar, Dict, Iterable, List, NamedTuple, Optional, Set, Text, Type, Tuple, Union,
|
||||
overload
|
||||
)
|
||||
from typing_extensions import Literal
|
||||
import enum
|
||||
import socket
|
||||
import sys
|
||||
import os
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
|
||||
_PCTRTT = Tuple[Tuple[str, str], ...]
|
||||
_PCTRTTT = Tuple[_PCTRTT, ...]
|
||||
@@ -21,11 +15,6 @@ _PeerCertRetType = Union[_PeerCertRetDictType, bytes, None]
|
||||
_EnumRetType = List[Tuple[bytes, str, Union[Set[str], bool]]]
|
||||
_PasswordType = Union[Callable[[], Union[str, bytes]], str, bytes]
|
||||
|
||||
if sys.version_info < (3, 6):
|
||||
_Path = Text
|
||||
else:
|
||||
_Path = Union[str, os.PathLike[Any]]
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
_SC1ArgT = Union[SSLSocket, SSLObject]
|
||||
else:
|
||||
@@ -278,13 +267,13 @@ class SSLContext:
|
||||
else:
|
||||
def __init__(self, protocol: int) -> None: ...
|
||||
def cert_store_stats(self) -> Dict[str, int]: ...
|
||||
def load_cert_chain(self, certfile: _Path, keyfile: Optional[_Path] = ...,
|
||||
def load_cert_chain(self, certfile: StrPath, keyfile: Optional[StrPath] = ...,
|
||||
password: Optional[_PasswordType] = ...) -> None: ...
|
||||
def load_default_certs(self, purpose: Purpose = ...) -> None: ...
|
||||
def load_verify_locations(
|
||||
self,
|
||||
cafile: Optional[_Path] = ...,
|
||||
capath: Optional[_Path] = ...,
|
||||
cafile: Optional[StrPath] = ...,
|
||||
capath: Optional[StrPath] = ...,
|
||||
cadata: Union[Text, bytes, None] = ...,
|
||||
) -> None: ...
|
||||
def get_ca_certs(self, binary_form: bool = ...) -> Union[List[_PeerCertRetDictType], List[bytes]]: ...
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
# Stubs for tabnanny (Python 2 and 3)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Iterable, Tuple, Union
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[str, bytes, os.PathLike]
|
||||
else:
|
||||
_Path = Union[str, bytes]
|
||||
from _typeshed import AnyPath
|
||||
from typing import Iterable, Tuple
|
||||
|
||||
verbose: int
|
||||
filename_only: int
|
||||
@@ -18,5 +10,5 @@ class NannyNag(Exception):
|
||||
def get_msg(self) -> str: ...
|
||||
def get_line(self) -> str: ...
|
||||
|
||||
def check(file: _Path) -> None: ...
|
||||
def check(file: AnyPath) -> None: ...
|
||||
def process_tokens(tokens: Iterable[Tuple[int, str, Tuple[int, int], Tuple[int, int], str]]) -> None: ...
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
# Stubs for tarfile
|
||||
|
||||
from typing import (
|
||||
Callable, IO, Iterable, Iterator, List, Mapping, Optional, Type,
|
||||
Union, Tuple, Dict, Set
|
||||
)
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from types import TracebackType
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[bytes, str, os.PathLike]
|
||||
elif sys.version_info >= (3,):
|
||||
_Path = Union[bytes, str]
|
||||
else:
|
||||
_Path = Union[str, unicode]
|
||||
|
||||
# tar constants
|
||||
NUL: bytes
|
||||
BLOCKSIZE: int
|
||||
@@ -67,7 +58,7 @@ if sys.version_info < (3,):
|
||||
TAR_PLAIN: int
|
||||
TAR_GZIPPED: int
|
||||
|
||||
def open(name: Optional[_Path] = ..., mode: str = ...,
|
||||
def open(name: Optional[AnyPath] = ..., mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ..., bufsize: int = ...,
|
||||
*, format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ...,
|
||||
dereference: Optional[bool] = ...,
|
||||
@@ -79,7 +70,7 @@ def open(name: Optional[_Path] = ..., mode: str = ...,
|
||||
compresslevel: Optional[int] = ...) -> TarFile: ...
|
||||
|
||||
class TarFile(Iterable[TarInfo]):
|
||||
name: Optional[_Path]
|
||||
name: Optional[AnyPath]
|
||||
mode: str
|
||||
fileobj: Optional[IO[bytes]]
|
||||
format: Optional[int]
|
||||
@@ -93,7 +84,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
errorlevel: Optional[int]
|
||||
if sys.version_info < (3,):
|
||||
posix: bool
|
||||
def __init__(self, name: Optional[_Path] = ..., mode: str = ...,
|
||||
def __init__(self, name: Optional[AnyPath] = ..., mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ...,
|
||||
dereference: Optional[bool] = ...,
|
||||
@@ -110,7 +101,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
exc_tb: Optional[TracebackType]) -> None: ...
|
||||
def __iter__(self) -> Iterator[TarInfo]: ...
|
||||
@classmethod
|
||||
def open(cls, name: Optional[_Path] = ..., mode: str = ...,
|
||||
def open(cls, name: Optional[AnyPath] = ..., mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ..., bufsize: int = ...,
|
||||
*, format: Optional[int] = ..., tarinfo: Optional[TarInfo] = ...,
|
||||
dereference: Optional[bool] = ...,
|
||||
@@ -129,33 +120,33 @@ class TarFile(Iterable[TarInfo]):
|
||||
def list(self, verbose: bool = ...) -> None: ...
|
||||
def next(self) -> Optional[TarInfo]: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def extractall(self, path: _Path = ...,
|
||||
def extractall(self, path: AnyPath = ...,
|
||||
members: Optional[List[TarInfo]] = ...,
|
||||
*, numeric_owner: bool = ...) -> None: ...
|
||||
else:
|
||||
def extractall(self, path: _Path = ...,
|
||||
def extractall(self, path: AnyPath = ...,
|
||||
members: Optional[List[TarInfo]] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def extract(self, member: Union[str, TarInfo], path: _Path = ...,
|
||||
def extract(self, member: Union[str, TarInfo], path: AnyPath = ...,
|
||||
set_attrs: bool = ...,
|
||||
*, numeric_owner: bool = ...) -> None: ...
|
||||
else:
|
||||
def extract(self, member: Union[str, TarInfo],
|
||||
path: _Path = ...) -> None: ...
|
||||
path: AnyPath = ...) -> None: ...
|
||||
def extractfile(self,
|
||||
member: Union[str, TarInfo]) -> Optional[IO[bytes]]: ...
|
||||
def makedir(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
|
||||
def makefile(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
|
||||
def makeunknown(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
|
||||
def makefifo(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
|
||||
def makedev(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
|
||||
def makelink(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
|
||||
def makedir(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def makefile(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def makeunknown(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def makefifo(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def makedev(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def makelink(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
if sys.version_info >= (3, 5):
|
||||
def chown(self, tarinfo: TarInfo, targetpath: _Path, numeric_owner: bool) -> None: ... # undocumented
|
||||
def chown(self, tarinfo: TarInfo, targetpath: AnyPath, numeric_owner: bool) -> None: ... # undocumented
|
||||
else:
|
||||
def chown(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
|
||||
def chmod(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
|
||||
def utime(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
|
||||
def chown(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def chmod(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def utime(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
if sys.version_info >= (3, 7):
|
||||
def add(self, name: str, arcname: Optional[str] = ...,
|
||||
recursive: bool = ..., *,
|
||||
@@ -178,9 +169,9 @@ class TarFile(Iterable[TarInfo]):
|
||||
def close(self) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def is_tarfile(name: Union[_Path, IO[bytes]]) -> bool: ...
|
||||
def is_tarfile(name: Union[AnyPath, IO[bytes]]) -> bool: ...
|
||||
else:
|
||||
def is_tarfile(name: _Path) -> bool: ...
|
||||
def is_tarfile(name: AnyPath) -> bool: ...
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
def filemode(mode: int) -> str: ... # undocumented
|
||||
|
||||
@@ -1,27 +1,19 @@
|
||||
# Stubs for trace (Python 2 and 3)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
import types
|
||||
from typing import Any, Callable, Mapping, Optional, Sequence, Text, Tuple, TypeVar, Union
|
||||
from typing import Any, Callable, Mapping, Optional, Sequence, Tuple, TypeVar, Union
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_localtrace = Callable[[types.FrameType, str, Any], Callable[..., Any]]
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[Text, os.PathLike]
|
||||
else:
|
||||
_Path = Text
|
||||
|
||||
class CoverageResults:
|
||||
def update(self, other: CoverageResults) -> None: ...
|
||||
def write_results(self, show_missing: bool = ..., summary: bool = ..., coverdir: Optional[_Path] = ...) -> None: ...
|
||||
def write_results_file(self, path: _Path, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: Optional[str] = ...) -> Tuple[int, int]: ...
|
||||
def write_results(self, show_missing: bool = ..., summary: bool = ..., coverdir: Optional[StrPath] = ...) -> None: ...
|
||||
def write_results_file(self, path: StrPath, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: Optional[str] = ...) -> Tuple[int, int]: ...
|
||||
|
||||
class Trace:
|
||||
def __init__(self, count: int = ..., trace: int = ..., countfuncs: int = ..., countcallers: int = ...,
|
||||
ignoremods: Sequence[str] = ..., ignoredirs: Sequence[str] = ..., infile: Optional[_Path] = ...,
|
||||
outfile: Optional[_Path] = ..., timing: bool = ...) -> None: ...
|
||||
ignoremods: Sequence[str] = ..., ignoredirs: Sequence[str] = ..., infile: Optional[StrPath] = ...,
|
||||
outfile: Optional[StrPath] = ..., timing: bool = ...) -> None: ...
|
||||
def run(self, cmd: Union[str, types.CodeType]) -> None: ...
|
||||
def runctx(self, cmd: Union[str, types.CodeType], globals: Optional[Mapping[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> None: ...
|
||||
def runfunc(self, func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ...
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
# Stubs for zipfile
|
||||
|
||||
from _typeshed import StrPath
|
||||
from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Protocol, Text, Tuple, Type, Union, Sequence, Pattern
|
||||
from types import TracebackType
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[os.PathLike[str], str]
|
||||
else:
|
||||
_Path = Text
|
||||
_SZI = Union[Text, ZipInfo]
|
||||
_DT = Tuple[int, int, int, int, int, int]
|
||||
|
||||
@@ -72,7 +66,7 @@ class ZipFile:
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(
|
||||
self,
|
||||
file: Union[_Path, IO[bytes]],
|
||||
file: Union[StrPath, IO[bytes]],
|
||||
mode: str = ...,
|
||||
compression: int = ...,
|
||||
allowZip64: bool = ...,
|
||||
@@ -83,7 +77,7 @@ class ZipFile:
|
||||
elif sys.version_info >= (3, 7):
|
||||
def __init__(
|
||||
self,
|
||||
file: Union[_Path, IO[bytes]],
|
||||
file: Union[StrPath, IO[bytes]],
|
||||
mode: str = ...,
|
||||
compression: int = ...,
|
||||
allowZip64: bool = ...,
|
||||
@@ -91,7 +85,7 @@ class ZipFile:
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, file: Union[_Path, IO[bytes]], mode: Text = ..., compression: int = ..., allowZip64: bool = ...
|
||||
self, file: Union[StrPath, IO[bytes]], mode: Text = ..., compression: int = ..., allowZip64: bool = ...
|
||||
) -> None: ...
|
||||
def __enter__(self) -> ZipFile: ...
|
||||
def __exit__(
|
||||
@@ -104,7 +98,7 @@ class ZipFile:
|
||||
def open(self, name: _SZI, mode: Text = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
|
||||
def extract(self, member: _SZI, path: Optional[_SZI] = ..., pwd: Optional[bytes] = ...) -> str: ...
|
||||
def extractall(
|
||||
self, path: Optional[_Path] = ..., members: Optional[Iterable[Text]] = ..., pwd: Optional[bytes] = ...
|
||||
self, path: Optional[StrPath] = ..., members: Optional[Iterable[Text]] = ..., pwd: Optional[bytes] = ...
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3,):
|
||||
def printdir(self, file: Optional[_Writer] = ...) -> None: ...
|
||||
@@ -114,9 +108,9 @@ class ZipFile:
|
||||
def read(self, name: _SZI, pwd: Optional[bytes] = ...) -> bytes: ...
|
||||
def testzip(self) -> Optional[str]: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def write(self, filename: _Path, arcname: Optional[_Path] = ..., compress_type: Optional[int] = ..., compresslevel: Optional[int] = ...) -> None: ...
|
||||
def write(self, filename: StrPath, arcname: Optional[StrPath] = ..., compress_type: Optional[int] = ..., compresslevel: Optional[int] = ...) -> None: ...
|
||||
else:
|
||||
def write(self, filename: _Path, arcname: Optional[_Path] = ..., compress_type: Optional[int] = ...) -> None: ...
|
||||
def write(self, filename: StrPath, arcname: Optional[StrPath] = ..., compress_type: Optional[int] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def writestr(self, zinfo_or_arcname: _SZI, data: Union[bytes, str], compress_type: Optional[int] = ..., compresslevel: Optional[int] = ...) -> None: ...
|
||||
elif sys.version_info >= (3,):
|
||||
@@ -154,10 +148,10 @@ class ZipInfo:
|
||||
def __init__(self, filename: Optional[Text] = ..., date_time: Optional[_DT] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@classmethod
|
||||
def from_file(cls, filename: _Path, arcname: Optional[_Path] = ..., *, strict_timestamps: bool = ...) -> ZipInfo: ...
|
||||
def from_file(cls, filename: StrPath, arcname: Optional[StrPath] = ..., *, strict_timestamps: bool = ...) -> ZipInfo: ...
|
||||
elif sys.version_info >= (3, 6):
|
||||
@classmethod
|
||||
def from_file(cls, filename: _Path, arcname: Optional[_Path] = ...) -> ZipInfo: ...
|
||||
def from_file(cls, filename: StrPath, arcname: Optional[StrPath] = ...) -> ZipInfo: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def is_dir(self) -> bool: ...
|
||||
def FileHeader(self, zip64: Optional[bool] = ...) -> bytes: ...
|
||||
@@ -168,7 +162,7 @@ if sys.version_info >= (3, 8):
|
||||
def name(self) -> str: ...
|
||||
@property
|
||||
def parent(self) -> Path: ... # undocumented
|
||||
def __init__(self, root: Union[ZipFile, _Path, IO[bytes]], at: str = ...) -> None: ...
|
||||
def __init__(self, root: Union[ZipFile, StrPath, IO[bytes]], at: str = ...) -> None: ...
|
||||
def open(self, mode: str = ..., pwd: Optional[bytes] = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
|
||||
def iterdir(self) -> Iterator[Path]: ...
|
||||
def is_dir(self) -> bool: ...
|
||||
@@ -183,10 +177,10 @@ if sys.version_info >= (3, 8):
|
||||
write_through: bool = ...,
|
||||
) -> str: ...
|
||||
def read_bytes(self) -> bytes: ...
|
||||
def joinpath(self, add: _Path) -> Path: ... # undocumented
|
||||
def __truediv__(self, add: _Path) -> Path: ...
|
||||
def joinpath(self, add: StrPath) -> Path: ... # undocumented
|
||||
def __truediv__(self, add: StrPath) -> Path: ...
|
||||
|
||||
def is_zipfile(filename: Union[_Path, IO[bytes]]) -> bool: ...
|
||||
def is_zipfile(filename: Union[StrPath, IO[bytes]]) -> bool: ...
|
||||
|
||||
ZIP_STORED: int
|
||||
ZIP_DEFLATED: int
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
|
||||
import sys
|
||||
|
||||
from typing import List, Optional, Union
|
||||
from _typeshed import AnyPath
|
||||
from typing import List, Optional
|
||||
from types import FrameType
|
||||
from . import tasks
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike
|
||||
_PathType = Union[bytes, str, _PathLike]
|
||||
else:
|
||||
_PathType = Union[bytes, str]
|
||||
|
||||
def _task_repr_info(task: tasks.Task) -> List[str]: ... # undocumented
|
||||
def _task_get_stack(task: tasks.Task, limit: Optional[int]) -> List[FrameType]: ... # undocumented
|
||||
def _task_print_stack(task: tasks.Task, limit: Optional[int], file: _PathType): ... # undocumented
|
||||
def _task_print_stack(task: tasks.Task, limit: Optional[int], file: AnyPath): ... # undocumented
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
import sys
|
||||
from socket import socket
|
||||
from typing import Any, Mapping, Optional, Union
|
||||
from typing import Any, Mapping, Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from . import base_events, constants, events, futures, streams, transports
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from os import PathLike
|
||||
_Path = Union[str, PathLike[str]]
|
||||
else:
|
||||
_Path = str
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
|
||||
class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport):
|
||||
|
||||
def __init__(self, loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, waiter: Optional[futures.Future[Any]] = ..., extra: Optional[Mapping[Any, Any]] = ..., server: Optional[events.AbstractServer] = ...) -> None: ...
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
import selectors
|
||||
import sys
|
||||
from socket import socket
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Optional
|
||||
|
||||
from . import base_events, events
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from os import PathLike
|
||||
_Path = Union[str, PathLike[str]]
|
||||
else:
|
||||
_Path = str
|
||||
from . import base_events
|
||||
|
||||
class BaseSelectorEventLoop(base_events.BaseEventLoop):
|
||||
def __init__(self, selector: Optional[selectors.BaseSelector] = ...) -> None: ...
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
# Stubs for compileall (Python 3)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Optional, Union, Pattern
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Optional, Pattern
|
||||
|
||||
if sys.version_info < (3, 6):
|
||||
_Path = Union[str, bytes]
|
||||
_SuccessType = bool
|
||||
else:
|
||||
_Path = Union[str, bytes, os.PathLike]
|
||||
_SuccessType = int
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
@@ -16,9 +12,9 @@ if sys.version_info >= (3, 7):
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def compile_dir(
|
||||
dir: _Path,
|
||||
dir: AnyPath,
|
||||
maxlevels: Optional[int] = ...,
|
||||
ddir: Optional[_Path] = ...,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
@@ -27,13 +23,13 @@ if sys.version_info >= (3, 9):
|
||||
workers: int = ...,
|
||||
invalidation_mode: Optional[PycInvalidationMode] = ...,
|
||||
*,
|
||||
stripdir: Optional[str] = ..., # TODO: change to Optional[_Path] once https://bugs.python.org/issue40447 is resolved
|
||||
prependdir: Optional[_Path] = ...,
|
||||
limit_sl_dest: Optional[_Path] = ...,
|
||||
stripdir: Optional[str] = ..., # TODO: change to Optional[AnyPath] once https://bugs.python.org/issue40447 is resolved
|
||||
prependdir: Optional[AnyPath] = ...,
|
||||
limit_sl_dest: Optional[AnyPath] = ...,
|
||||
) -> _SuccessType: ...
|
||||
def compile_file(
|
||||
fullname: _Path,
|
||||
ddir: Optional[_Path] = ...,
|
||||
fullname: AnyPath,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
@@ -41,15 +37,15 @@ if sys.version_info >= (3, 9):
|
||||
optimize: int = ...,
|
||||
invalidation_mode: Optional[PycInvalidationMode] = ...,
|
||||
*,
|
||||
stripdir: Optional[str] = ..., # TODO: change to Optional[_Path] once https://bugs.python.org/issue40447 is resolved
|
||||
prependdir: Optional[_Path] = ...,
|
||||
limit_sl_dest: Optional[_Path] = ...,
|
||||
stripdir: Optional[str] = ..., # TODO: change to Optional[AnyPath] once https://bugs.python.org/issue40447 is resolved
|
||||
prependdir: Optional[AnyPath] = ...,
|
||||
limit_sl_dest: Optional[AnyPath] = ...,
|
||||
) -> _SuccessType: ...
|
||||
elif sys.version_info >= (3, 7):
|
||||
def compile_dir(
|
||||
dir: _Path,
|
||||
dir: AnyPath,
|
||||
maxlevels: int = ...,
|
||||
ddir: Optional[_Path] = ...,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
@@ -59,8 +55,8 @@ elif sys.version_info >= (3, 7):
|
||||
invalidation_mode: Optional[PycInvalidationMode] = ...,
|
||||
) -> _SuccessType: ...
|
||||
def compile_file(
|
||||
fullname: _Path,
|
||||
ddir: Optional[_Path] = ...,
|
||||
fullname: AnyPath,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
@@ -72,9 +68,9 @@ elif sys.version_info >= (3, 7):
|
||||
else:
|
||||
# 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 = ...,
|
||||
@@ -83,8 +79,8 @@ else:
|
||||
workers: int = ...,
|
||||
) -> _SuccessType: ...
|
||||
def compile_file(
|
||||
fullname: _Path,
|
||||
ddir: Optional[_Path] = ...,
|
||||
fullname: AnyPath,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
# Based on http://docs.python.org/3.5/library/configparser.html and on
|
||||
# reading configparser.py.
|
||||
|
||||
from _typeshed import AnyPath, StrPath
|
||||
import sys
|
||||
from typing import (AbstractSet, MutableMapping, Mapping, Dict, Sequence, List,
|
||||
Union, Iterable, Iterator, Callable, Any, IO, overload,
|
||||
Optional, Pattern, Type, TypeVar, ClassVar)
|
||||
# Types only used in type comments only
|
||||
from typing import Optional, Tuple # noqa
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
Optional, Pattern, Type, TypeVar, ClassVar, Tuple)
|
||||
|
||||
# Internal type aliases
|
||||
_section = Mapping[str, str]
|
||||
@@ -19,11 +12,9 @@ _converters = Dict[str, _converter]
|
||||
_T = TypeVar('_T')
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
_Path = Union[str, bytes, PathLike[str]]
|
||||
elif sys.version_info >= (3, 6):
|
||||
_Path = Union[str, PathLike[str]]
|
||||
_Path = AnyPath
|
||||
else:
|
||||
_Path = str
|
||||
_Path = StrPath
|
||||
|
||||
DEFAULTSECT: str
|
||||
MAX_INTERPOLATION_DEPTH: int
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
import sys
|
||||
from typing import overload, Any, Container, IO, Iterable, Optional, Sequence, Type, TypeVar, Union
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
_Path = Union[str, PathLike[str]]
|
||||
else:
|
||||
_Path = str
|
||||
from _typeshed import StrPath
|
||||
from typing_extensions import Literal
|
||||
|
||||
class NullTranslations:
|
||||
def __init__(self, fp: Optional[IO[str]] = ...) -> None: ...
|
||||
@@ -35,25 +26,25 @@ class GNUTranslations(NullTranslations):
|
||||
CONTEXT: str
|
||||
VERSIONS: Sequence[int]
|
||||
|
||||
def find(domain: str, localedir: Optional[_Path] = ..., languages: Optional[Iterable[str]] = ...,
|
||||
def find(domain: str, localedir: Optional[StrPath] = ..., languages: Optional[Iterable[str]] = ...,
|
||||
all: bool = ...) -> Any: ...
|
||||
|
||||
_T = TypeVar('_T')
|
||||
@overload
|
||||
def translation(domain: str, localedir: Optional[_Path] = ..., languages: Optional[Iterable[str]] = ...,
|
||||
def translation(domain: str, localedir: Optional[StrPath] = ..., languages: Optional[Iterable[str]] = ...,
|
||||
class_: None = ..., fallback: bool = ..., codeset: Optional[str] = ...) -> NullTranslations: ...
|
||||
@overload
|
||||
def translation(domain: str, localedir: Optional[_Path] = ..., languages: Optional[Iterable[str]] = ...,
|
||||
def translation(domain: str, localedir: Optional[StrPath] = ..., languages: Optional[Iterable[str]] = ...,
|
||||
class_: Type[_T] = ..., fallback: Literal[False] = ..., codeset: Optional[str] = ...) -> _T: ...
|
||||
@overload
|
||||
def translation(domain: str, localedir: Optional[_Path] = ..., languages: Optional[Iterable[str]] = ...,
|
||||
def translation(domain: str, localedir: Optional[StrPath] = ..., languages: Optional[Iterable[str]] = ...,
|
||||
class_: Type[_T] = ..., fallback: Literal[True] = ..., codeset: Optional[str] = ...) -> Any: ...
|
||||
|
||||
def install(domain: str, localedir: Optional[_Path] = ..., codeset: Optional[str] = ...,
|
||||
def install(domain: str, localedir: Optional[StrPath] = ..., codeset: Optional[str] = ...,
|
||||
names: Optional[Container[str]] = ...) -> None: ...
|
||||
|
||||
def textdomain(domain: Optional[str] = ...) -> str: ...
|
||||
def bindtextdomain(domain: str, localedir: Optional[_Path] = ...) -> str: ...
|
||||
def bindtextdomain(domain: str, localedir: Optional[StrPath] = ...) -> str: ...
|
||||
def bind_textdomain_codeset(domain: str, codeset: Optional[str] = ...) -> str: ...
|
||||
def dgettext(domain: str, message: str) -> str: ...
|
||||
def ldgettext(domain: str, message: str) -> str: ...
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
import sys
|
||||
import zlib
|
||||
from os.path import _PathType
|
||||
from typing import IO, Optional, TextIO, Union, overload
|
||||
|
||||
import _compression
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
from _typeshed import AnyPath
|
||||
from typing_extensions import Literal
|
||||
|
||||
_OpenBinaryMode = Literal["r", "rb", "a", "ab", "w", "wb", "x", "xb"]
|
||||
_OpenTextMode = Literal["rt", "at", "wt", "xt"]
|
||||
|
||||
@overload
|
||||
def open(
|
||||
filename: Union[_PathType, IO[bytes]],
|
||||
filename: Union[AnyPath, IO[bytes]],
|
||||
mode: _OpenBinaryMode = ...,
|
||||
compresslevel: int = ...,
|
||||
encoding: None = ...,
|
||||
@@ -24,7 +19,7 @@ def open(
|
||||
) -> GzipFile: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: _PathType,
|
||||
filename: AnyPath,
|
||||
mode: _OpenTextMode,
|
||||
compresslevel: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
@@ -33,7 +28,7 @@ def open(
|
||||
) -> TextIO: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: Union[_PathType, IO[bytes]],
|
||||
filename: Union[AnyPath, IO[bytes]],
|
||||
mode: str,
|
||||
compresslevel: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
@@ -57,7 +52,7 @@ class GzipFile(_compression.BaseStream):
|
||||
fileobj: IO[bytes]
|
||||
def __init__(
|
||||
self,
|
||||
filename: Optional[_PathType] = ...,
|
||||
filename: Optional[AnyPath] = ...,
|
||||
mode: Optional[str] = ...,
|
||||
compresslevel: int = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Stubs for imp (Python 3.6)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
import types
|
||||
from typing import Any, IO, List, Optional, Tuple, TypeVar, Union
|
||||
|
||||
@@ -13,11 +12,6 @@ from _imp import create_dynamic as create_dynamic
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[str, os.PathLike[str]]
|
||||
else:
|
||||
_Path = str
|
||||
|
||||
SEARCH_ERROR: int
|
||||
PY_SOURCE: int
|
||||
PY_COMPILED: int
|
||||
@@ -32,21 +26,21 @@ IMP_HOOK: int
|
||||
def new_module(name: str) -> types.ModuleType: ...
|
||||
def get_magic() -> bytes: ...
|
||||
def get_tag() -> str: ...
|
||||
def cache_from_source(path: _Path, debug_override: Optional[bool] = ...) -> str: ...
|
||||
def source_from_cache(path: _Path) -> str: ...
|
||||
def cache_from_source(path: StrPath, debug_override: Optional[bool] = ...) -> str: ...
|
||||
def source_from_cache(path: StrPath) -> str: ...
|
||||
def get_suffixes() -> List[Tuple[str, str, int]]: ...
|
||||
|
||||
class NullImporter:
|
||||
def __init__(self, path: _Path) -> None: ...
|
||||
def __init__(self, path: StrPath) -> None: ...
|
||||
def find_module(self, fullname: Any) -> None: ...
|
||||
|
||||
# PathLike doesn't work for the pathname argument here
|
||||
def load_source(name: str, pathname: str, file: Optional[IO[Any]] = ...) -> types.ModuleType: ...
|
||||
def load_compiled(name: str, pathname: str, file: Optional[IO[Any]] = ...) -> types.ModuleType: ...
|
||||
def load_package(name: str, path: _Path) -> types.ModuleType: ...
|
||||
def load_package(name: str, path: StrPath) -> types.ModuleType: ...
|
||||
def load_module(name: str, file: IO[Any], filename: str, details: Tuple[str, str, int]) -> types.ModuleType: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def find_module(name: str, path: Union[None, List[str], List[os.PathLike[str]], List[_Path]] = ...) -> Tuple[IO[Any], str, Tuple[str, str, int]]: ...
|
||||
def find_module(name: str, path: Union[None, List[str], List[os.PathLike[str]], List[StrPath]] = ...) -> Tuple[IO[Any], str, Tuple[str, str, int]]: ...
|
||||
else:
|
||||
def find_module(name: str, path: Optional[List[str]] = ...) -> Tuple[IO[Any], str, Tuple[str, str, int]]: ...
|
||||
def reload(module: types.ModuleType) -> types.ModuleType: ...
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
import io
|
||||
import sys
|
||||
from os.path import _PathType
|
||||
from typing import IO, Any, Mapping, Optional, Sequence, TextIO, TypeVar, Union, overload
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
from _typeshed import AnyPath
|
||||
from typing_extensions import Literal
|
||||
|
||||
_OpenBinaryWritingMode = Literal["w", "wb", "x", "xb", "a", "ab"]
|
||||
_OpenTextWritingMode = Literal["wt", "xt", "at"]
|
||||
|
||||
_PathOrFile = Union[_PathType, IO[bytes]]
|
||||
_PathOrFile = Union[AnyPath, IO[bytes]]
|
||||
|
||||
_FilterChain = Sequence[Mapping[str, Any]]
|
||||
_T = TypeVar("_T")
|
||||
@@ -125,7 +120,7 @@ def open(
|
||||
) -> LZMAFile: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: _PathType,
|
||||
filename: AnyPath,
|
||||
mode: Literal["rt"],
|
||||
*,
|
||||
format: Optional[int] = ...,
|
||||
@@ -138,7 +133,7 @@ def open(
|
||||
) -> TextIO: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: _PathType,
|
||||
filename: AnyPath,
|
||||
mode: _OpenTextWritingMode,
|
||||
*,
|
||||
format: Optional[int] = ...,
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
# Stubs for os
|
||||
# Ron Murawski <ron@horizonchess.com>
|
||||
|
||||
from io import TextIOWrapper as _TextIOWrapper
|
||||
from posix import listdir as listdir, times_result
|
||||
import sys
|
||||
from typing import (
|
||||
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterable, Iterator, NoReturn, overload, Union, AnyStr,
|
||||
Optional, Generic, Set, Callable, Text, Sequence, NamedTuple, TypeVar, ContextManager
|
||||
Optional, Generic, Set, Callable, Text, Sequence, NamedTuple, ContextManager, TypeVar
|
||||
)
|
||||
from _typeshed import AnyPath
|
||||
|
||||
# Re-exported names from other modules.
|
||||
from builtins import OSError as error
|
||||
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 -----
|
||||
|
||||
@@ -244,8 +245,7 @@ class stat_result:
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike as PathLike # See comment in builtins
|
||||
|
||||
_PathType = path._PathType
|
||||
_FdOrPathType = Union[int, _PathType]
|
||||
_FdOrAnyPath = Union[int, AnyPath]
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
class DirEntry(PathLike[AnyStr]):
|
||||
@@ -393,7 +393,7 @@ else:
|
||||
def fstat(fd: int) -> stat_result: ...
|
||||
def fsync(fd: int) -> None: ...
|
||||
def lseek(__fd: int, __position: int, __how: int) -> int: ...
|
||||
def open(path: _PathType, flags: int, mode: int = ..., *, dir_fd: Optional[int] = ...) -> int: ...
|
||||
def open(path: AnyPath, flags: int, mode: int = ..., *, dir_fd: Optional[int] = ...) -> int: ...
|
||||
def pipe() -> Tuple[int, int]: ...
|
||||
def read(__fd: int, __length: int) -> bytes: ...
|
||||
|
||||
@@ -440,59 +440,59 @@ if sys.platform != 'win32':
|
||||
def ttyname(__fd: int) -> str: ...
|
||||
def write(__fd: int, __data: bytes) -> int: ...
|
||||
def access(
|
||||
path: _FdOrPathType,
|
||||
path: _FdOrAnyPath,
|
||||
mode: int,
|
||||
*,
|
||||
dir_fd: Optional[int] = ...,
|
||||
effective_ids: bool = ...,
|
||||
follow_symlinks: bool = ...,
|
||||
) -> bool: ...
|
||||
def chdir(path: _FdOrPathType) -> None: ...
|
||||
def chdir(path: _FdOrAnyPath) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def fchdir(fd: int) -> None: ...
|
||||
def getcwd() -> str: ...
|
||||
def getcwdb() -> bytes: ...
|
||||
def chmod(path: _FdOrPathType, mode: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ...
|
||||
def chmod(path: _FdOrAnyPath, mode: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ...
|
||||
if sys.platform != 'win32':
|
||||
def chflags(path: _PathType, flags: int, follow_symlinks: bool = ...) -> None: ... # some flavors of Unix
|
||||
def chown(path: _FdOrPathType, uid: int, gid: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ... # Unix only
|
||||
def chflags(path: AnyPath, flags: int, follow_symlinks: bool = ...) -> None: ... # some flavors of Unix
|
||||
def chown(path: _FdOrAnyPath, uid: int, gid: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ... # Unix only
|
||||
if sys.platform != 'win32':
|
||||
# Unix only
|
||||
def chroot(path: _PathType) -> 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 chroot(path: AnyPath) -> 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 link(
|
||||
src: _PathType,
|
||||
dst: _PathType,
|
||||
src: AnyPath,
|
||||
dst: AnyPath,
|
||||
*,
|
||||
src_dir_fd: Optional[int] = ...,
|
||||
dst_dir_fd: Optional[int] = ...,
|
||||
follow_symlinks: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
def lstat(path: _PathType, *, dir_fd: Optional[int] = ...) -> stat_result: ...
|
||||
def mkdir(path: _PathType, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def lstat(path: AnyPath, *, dir_fd: Optional[int] = ...) -> stat_result: ...
|
||||
def mkdir(path: AnyPath, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
if sys.platform != 'win32':
|
||||
def mkfifo(path: _PathType, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... # Unix only
|
||||
def makedirs(name: _PathType, mode: int = ..., exist_ok: bool = ...) -> None: ...
|
||||
def mkfifo(path: AnyPath, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... # Unix only
|
||||
def makedirs(name: AnyPath, mode: int = ..., exist_ok: bool = ...) -> None: ...
|
||||
if sys.platform != "win32":
|
||||
def mknod(path: _PathType, mode: int = ..., device: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def mknod(path: AnyPath, mode: int = ..., device: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def major(__device: int) -> int: ...
|
||||
def minor(__device: int) -> int: ...
|
||||
def makedev(__major: int, __minor: int) -> int: ...
|
||||
def pathconf(path: _FdOrPathType, name: Union[str, int]) -> int: ... # Unix only
|
||||
def pathconf(path: _FdOrAnyPath, name: Union[str, int]) -> int: ... # Unix only
|
||||
if sys.version_info >= (3, 6):
|
||||
def readlink(path: Union[AnyStr, PathLike[AnyStr]], *, dir_fd: Optional[int] = ...) -> AnyStr: ...
|
||||
else:
|
||||
def readlink(path: AnyStr, *, dir_fd: Optional[int] = ...) -> AnyStr: ...
|
||||
def remove(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def removedirs(name: _PathType) -> None: ...
|
||||
def rename(src: _PathType, dst: _PathType, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ...
|
||||
def renames(old: _PathType, new: _PathType) -> None: ...
|
||||
def replace(src: _PathType, dst: _PathType, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ...
|
||||
def rmdir(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def remove(path: AnyPath, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def removedirs(name: AnyPath) -> None: ...
|
||||
def rename(src: AnyPath, dst: AnyPath, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ...
|
||||
def renames(old: AnyPath, new: AnyPath) -> None: ...
|
||||
def replace(src: AnyPath, dst: AnyPath, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ...
|
||||
def rmdir(path: AnyPath, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
class _ScandirIterator(Iterator[DirEntry[AnyStr]], ContextManager[_ScandirIterator[AnyStr]]):
|
||||
def __next__(self) -> DirEntry[AnyStr]: ...
|
||||
@@ -516,27 +516,27 @@ else:
|
||||
def scandir(path: None = ...) -> Iterator[DirEntry[str]]: ...
|
||||
@overload
|
||||
def scandir(path: AnyStr) -> Iterator[DirEntry[AnyStr]]: ...
|
||||
def stat(path: _FdOrPathType, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> stat_result: ...
|
||||
def stat(path: _FdOrAnyPath, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> stat_result: ...
|
||||
if sys.version_info < (3, 7):
|
||||
@overload
|
||||
def stat_float_times() -> bool: ...
|
||||
@overload
|
||||
def stat_float_times(__newvalue: bool) -> None: ...
|
||||
if sys.platform != 'win32':
|
||||
def statvfs(path: _FdOrPathType) -> statvfs_result: ... # Unix only
|
||||
def statvfs(path: _FdOrAnyPath) -> statvfs_result: ... # Unix only
|
||||
def symlink(
|
||||
src: _PathType,
|
||||
dst: _PathType,
|
||||
src: AnyPath,
|
||||
dst: AnyPath,
|
||||
target_is_directory: bool = ...,
|
||||
*,
|
||||
dir_fd: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
if sys.platform != 'win32':
|
||||
def sync() -> None: ... # Unix only
|
||||
def truncate(path: _FdOrPathType, length: int) -> None: ... # Unix only up to version 3.4
|
||||
def unlink(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def truncate(path: _FdOrAnyPath, length: int) -> None: ... # Unix only up to version 3.4
|
||||
def unlink(path: AnyPath, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def utime(
|
||||
path: _FdOrPathType,
|
||||
path: _FdOrAnyPath,
|
||||
times: Optional[Union[Tuple[int, int], Tuple[float, float]]] = ...,
|
||||
*,
|
||||
ns: Tuple[int, int] = ...,
|
||||
@@ -574,29 +574,29 @@ if sys.platform != 'win32':
|
||||
onerror: Optional[_OnError] = ..., *, follow_symlinks: bool = ...,
|
||||
dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ...
|
||||
if sys.platform == "linux":
|
||||
def getxattr(path: _FdOrPathType, attribute: _PathType, *, follow_symlinks: bool = ...) -> bytes: ...
|
||||
def listxattr(path: _FdOrPathType, *, follow_symlinks: bool = ...) -> List[str]: ...
|
||||
def removexattr(path: _FdOrPathType, attribute: _PathType, *, follow_symlinks: bool = ...) -> None: ...
|
||||
def setxattr(path: _FdOrPathType, attribute: _PathType, value: bytes, flags: int = ..., *,
|
||||
def getxattr(path: _FdOrAnyPath, attribute: AnyPath, *, follow_symlinks: bool = ...) -> bytes: ...
|
||||
def listxattr(path: _FdOrAnyPath, *, follow_symlinks: bool = ...) -> List[str]: ...
|
||||
def removexattr(path: _FdOrAnyPath, attribute: AnyPath, *, follow_symlinks: bool = ...) -> None: ...
|
||||
def setxattr(path: _FdOrAnyPath, attribute: AnyPath, value: bytes, flags: int = ..., *,
|
||||
follow_symlinks: bool = ...) -> None: ...
|
||||
|
||||
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]]]
|
||||
_ExecEnv = Union[Mapping[bytes, Union[bytes, str]], Mapping[str, Union[bytes, str]]]
|
||||
def execv(__path: _PathType, __argv: _ExecVArgs) -> NoReturn: ...
|
||||
def execve(path: _FdOrPathType, argv: _ExecVArgs, env: _ExecEnv) -> NoReturn: ...
|
||||
def execvp(file: _PathType, args: _ExecVArgs) -> NoReturn: ...
|
||||
def execvpe(file: _PathType, args: _ExecVArgs, env: _ExecEnv) -> NoReturn: ...
|
||||
def execv(__path: AnyPath, __argv: _ExecVArgs) -> NoReturn: ...
|
||||
def execve(path: _FdOrAnyPath, argv: _ExecVArgs, env: _ExecEnv) -> NoReturn: ...
|
||||
def execvp(file: AnyPath, args: _ExecVArgs) -> NoReturn: ...
|
||||
def execvpe(file: AnyPath, args: _ExecVArgs, env: _ExecEnv) -> NoReturn: ...
|
||||
|
||||
def _exit(status: int) -> NoReturn: ...
|
||||
def kill(__pid: int, __signal: int) -> None: ...
|
||||
@@ -613,29 +613,29 @@ class _wrap_close(_TextIOWrapper):
|
||||
def close(self) -> Optional[int]: ... # type: ignore
|
||||
def popen(cmd: str, mode: str = ..., buffering: int = ...) -> _wrap_close: ...
|
||||
|
||||
def spawnl(mode: int, file: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
|
||||
def spawnle(mode: int, file: _PathType, arg0: Union[bytes, Text],
|
||||
def spawnl(mode: int, file: AnyPath, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
|
||||
def spawnle(mode: int, file: AnyPath, arg0: Union[bytes, Text],
|
||||
*args: Any) -> int: ... # Imprecise sig
|
||||
if sys.platform != "win32":
|
||||
def spawnv(mode: int, file: _PathType, args: List[Union[bytes, Text]]) -> int: ...
|
||||
def spawnve(mode: int, file: _PathType, args: List[Union[bytes, Text]],
|
||||
def spawnv(mode: int, file: AnyPath, args: List[Union[bytes, Text]]) -> int: ...
|
||||
def spawnve(mode: int, file: AnyPath, args: List[Union[bytes, Text]],
|
||||
env: _ExecEnv) -> int: ...
|
||||
else:
|
||||
def spawnv(__mode: int, __path: _PathType, __argv: List[Union[bytes, Text]]) -> int: ...
|
||||
def spawnve(__mode: int, __path: _PathType, __argv: List[Union[bytes, Text]],
|
||||
def spawnv(__mode: int, __path: AnyPath, __argv: List[Union[bytes, Text]]) -> int: ...
|
||||
def spawnve(__mode: int, __path: AnyPath, __argv: List[Union[bytes, Text]],
|
||||
__env: _ExecEnv) -> int: ...
|
||||
def system(command: _PathType) -> int: ...
|
||||
def system(command: AnyPath) -> int: ...
|
||||
def times() -> times_result: ...
|
||||
def waitpid(__pid: int, __options: int) -> Tuple[int, int]: ...
|
||||
|
||||
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: _ExecEnv) -> 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: _ExecEnv) -> int: ...
|
||||
def wait() -> Tuple[int, int]: ... # Unix only
|
||||
from posix import waitid_result
|
||||
def waitid(idtype: int, ident: int, options: int) -> waitid_result: ...
|
||||
|
||||
@@ -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,14 +1,8 @@
|
||||
import sys
|
||||
|
||||
from typing import Optional, Sequence, Text, Union, AnyStr
|
||||
from _typeshed import AnyPath
|
||||
from typing import Optional, Sequence, Text
|
||||
from types import SimpleNamespace
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike
|
||||
_Path = Union[str, bytes, _PathLike[str], _PathLike[bytes]]
|
||||
else:
|
||||
_Path = Union[str, bytes]
|
||||
|
||||
class EnvBuilder:
|
||||
system_site_packages: bool
|
||||
clear: bool
|
||||
@@ -24,11 +18,11 @@ class EnvBuilder:
|
||||
def __init__(self, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., upgrade: bool = ..., with_pip: bool = ..., prompt: Optional[str] = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., upgrade: bool = ..., with_pip: bool = ...) -> None: ...
|
||||
def create(self, env_dir: _Path) -> None: ...
|
||||
def clear_directory(self, path: _Path) -> None: ... # undocumented
|
||||
def ensure_directories(self, env_dir: _Path) -> SimpleNamespace: ...
|
||||
def create(self, env_dir: AnyPath) -> None: ...
|
||||
def clear_directory(self, path: AnyPath) -> None: ... # undocumented
|
||||
def ensure_directories(self, env_dir: AnyPath) -> SimpleNamespace: ...
|
||||
def create_configuration(self, context: SimpleNamespace) -> None: ...
|
||||
def symlink_or_copy(self, src: _Path, dst: _Path, relative_symlinks_ok: bool = ...) -> None: ... # undocumented
|
||||
def symlink_or_copy(self, src: AnyPath, dst: AnyPath, relative_symlinks_ok: bool = ...) -> None: ... # undocumented
|
||||
def setup_python(self, context: SimpleNamespace) -> None: ...
|
||||
def _setup_pip(self, context: SimpleNamespace) -> None: ... # undocumented
|
||||
def setup_scripts(self, context: SimpleNamespace) -> None: ...
|
||||
@@ -39,10 +33,10 @@ class EnvBuilder:
|
||||
def upgrade_dependencies(self, context: SimpleNamespace) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def create(env_dir: _Path, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., with_pip: bool = ..., prompt: Optional[str] = ..., upgrade_deps: bool = ...) -> None: ...
|
||||
def create(env_dir: AnyPath, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., with_pip: bool = ..., prompt: Optional[str] = ..., upgrade_deps: bool = ...) -> None: ...
|
||||
elif sys.version_info >= (3, 6):
|
||||
def create(env_dir: _Path, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., with_pip: bool = ..., prompt: Optional[str] = ...) -> None: ...
|
||||
def create(env_dir: AnyPath, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., with_pip: bool = ..., prompt: Optional[str] = ...) -> None: ...
|
||||
else:
|
||||
def create(env_dir: _Path, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., with_pip: bool = ...) -> None: ...
|
||||
def create(env_dir: AnyPath, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., with_pip: bool = ...) -> None: ...
|
||||
|
||||
def main(args: Optional[Sequence[Text]] = ...) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user