mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-20 10:51:15 +08:00
AnyStr cleanup (#5487)
* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs. * Add StrOrBytesPath as preferred alias for AnyPath. * Replace all remaining AnyPath instances with StrOrBytesPath. * Mark AnyPath as obsolete. Part of #5470
This commit is contained in:
@@ -57,11 +57,12 @@ class SupportsItemAccess(SupportsGetItem[_KT_contra, _VT], Protocol[_KT_contra,
|
||||
def __setitem__(self, __k: _KT_contra, __v: _VT) -> None: ...
|
||||
def __delitem__(self, __v: _KT_contra) -> None: ...
|
||||
|
||||
# StrPath and AnyPath can be used in places where a
|
||||
# path can be used instead of a string, starting with Python 3.6.
|
||||
# These aliases can be used in places where a PathLike object can be used
|
||||
# instead of a string in Python 3.
|
||||
StrPath = Text
|
||||
BytesPath = bytes
|
||||
AnyPath = Union[Text, bytes]
|
||||
BytesPath = str
|
||||
StrOrBytesPath = Text
|
||||
AnyPath = StrOrBytesPath # obsolete, will be removed soon
|
||||
|
||||
OpenTextModeUpdating = Literal[
|
||||
"r+",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import io
|
||||
from _typeshed import AnyPath, ReadableBuffer, WriteableBuffer
|
||||
from typing import IO, Any, Iterable, List, Optional, TypeVar, Union
|
||||
from _typeshed import ReadableBuffer, WriteableBuffer
|
||||
from typing import IO, Any, Iterable, List, Optional, Text, TypeVar, Union
|
||||
from typing_extensions import SupportsIndex
|
||||
|
||||
_PathOrFile = Union[AnyPath, IO[bytes]]
|
||||
_PathOrFile = Union[Text, IO[bytes]]
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def compress(data: bytes, compresslevel: int = ...) -> bytes: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from _typeshed import AnyPath
|
||||
from types import CodeType
|
||||
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, Union
|
||||
from typing import Any, Callable, Dict, Optional, Text, Tuple, TypeVar, Union
|
||||
|
||||
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
def runctx(
|
||||
@@ -19,7 +18,7 @@ class Profile:
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def print_stats(self, sort: Union[str, int] = ...) -> None: ...
|
||||
def dump_stats(self, file: AnyPath) -> None: ...
|
||||
def dump_stats(self, file: Text) -> None: ...
|
||||
def create_stats(self) -> None: ...
|
||||
def snapshot_stats(self) -> None: ...
|
||||
def run(self: _SelfT, cmd: str) -> _SelfT: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from _typeshed import AnyPath
|
||||
from types import FrameType, TracebackType
|
||||
from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type
|
||||
from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type
|
||||
|
||||
_ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
|
||||
@@ -19,7 +18,7 @@ class Hook: # undocumented
|
||||
def __init__(
|
||||
self,
|
||||
display: int = ...,
|
||||
logdir: Optional[AnyPath] = ...,
|
||||
logdir: Optional[Text] = ...,
|
||||
context: int = ...,
|
||||
file: Optional[IO[str]] = ...,
|
||||
format: str = ...,
|
||||
@@ -30,4 +29,4 @@ class Hook: # undocumented
|
||||
def handle(self, info: Optional[_ExcInfo] = ...) -> None: ...
|
||||
|
||||
def handler(info: Optional[_ExcInfo] = ...) -> None: ...
|
||||
def enable(display: int = ..., logdir: Optional[AnyPath] = ..., context: int = ..., format: str = ...) -> None: ...
|
||||
def enable(display: int = ..., logdir: Optional[Text] = ..., context: int = ..., format: str = ...) -> None: ...
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Optional, Pattern
|
||||
from typing import Any, Optional, Pattern, Text
|
||||
|
||||
# rx can be any object with a 'search' method; once we have Protocols we can change the type
|
||||
def compile_dir(
|
||||
dir: AnyPath,
|
||||
dir: Text,
|
||||
maxlevels: int = ...,
|
||||
ddir: Optional[AnyPath] = ...,
|
||||
ddir: Optional[Text] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
) -> int: ...
|
||||
def compile_file(
|
||||
fullname: AnyPath, ddir: Optional[AnyPath] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...
|
||||
fullname: Text, ddir: Optional[Text] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...
|
||||
) -> int: ...
|
||||
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
from _typeshed import AnyPath
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Union
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Text, Union
|
||||
|
||||
def input(
|
||||
files: Union[AnyPath, Iterable[AnyPath], None] = ...,
|
||||
files: Union[Text, Iterable[Text], None] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
bufsize: int = ...,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
|
||||
openhook: Callable[[Text, str], IO[AnyStr]] = ...,
|
||||
) -> FileInput[AnyStr]: ...
|
||||
def close() -> None: ...
|
||||
def nextfile() -> None: ...
|
||||
@@ -21,12 +20,12 @@ def isstdin() -> bool: ...
|
||||
class FileInput(Iterable[AnyStr], Generic[AnyStr]):
|
||||
def __init__(
|
||||
self,
|
||||
files: Union[None, AnyPath, Iterable[AnyPath]] = ...,
|
||||
files: Union[None, Text, Iterable[Text]] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
bufsize: int = ...,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
|
||||
openhook: Callable[[Text, str], IO[AnyStr]] = ...,
|
||||
) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
@@ -42,5 +41,5 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
|
||||
def isfirstline(self) -> bool: ...
|
||||
def isstdin(self) -> bool: ...
|
||||
|
||||
def hook_compressed(filename: AnyPath, mode: str) -> IO[Any]: ...
|
||||
def hook_encoded(encoding: str) -> Callable[[AnyPath, str], IO[Any]]: ...
|
||||
def hook_compressed(filename: Text, mode: str) -> IO[Any]: ...
|
||||
def hook_encoded(encoding: str) -> Callable[[Text, str], IO[Any]]: ...
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
from _typeshed import AnyPath, BytesPath, StrPath, SupportsLessThanT
|
||||
from typing import List, Sequence, Tuple, Union, overload
|
||||
from _typeshed import SupportsLessThanT
|
||||
from typing import List, Sequence, Text, Tuple, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
# All overloads can return empty string. Ideally, Literal[""] would be a valid
|
||||
# Iterable[T], so that Union[List[T], Literal[""]] could be used as a return
|
||||
# type. But because this only works when T is str, we need Sequence[T] instead.
|
||||
@overload
|
||||
def commonprefix(m: Sequence[StrPath]) -> str: ... # type: ignore
|
||||
def commonprefix(m: Sequence[Text]) -> str: ... # type: ignore
|
||||
@overload
|
||||
def commonprefix(m: Sequence[BytesPath]) -> Union[bytes, Literal[""]]: ... # type: ignore
|
||||
def commonprefix(m: Sequence[str]) -> Union[str, Literal[""]]: ... # type: ignore
|
||||
@overload
|
||||
def commonprefix(m: Sequence[List[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ...
|
||||
@overload
|
||||
def commonprefix(m: Sequence[Tuple[SupportsLessThanT, ...]]) -> Sequence[SupportsLessThanT]: ...
|
||||
def exists(path: AnyPath) -> bool: ...
|
||||
def getsize(filename: AnyPath) -> int: ...
|
||||
def isfile(path: AnyPath) -> bool: ...
|
||||
def isdir(s: AnyPath) -> bool: ...
|
||||
def exists(path: Text) -> bool: ...
|
||||
def getsize(filename: Text) -> int: ...
|
||||
def isfile(path: Text) -> bool: ...
|
||||
def isdir(s: Text) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
def getatime(filename: Text) -> float: ...
|
||||
def getmtime(filename: Text) -> float: ...
|
||||
def getctime(filename: Text) -> float: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from _typeshed import AnyPath
|
||||
from genericpath import (
|
||||
commonprefix as commonprefix,
|
||||
exists as exists,
|
||||
@@ -37,7 +36,7 @@ def dirname(s: AnyStr) -> AnyStr: ...
|
||||
def normcase(path: AnyStr) -> AnyStr: ...
|
||||
def normpath(s: AnyStr) -> AnyStr: ...
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
def islink(s: AnyPath) -> bool: ...
|
||||
def islink(s: Text) -> bool: ...
|
||||
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
# (Since Python 2 allows that, too)
|
||||
@@ -46,11 +45,11 @@ def islink(s: AnyPath) -> bool: ...
|
||||
@overload
|
||||
def join(__p1: bytes, *p: bytes) -> bytes: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: Text, *p: Text) -> Text: ...
|
||||
def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import email.message
|
||||
from _typeshed import AnyPath
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
IO,
|
||||
@@ -40,7 +39,7 @@ class Mailbox(Generic[_MessageT]):
|
||||
|
||||
_path: Union[bytes, str] # undocumented
|
||||
_factory: Optional[Callable[[IO[Any]], _MessageT]] # undocumented
|
||||
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], _MessageT]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, path: Text, factory: Optional[Callable[[IO[Any]], _MessageT]] = ..., create: bool = ...) -> None: ...
|
||||
def add(self, message: _MessageData) -> str: ...
|
||||
def remove(self, key: str) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
@@ -81,7 +80,7 @@ class Maildir(Mailbox[MaildirMessage]):
|
||||
|
||||
colon: str
|
||||
def __init__(
|
||||
self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], MaildirMessage]] = ..., create: bool = ...
|
||||
self, dirname: Text, factory: Optional[Callable[[IO[Any]], MaildirMessage]] = ..., create: bool = ...
|
||||
) -> None: ...
|
||||
def get_file(self, key: str) -> _ProxyFile[bytes]: ...
|
||||
def list_folders(self) -> List[str]: ...
|
||||
@@ -99,24 +98,24 @@ class _mboxMMDF(_singlefileMailbox[_MessageT]):
|
||||
def get_string(self, key: str, from_: bool = ...) -> str: ...
|
||||
|
||||
class mbox(_mboxMMDF[mboxMessage]):
|
||||
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, path: Text, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...) -> None: ...
|
||||
|
||||
class MMDF(_mboxMMDF[MMDFMessage]):
|
||||
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], MMDFMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, path: Text, factory: Optional[Callable[[IO[Any]], MMDFMessage]] = ..., create: bool = ...) -> None: ...
|
||||
|
||||
class MH(Mailbox[MHMessage]):
|
||||
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], MHMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, path: Text, 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: AnyPath) -> MH: ...
|
||||
def add_folder(self, folder: AnyPath) -> MH: ...
|
||||
def remove_folder(self, folder: AnyPath) -> None: ...
|
||||
def get_folder(self, folder: Text) -> MH: ...
|
||||
def add_folder(self, folder: Text) -> MH: ...
|
||||
def remove_folder(self, folder: Text) -> 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, path: AnyPath, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(self, path: Text, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def get_file(self, key: str) -> IO[bytes]: ...
|
||||
def get_labels(self) -> List[str]: ...
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
from _typeshed import AnyPath
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
from typing import Dict, List, Optional, Text, Tuple
|
||||
|
||||
class NetrcParseError(Exception):
|
||||
filename: Optional[str]
|
||||
lineno: Optional[int]
|
||||
msg: str
|
||||
def __init__(self, msg: str, filename: Optional[AnyPath] = ..., lineno: Optional[int] = ...) -> None: ...
|
||||
def __init__(self, msg: str, filename: Optional[Text] = ..., lineno: Optional[int] = ...) -> None: ...
|
||||
|
||||
# (login, account, password) tuple
|
||||
_NetrcTuple = Tuple[str, Optional[str], Optional[str]]
|
||||
@@ -13,5 +12,5 @@ _NetrcTuple = Tuple[str, Optional[str], Optional[str]]
|
||||
class netrc:
|
||||
hosts: Dict[str, _NetrcTuple]
|
||||
macros: Dict[str, List[str]]
|
||||
def __init__(self, file: Optional[AnyPath] = ...) -> None: ...
|
||||
def __init__(self, file: Optional[Text] = ...) -> None: ...
|
||||
def authenticators(self, host: str) -> Optional[_NetrcTuple]: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import AnyPath, BytesPath, StrPath
|
||||
from genericpath import exists as exists
|
||||
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload
|
||||
|
||||
@@ -39,20 +38,20 @@ else:
|
||||
# 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[AnyPath]) -> Any: ...
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
def commonprefix(m: Sequence[Text]) -> Any: ...
|
||||
def lexists(path: Text) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
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: ...
|
||||
def getatime(filename: Text) -> float: ...
|
||||
def getmtime(filename: Text) -> float: ...
|
||||
def getctime(filename: Text) -> float: ...
|
||||
def getsize(filename: Text) -> int: ...
|
||||
def isabs(s: Text) -> bool: ...
|
||||
def isfile(path: Text) -> bool: ...
|
||||
def isdir(s: Text) -> bool: ...
|
||||
def islink(path: Text) -> bool: ...
|
||||
def ismount(path: Text) -> bool: ...
|
||||
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
# (Since Python 2 allows that, too)
|
||||
@@ -61,18 +60,18 @@ def ismount(path: AnyPath) -> bool: ...
|
||||
@overload
|
||||
def join(__p1: bytes, *p: bytes) -> bytes: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
|
||||
def relpath(path: str, start: Optional[str] = ...) -> str: ...
|
||||
@overload
|
||||
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
|
||||
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
|
||||
def relpath(path: Text, start: Optional[Text] = ...) -> Text: ...
|
||||
def samefile(f1: Text, f2: Text) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath, FileDescriptorLike
|
||||
from _typeshed import FileDescriptorLike
|
||||
from builtins import OSError
|
||||
from posix import listdir as listdir, stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
|
||||
from typing import (
|
||||
@@ -198,40 +198,40 @@ def dup2(fd: int, fd2: int) -> None: ...
|
||||
def fstat(fd: int) -> Any: ...
|
||||
def fsync(fd: FileDescriptorLike) -> None: ...
|
||||
def lseek(fd: int, pos: int, how: int) -> int: ...
|
||||
def open(file: AnyPath, flags: int, mode: int = ...) -> int: ...
|
||||
def open(file: Text, 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: AnyPath, mode: int) -> bool: ...
|
||||
def chdir(path: AnyPath) -> None: ...
|
||||
def access(path: Text, mode: int) -> bool: ...
|
||||
def chdir(path: Text) -> None: ...
|
||||
def fchdir(fd: FileDescriptorLike) -> None: ...
|
||||
def getcwd() -> str: ...
|
||||
def getcwdu() -> unicode: ...
|
||||
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 chmod(path: Text, mode: int) -> None: ...
|
||||
def link(src: Text, link_name: Text) -> None: ...
|
||||
def lstat(path: Text) -> Any: ...
|
||||
def mknod(filename: Text, 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: AnyPath, mode: int = ...) -> None: ...
|
||||
def makedirs(path: AnyPath, mode: int = ...) -> None: ...
|
||||
def mkdir(path: Text, mode: int = ...) -> None: ...
|
||||
def makedirs(path: Text, mode: int = ...) -> None: ...
|
||||
def readlink(path: AnyStr) -> AnyStr: ...
|
||||
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: ...
|
||||
def remove(path: Text) -> None: ...
|
||||
def removedirs(path: Text) -> None: ...
|
||||
def rename(src: Text, dst: Text) -> None: ...
|
||||
def renames(old: Text, new: Text) -> None: ...
|
||||
def rmdir(path: Text) -> None: ...
|
||||
def stat(path: Text) -> Any: ...
|
||||
@overload
|
||||
def stat_float_times() -> bool: ...
|
||||
@overload
|
||||
def stat_float_times(newvalue: bool) -> None: ...
|
||||
def symlink(source: AnyPath, link_name: AnyPath) -> None: ...
|
||||
def unlink(path: AnyPath) -> None: ...
|
||||
def symlink(source: Text, link_name: Text) -> None: ...
|
||||
def unlink(path: Text) -> None: ...
|
||||
|
||||
# TODO: add ns, dir_fd, follow_symlinks argument
|
||||
def utime(path: AnyPath, times: Optional[Tuple[float, float]]) -> None: ...
|
||||
def utime(path: Text, times: Optional[Tuple[float, float]]) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
# Unix only
|
||||
@@ -247,15 +247,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: 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: ...
|
||||
def chflags(path: Text, flags: int) -> None: ...
|
||||
def chroot(path: Text) -> None: ...
|
||||
def chown(path: Text, uid: int, gid: int) -> None: ...
|
||||
def lchflags(path: Text, flags: int) -> None: ...
|
||||
def lchmod(path: Text, mode: int) -> None: ...
|
||||
def lchown(path: Text, uid: int, gid: int) -> None: ...
|
||||
def mkfifo(path: Text, mode: int = ...) -> None: ...
|
||||
def pathconf(path: Text, name: Union[str, int]) -> int: ...
|
||||
def statvfs(path: Text) -> _StatVFS: ...
|
||||
|
||||
def walk(
|
||||
top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ..., followlinks: bool = ...
|
||||
@@ -263,21 +263,21 @@ def walk(
|
||||
def abort() -> NoReturn: ...
|
||||
|
||||
# These are defined as execl(file, *args) but the first *arg is mandatory.
|
||||
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: ...
|
||||
def execl(file: Text, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
|
||||
def execlp(file: Text, __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: AnyPath, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
|
||||
def execlpe(file: AnyPath, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
|
||||
def execle(file: Text, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
|
||||
def execlpe(file: Text, __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: 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 execv(path: Text, args: _ExecVArgs) -> NoReturn: ...
|
||||
def execve(path: Text, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
|
||||
def execvp(file: Text, args: _ExecVArgs) -> NoReturn: ...
|
||||
def execvpe(file: Text, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
|
||||
def _exit(n: int) -> NoReturn: ...
|
||||
def kill(pid: int, sig: int) -> None: ...
|
||||
|
||||
@@ -293,24 +293,24 @@ def popen(command: str, *args, **kwargs) -> IO[Any]: ...
|
||||
def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
|
||||
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: 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: 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: AnyPath) -> int: ...
|
||||
def spawnl(mode: int, path: Text, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
|
||||
def spawnle(mode: int, path: Text, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise sig
|
||||
def spawnv(mode: int, path: Text, args: List[Union[bytes, Text]]) -> int: ...
|
||||
def spawnve(mode: int, path: Text, args: List[Union[bytes, Text]], env: Mapping[str, str]) -> int: ...
|
||||
def system(command: Text) -> 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: AnyPath, operation: Optional[str] = ...) -> None: ...
|
||||
def startfile(path: Text, operation: Optional[str] = ...) -> None: ...
|
||||
|
||||
else:
|
||||
# Unix only
|
||||
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 spawnlp(mode: int, file: Text, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
|
||||
def spawnlpe(mode: int, file: Text, arg0: Union[bytes, Text], *args: Any) -> int: ... # Imprecise signature
|
||||
def spawnvp(mode: int, file: Text, args: List[Union[bytes, Text]]) -> int: ...
|
||||
def spawnvpe(mode: int, file: Text, 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,6 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import AnyPath, BytesPath, StrPath
|
||||
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
@@ -38,21 +37,21 @@ else:
|
||||
# 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[AnyPath]) -> Any: ...
|
||||
def exists(path: AnyPath) -> bool: ...
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
def commonprefix(m: Sequence[Text]) -> Any: ...
|
||||
def exists(path: Text) -> bool: ...
|
||||
def lexists(path: Text) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
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: ...
|
||||
def getatime(filename: Text) -> float: ...
|
||||
def getmtime(filename: Text) -> float: ...
|
||||
def getctime(filename: Text) -> float: ...
|
||||
def getsize(filename: Text) -> int: ...
|
||||
def isabs(s: Text) -> bool: ...
|
||||
def isfile(path: Text) -> bool: ...
|
||||
def isdir(s: Text) -> bool: ...
|
||||
def islink(path: Text) -> bool: ...
|
||||
def ismount(path: Text) -> bool: ...
|
||||
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
# (Since Python 2 allows that, too)
|
||||
@@ -61,18 +60,18 @@ def ismount(path: AnyPath) -> bool: ...
|
||||
@overload
|
||||
def join(__p1: bytes, *p: bytes) -> bytes: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
|
||||
def relpath(path: str, start: Optional[str] = ...) -> str: ...
|
||||
@overload
|
||||
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
|
||||
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
|
||||
def relpath(path: Text, start: Optional[Text] = ...) -> Text: ...
|
||||
def samefile(f1: Text, f2: Text) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import AnyPath, BytesPath, StrPath
|
||||
from genericpath import exists as exists
|
||||
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload
|
||||
|
||||
@@ -39,20 +38,20 @@ else:
|
||||
# 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[AnyPath]) -> Any: ...
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
def commonprefix(m: Sequence[Text]) -> Any: ...
|
||||
def lexists(path: Text) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
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: ...
|
||||
def getatime(filename: Text) -> float: ...
|
||||
def getmtime(filename: Text) -> float: ...
|
||||
def getctime(filename: Text) -> float: ...
|
||||
def getsize(filename: Text) -> int: ...
|
||||
def isabs(s: Text) -> bool: ...
|
||||
def isfile(path: Text) -> bool: ...
|
||||
def isdir(s: Text) -> bool: ...
|
||||
def islink(path: Text) -> bool: ...
|
||||
def ismount(path: Text) -> bool: ...
|
||||
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
# (Since Python 2 allows that, too)
|
||||
@@ -61,18 +60,18 @@ def ismount(path: AnyPath) -> bool: ...
|
||||
@overload
|
||||
def join(__p1: bytes, *p: bytes) -> bytes: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
|
||||
def relpath(path: str, start: Optional[str] = ...) -> str: ...
|
||||
@overload
|
||||
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
|
||||
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
|
||||
def relpath(path: Text, start: Optional[Text] = ...) -> Text: ...
|
||||
def samefile(f1: Text, f2: Text) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from _typeshed import AnyPath
|
||||
from types import CodeType
|
||||
from typing import Any, List, Sequence, Text, Tuple
|
||||
|
||||
@@ -8,14 +7,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: AnyPath = ...) -> CodeType: ...
|
||||
def compilest(st: STType, filename: Text = ...) -> CodeType: ...
|
||||
def isexpr(st: STType) -> bool: ...
|
||||
def issuite(st: STType) -> bool: ...
|
||||
|
||||
class ParserError(Exception): ...
|
||||
|
||||
class STType:
|
||||
def compile(self, filename: AnyPath = ...) -> CodeType: ...
|
||||
def compile(self, filename: Text = ...) -> CodeType: ...
|
||||
def isexpr(self) -> bool: ...
|
||||
def issuite(self) -> bool: ...
|
||||
def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import AnyPath, BytesPath, StrPath
|
||||
from genericpath import exists as exists
|
||||
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload
|
||||
|
||||
@@ -39,20 +38,20 @@ else:
|
||||
# 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[AnyPath]) -> Any: ...
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
def commonprefix(m: Sequence[Text]) -> Any: ...
|
||||
def lexists(path: Text) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
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: ...
|
||||
def getatime(filename: Text) -> float: ...
|
||||
def getmtime(filename: Text) -> float: ...
|
||||
def getctime(filename: Text) -> float: ...
|
||||
def getsize(filename: Text) -> int: ...
|
||||
def isabs(s: Text) -> bool: ...
|
||||
def isfile(path: Text) -> bool: ...
|
||||
def isdir(s: Text) -> bool: ...
|
||||
def islink(path: Text) -> bool: ...
|
||||
def ismount(path: Text) -> bool: ...
|
||||
|
||||
# Make sure signatures are disjunct, and allow combinations of bytes and unicode.
|
||||
# (Since Python 2 allows that, too)
|
||||
@@ -61,18 +60,18 @@ def ismount(path: AnyPath) -> bool: ...
|
||||
@overload
|
||||
def join(__p1: bytes, *p: bytes) -> bytes: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: bytes, __p4: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: bytes, __p3: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: bytes, __p2: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def join(__p1: Text, *p: AnyPath) -> Text: ...
|
||||
def join(__p1: Text, *p: Text) -> Text: ...
|
||||
@overload
|
||||
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
|
||||
def relpath(path: str, start: Optional[str] = ...) -> str: ...
|
||||
@overload
|
||||
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
|
||||
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
|
||||
def relpath(path: Text, start: Optional[Text] = ...) -> Text: ...
|
||||
def samefile(f1: Text, f2: Text) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
|
||||
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from _typeshed import AnyPath
|
||||
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, Union
|
||||
from typing import Any, Callable, Dict, Optional, Text, Tuple, TypeVar, Union
|
||||
|
||||
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
def runctx(
|
||||
@@ -18,7 +17,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: AnyPath) -> None: ...
|
||||
def dump_stats(self, file: Text) -> None: ...
|
||||
def create_stats(self) -> None: ...
|
||||
def snapshot_stats(self) -> None: ...
|
||||
def run(self: _SelfT, cmd: str) -> _SelfT: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from _typeshed import AnyPath
|
||||
from cProfile import Profile as _cProfile
|
||||
from profile import Profile
|
||||
from typing import IO, Any, Dict, Iterable, List, Optional, Text, Tuple, TypeVar, Union, overload
|
||||
@@ -18,7 +17,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: AnyPath) -> None: ...
|
||||
def dump_stats(self, filename: Text) -> None: ...
|
||||
def get_sort_arg_defs(self) -> Dict[str, Tuple[Tuple[Tuple[int, int], ...], str]]: ...
|
||||
@overload
|
||||
def sort_stats(self: _T, field: int) -> _T: ...
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
from _typeshed import AnyPath
|
||||
from typing import Callable, Optional, Sequence
|
||||
from typing import Callable, Optional, Sequence, Text
|
||||
|
||||
_CompleterT = Optional[Callable[[str, int], Optional[str]]]
|
||||
_CompDispT = Optional[Callable[[str, Sequence[str], int], None]]
|
||||
|
||||
def parse_and_bind(__string: str) -> None: ...
|
||||
def read_init_file(__filename: Optional[AnyPath] = ...) -> None: ...
|
||||
def read_init_file(__filename: Optional[Text] = ...) -> None: ...
|
||||
def get_line_buffer() -> str: ...
|
||||
def insert_text(__string: str) -> None: ...
|
||||
def redisplay() -> None: ...
|
||||
def read_history_file(__filename: Optional[AnyPath] = ...) -> None: ...
|
||||
def write_history_file(__filename: Optional[AnyPath] = ...) -> None: ...
|
||||
def read_history_file(__filename: Optional[Text] = ...) -> None: ...
|
||||
def write_history_file(__filename: Optional[Text] = ...) -> None: ...
|
||||
def get_history_length() -> int: ...
|
||||
def set_history_length(__length: int) -> None: ...
|
||||
def clear_history() -> None: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import StrPath, SupportsRead, SupportsWrite
|
||||
from typing import Any, AnyStr, Callable, Iterable, List, Optional, Sequence, Set, Tuple, Type, TypeVar, Union
|
||||
from _typeshed import SupportsRead, SupportsWrite
|
||||
from typing import Any, AnyStr, Callable, Iterable, List, Optional, Sequence, Set, Text, Tuple, Type, TypeVar, Union
|
||||
|
||||
_AnyStr = TypeVar("_AnyStr", str, unicode)
|
||||
_AnyPath = TypeVar("_AnyPath", str, unicode)
|
||||
@@ -10,25 +10,25 @@ class SpecialFileError(EnvironmentError): ...
|
||||
class ExecError(EnvironmentError): ...
|
||||
|
||||
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ...
|
||||
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: StrPath) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
|
||||
def copyfile(src: Text, dst: Text) -> None: ...
|
||||
def copymode(src: Text, dst: Text) -> None: ...
|
||||
def copystat(src: Text, dst: Text) -> None: ...
|
||||
def copy(src: Text, dst: Text) -> _PathReturn: ...
|
||||
def copy2(src: Text, dst: Text) -> _PathReturn: ...
|
||||
def ignore_patterns(*patterns: Text) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
|
||||
def copytree(
|
||||
src: AnyStr, dst: AnyStr, symlinks: bool = ..., ignore: Union[None, Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]]] = ...
|
||||
) -> _PathReturn: ...
|
||||
def rmtree(path: _AnyPath, ignore_errors: bool = ..., onerror: Optional[Callable[[Any, _AnyPath, Any], Any]] = ...) -> None: ...
|
||||
|
||||
_CopyFn = Union[Callable[[str, str], None], Callable[[StrPath, StrPath], None]]
|
||||
_CopyFn = Union[Callable[[str, str], None], Callable[[Text, Text], None]]
|
||||
|
||||
def move(src: StrPath, dst: StrPath) -> _PathReturn: ...
|
||||
def move(src: Text, dst: Text) -> _PathReturn: ...
|
||||
def make_archive(
|
||||
base_name: _AnyStr,
|
||||
format: str,
|
||||
root_dir: Optional[StrPath] = ...,
|
||||
base_dir: Optional[StrPath] = ...,
|
||||
root_dir: Optional[Text] = ...,
|
||||
base_dir: Optional[Text] = ...,
|
||||
verbose: bool = ...,
|
||||
dry_run: bool = ...,
|
||||
owner: Optional[str] = ...,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from _typeshed import AnyPath
|
||||
from typing import Optional, Tuple, Union
|
||||
from typing import Optional, Text, Tuple, Union
|
||||
|
||||
_SndHeaders = Tuple[str, int, int, int, Union[int, str]]
|
||||
|
||||
def what(filename: AnyPath) -> Optional[_SndHeaders]: ...
|
||||
def whathdr(filename: AnyPath) -> Optional[_SndHeaders]: ...
|
||||
def what(filename: Text) -> Optional[_SndHeaders]: ...
|
||||
def whathdr(filename: Text) -> Optional[_SndHeaders]: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from _typeshed import AnyPath
|
||||
from typing import Iterable, Tuple
|
||||
from typing import Iterable, Text, Tuple
|
||||
|
||||
verbose: int
|
||||
filename_only: int
|
||||
@@ -10,5 +9,5 @@ class NannyNag(Exception):
|
||||
def get_msg(self) -> str: ...
|
||||
def get_line(self) -> str: ...
|
||||
|
||||
def check(file: AnyPath) -> None: ...
|
||||
def check(file: Text) -> None: ...
|
||||
def process_tokens(tokens: Iterable[Tuple[int, str, Tuple[int, int], Tuple[int, int], str]]) -> None: ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import io
|
||||
from _typeshed import AnyPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, Type, Union
|
||||
from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Text, Tuple, Type, Union
|
||||
|
||||
# tar constants
|
||||
NUL: bytes
|
||||
@@ -51,7 +50,7 @@ TAR_PLAIN: int
|
||||
TAR_GZIPPED: int
|
||||
|
||||
def open(
|
||||
name: Optional[AnyPath] = ...,
|
||||
name: Optional[Text] = ...,
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
bufsize: int = ...,
|
||||
@@ -73,7 +72,7 @@ class ExFileObject(io.BufferedReader):
|
||||
|
||||
class TarFile(Iterable[TarInfo]):
|
||||
OPEN_METH: Mapping[str, str]
|
||||
name: Optional[AnyPath]
|
||||
name: Optional[Text]
|
||||
mode: str
|
||||
fileobj: Optional[IO[bytes]]
|
||||
format: Optional[int]
|
||||
@@ -90,7 +89,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
posix: bool
|
||||
def __init__(
|
||||
self,
|
||||
name: Optional[AnyPath] = ...,
|
||||
name: Optional[Text] = ...,
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
format: Optional[int] = ...,
|
||||
@@ -112,7 +111,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
@classmethod
|
||||
def open(
|
||||
cls,
|
||||
name: Optional[AnyPath] = ...,
|
||||
name: Optional[Text] = ...,
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
bufsize: int = ...,
|
||||
@@ -130,7 +129,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
@classmethod
|
||||
def taropen(
|
||||
cls,
|
||||
name: Optional[AnyPath],
|
||||
name: Optional[Text],
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
*,
|
||||
@@ -147,7 +146,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
@classmethod
|
||||
def gzopen(
|
||||
cls,
|
||||
name: Optional[AnyPath],
|
||||
name: Optional[Text],
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
compresslevel: int = ...,
|
||||
@@ -164,7 +163,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
@classmethod
|
||||
def bz2open(
|
||||
cls,
|
||||
name: Optional[AnyPath],
|
||||
name: Optional[Text],
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
compresslevel: int = ...,
|
||||
@@ -181,7 +180,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
@classmethod
|
||||
def xzopen(
|
||||
cls,
|
||||
name: Optional[AnyPath],
|
||||
name: Optional[Text],
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
preset: Optional[int] = ...,
|
||||
@@ -200,18 +199,18 @@ class TarFile(Iterable[TarInfo]):
|
||||
def getnames(self) -> List[str]: ...
|
||||
def list(self, verbose: bool = ...) -> None: ...
|
||||
def next(self) -> Optional[TarInfo]: ...
|
||||
def extractall(self, path: AnyPath = ..., members: Optional[Iterable[TarInfo]] = ...) -> None: ...
|
||||
def extract(self, member: Union[str, TarInfo], path: AnyPath = ...) -> None: ...
|
||||
def extractall(self, path: Text = ..., members: Optional[Iterable[TarInfo]] = ...) -> None: ...
|
||||
def extract(self, member: Union[str, TarInfo], path: Text = ...) -> None: ...
|
||||
def extractfile(self, member: Union[str, TarInfo]) -> Optional[IO[bytes]]: ...
|
||||
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
|
||||
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
|
||||
def makedir(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
|
||||
def makefile(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
|
||||
def makeunknown(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
|
||||
def makefifo(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
|
||||
def makedev(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
|
||||
def makelink(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
|
||||
def chown(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
|
||||
def chmod(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
|
||||
def utime(self, tarinfo: TarInfo, targetpath: Text) -> None: ... # undocumented
|
||||
def add(
|
||||
self,
|
||||
name: str,
|
||||
@@ -226,7 +225,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
) -> TarInfo: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
def is_tarfile(name: AnyPath) -> bool: ...
|
||||
def is_tarfile(name: Text) -> bool: ...
|
||||
def filemode(mode: int) -> str: ... # undocumented
|
||||
|
||||
class TarFileCompat:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import AnyPath, FileDescriptor
|
||||
from _typeshed import FileDescriptor
|
||||
from typing import (
|
||||
IO,
|
||||
Any,
|
||||
@@ -50,7 +50,7 @@ _str_argument_type = Union[str, Text]
|
||||
# _fixtext function in the source). Client code knows best:
|
||||
_str_result_type = Any
|
||||
|
||||
_file_or_filename = Union[AnyPath, FileDescriptor, IO[Any]]
|
||||
_file_or_filename = Union[Text, FileDescriptor, IO[Any]]
|
||||
|
||||
class Element(MutableSequence[Element]):
|
||||
tag: _str_result_type
|
||||
|
||||
@@ -58,11 +58,11 @@ class SupportsItemAccess(SupportsGetItem[_KT_contra, _VT], Protocol[_KT_contra,
|
||||
def __setitem__(self, __k: _KT_contra, __v: _VT) -> None: ...
|
||||
def __delitem__(self, __v: _KT_contra) -> None: ...
|
||||
|
||||
# StrPath and AnyPath can be used in places where a
|
||||
# path can be used instead of a string, starting with Python 3.6.
|
||||
# These aliases are simple strings in Python 2.
|
||||
StrPath = Union[str, PathLike[str]]
|
||||
BytesPath = Union[bytes, PathLike[bytes]]
|
||||
AnyPath = Union[str, bytes, PathLike[str], PathLike[bytes]]
|
||||
StrOrBytesPath = Union[str, bytes, PathLike[str], PathLike[bytes]]
|
||||
AnyPath = StrOrBytesPath # obsolete, will be removed soon
|
||||
|
||||
OpenTextModeUpdating = Literal[
|
||||
"r+",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from types import FrameType
|
||||
from typing import Any, List, Optional
|
||||
|
||||
@@ -6,4 +6,4 @@ from . import tasks
|
||||
|
||||
def _task_repr_info(task: tasks.Task[Any]) -> List[str]: ... # undocumented
|
||||
def _task_get_stack(task: tasks.Task[Any], limit: Optional[int]) -> List[FrameType]: ... # undocumented
|
||||
def _task_print_stack(task: tasks.Task[Any], limit: Optional[int], file: AnyPath) -> None: ... # undocumented
|
||||
def _task_print_stack(task: tasks.Task[Any], limit: Optional[int], file: StrOrBytesPath) -> None: ... # undocumented
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import subprocess
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from asyncio import events, protocols, streams, transports
|
||||
from typing import IO, Any, Callable, Optional, Tuple, Union
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
_ExecArg = AnyPath
|
||||
_ExecArg = StrOrBytesPath
|
||||
else:
|
||||
_ExecArg = Union[str, bytes]
|
||||
|
||||
@@ -56,10 +56,10 @@ if sys.version_info >= (3, 10):
|
||||
errors: None = ...,
|
||||
text: Literal[False, None] = ...,
|
||||
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[subprocess._ENV] = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
creationflags: int = ...,
|
||||
@@ -82,10 +82,10 @@ if sys.version_info >= (3, 10):
|
||||
errors: None = ...,
|
||||
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
|
||||
text: Optional[bool] = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[subprocess._ENV] = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
creationflags: int = ...,
|
||||
@@ -111,10 +111,10 @@ else:
|
||||
errors: None = ...,
|
||||
text: Literal[False, None] = ...,
|
||||
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[subprocess._ENV] = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
creationflags: int = ...,
|
||||
@@ -138,10 +138,10 @@ else:
|
||||
errors: None = ...,
|
||||
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
|
||||
text: Optional[bool] = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[subprocess._ENV] = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
creationflags: int = ...,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import sys
|
||||
import types
|
||||
from _typeshed import (
|
||||
AnyPath,
|
||||
OpenBinaryMode,
|
||||
OpenBinaryModeReading,
|
||||
OpenBinaryModeUpdating,
|
||||
OpenBinaryModeWriting,
|
||||
OpenTextMode,
|
||||
ReadableBuffer,
|
||||
StrOrBytesPath,
|
||||
SupportsDivMod,
|
||||
SupportsKeysAndGetItem,
|
||||
SupportsLessThan,
|
||||
@@ -1115,7 +1115,7 @@ def next(__i: Iterator[_T]) -> _T: ...
|
||||
def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
|
||||
def oct(__number: Union[int, SupportsIndex]) -> str: ...
|
||||
|
||||
_OpenFile = Union[AnyPath, int]
|
||||
_OpenFile = Union[StrOrBytesPath, int]
|
||||
_Opener = Callable[[str, int], int]
|
||||
|
||||
# Text mode: always returns a TextIOWrapper
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import io
|
||||
import sys
|
||||
from _typeshed import AnyPath, ReadableBuffer, WriteableBuffer
|
||||
from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer
|
||||
from typing import IO, Any, Iterable, List, Optional, TextIO, TypeVar, Union, overload
|
||||
from typing_extensions import Literal, SupportsIndex
|
||||
|
||||
_PathOrFile = Union[AnyPath, IO[bytes]]
|
||||
_PathOrFile = Union[StrOrBytesPath, IO[bytes]]
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def compress(data: bytes, compresslevel: int = ...) -> bytes: ...
|
||||
@@ -24,7 +24,7 @@ def open(
|
||||
) -> BZ2File: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: AnyPath,
|
||||
filename: StrOrBytesPath,
|
||||
mode: _OpenTextMode,
|
||||
compresslevel: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from types import CodeType
|
||||
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, Union
|
||||
|
||||
@@ -20,7 +20,7 @@ class Profile:
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def print_stats(self, sort: Union[str, int] = ...) -> None: ...
|
||||
def dump_stats(self, file: AnyPath) -> None: ...
|
||||
def dump_stats(self, file: StrOrBytesPath) -> None: ...
|
||||
def create_stats(self) -> None: ...
|
||||
def snapshot_stats(self) -> None: ...
|
||||
def run(self: _SelfT, cmd: str) -> _SelfT: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from types import FrameType, TracebackType
|
||||
from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type
|
||||
|
||||
@@ -19,7 +19,7 @@ class Hook: # undocumented
|
||||
def __init__(
|
||||
self,
|
||||
display: int = ...,
|
||||
logdir: Optional[AnyPath] = ...,
|
||||
logdir: Optional[StrOrBytesPath] = ...,
|
||||
context: int = ...,
|
||||
file: Optional[IO[str]] = ...,
|
||||
format: str = ...,
|
||||
@@ -30,4 +30,4 @@ class Hook: # undocumented
|
||||
def handle(self, info: Optional[_ExcInfo] = ...) -> None: ...
|
||||
|
||||
def handler(info: Optional[_ExcInfo] = ...) -> None: ...
|
||||
def enable(display: int = ..., logdir: Optional[AnyPath] = ..., context: int = ..., format: str = ...) -> None: ...
|
||||
def enable(display: int = ..., logdir: Optional[StrOrBytesPath] = ..., context: int = ..., format: str = ...) -> None: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath, StrPath, SupportsWrite
|
||||
from _typeshed import StrOrBytesPath, StrPath, SupportsWrite
|
||||
from typing import (
|
||||
AbstractSet,
|
||||
Any,
|
||||
@@ -30,7 +30,7 @@ _converters = Dict[str, _converter]
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
_Path = AnyPath
|
||||
_Path = StrOrBytesPath
|
||||
else:
|
||||
_Path = StrPath
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from _typeshed import AnyPath, SupportsWrite
|
||||
from _typeshed import StrOrBytesPath, SupportsWrite
|
||||
from distutils.cmd import Command
|
||||
from typing import IO, Any, Dict, Iterable, List, Mapping, Optional, Tuple, Type, Union
|
||||
|
||||
class DistributionMetadata:
|
||||
def __init__(self, path: Optional[Union[int, AnyPath]] = ...) -> None: ...
|
||||
def __init__(self, path: Optional[Union[int, StrOrBytesPath]] = ...) -> None: ...
|
||||
name: Optional[str]
|
||||
version: Optional[str]
|
||||
author: Optional[str]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from os import PathLike
|
||||
from typing import Any, AnyStr, Callable, Dict, Generic, Iterable, List, Optional, Sequence, Tuple, Union
|
||||
|
||||
@@ -8,7 +8,7 @@ if sys.version_info >= (3, 9):
|
||||
|
||||
DEFAULT_IGNORES: List[str]
|
||||
|
||||
def cmp(f1: AnyPath, f2: AnyPath, shallow: Union[int, bool] = ...) -> bool: ...
|
||||
def cmp(f1: StrOrBytesPath, f2: StrOrBytesPath, shallow: Union[int, bool] = ...) -> bool: ...
|
||||
def cmpfiles(
|
||||
a: Union[AnyStr, PathLike[AnyStr]],
|
||||
b: Union[AnyStr, PathLike[AnyStr]],
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Optional, Union
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def input(
|
||||
files: Union[AnyPath, Iterable[AnyPath], None] = ...,
|
||||
files: Union[StrOrBytesPath, Iterable[StrOrBytesPath], None] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
*,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
|
||||
openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
|
||||
) -> FileInput[AnyStr]: ...
|
||||
|
||||
else:
|
||||
def input(
|
||||
files: Union[AnyPath, Iterable[AnyPath], None] = ...,
|
||||
files: Union[StrOrBytesPath, Iterable[StrOrBytesPath], None] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
bufsize: int = ...,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
|
||||
openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
|
||||
) -> FileInput[AnyStr]: ...
|
||||
|
||||
def close() -> None: ...
|
||||
@@ -35,22 +35,22 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
|
||||
if sys.version_info >= (3, 8):
|
||||
def __init__(
|
||||
self,
|
||||
files: Union[None, AnyPath, Iterable[AnyPath]] = ...,
|
||||
files: Union[None, StrOrBytesPath, Iterable[StrOrBytesPath]] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
*,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
|
||||
openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
files: Union[None, AnyPath, Iterable[AnyPath]] = ...,
|
||||
files: Union[None, StrOrBytesPath, Iterable[StrOrBytesPath]] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
bufsize: int = ...,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
|
||||
openhook: Callable[[StrOrBytesPath, str], IO[AnyStr]] = ...,
|
||||
) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
@@ -68,5 +68,5 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
|
||||
def isfirstline(self) -> bool: ...
|
||||
def isstdin(self) -> bool: ...
|
||||
|
||||
def hook_compressed(filename: AnyPath, mode: str) -> IO[Any]: ...
|
||||
def hook_encoded(encoding: str, errors: Optional[str] = ...) -> Callable[[AnyPath, str], IO[Any]]: ...
|
||||
def hook_compressed(filename: StrOrBytesPath, mode: str) -> IO[Any]: ...
|
||||
def hook_encoded(encoding: str, errors: Optional[str] = ...) -> Callable[[StrOrBytesPath, str], IO[Any]]: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import os
|
||||
from _typeshed import AnyPath, BytesPath, StrPath, SupportsLessThanT
|
||||
from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsLessThanT
|
||||
from typing import List, Sequence, Tuple, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
@@ -14,16 +14,16 @@ def commonprefix(m: Sequence[BytesPath]) -> Union[bytes, Literal[""]]: ...
|
||||
def commonprefix(m: Sequence[List[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ...
|
||||
@overload
|
||||
def commonprefix(m: Sequence[Tuple[SupportsLessThanT, ...]]) -> Sequence[SupportsLessThanT]: ...
|
||||
def exists(path: AnyPath) -> bool: ...
|
||||
def getsize(filename: AnyPath) -> int: ...
|
||||
def isfile(path: AnyPath) -> bool: ...
|
||||
def isdir(s: AnyPath) -> bool: ...
|
||||
def exists(path: StrOrBytesPath) -> bool: ...
|
||||
def getsize(filename: StrOrBytesPath) -> int: ...
|
||||
def isfile(path: StrOrBytesPath) -> bool: ...
|
||||
def isdir(s: StrOrBytesPath) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
def getmtime(filename: AnyPath) -> float: ...
|
||||
def getctime(filename: AnyPath) -> float: ...
|
||||
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
|
||||
def getatime(filename: StrOrBytesPath) -> float: ...
|
||||
def getmtime(filename: StrOrBytesPath) -> float: ...
|
||||
def getctime(filename: StrOrBytesPath) -> float: ...
|
||||
def samefile(f1: StrOrBytesPath, f2: StrOrBytesPath) -> bool: ...
|
||||
def sameopenfile(fp1: int, fp2: int) -> bool: ...
|
||||
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import AnyStr, Iterator, List, Optional, Union
|
||||
|
||||
def glob0(dirname: AnyStr, pattern: AnyStr) -> List[AnyStr]: ...
|
||||
@@ -7,10 +7,10 @@ def glob1(dirname: AnyStr, pattern: AnyStr) -> List[AnyStr]: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def glob(
|
||||
pathname: AnyStr, *, root_dir: Optional[AnyPath] = ..., dir_fd: Optional[int] = ..., recursive: bool = ...
|
||||
pathname: AnyStr, *, root_dir: Optional[StrOrBytesPath] = ..., dir_fd: Optional[int] = ..., recursive: bool = ...
|
||||
) -> List[AnyStr]: ...
|
||||
def iglob(
|
||||
pathname: AnyStr, *, root_dir: Optional[AnyPath] = ..., dir_fd: Optional[int] = ..., recursive: bool = ...
|
||||
pathname: AnyStr, *, root_dir: Optional[StrOrBytesPath] = ..., dir_fd: Optional[int] = ..., recursive: bool = ...
|
||||
) -> Iterator[AnyStr]: ...
|
||||
|
||||
else:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import _compression
|
||||
import sys
|
||||
import zlib
|
||||
from _typeshed import AnyPath, ReadableBuffer
|
||||
from _typeshed import ReadableBuffer, StrOrBytesPath
|
||||
from io import FileIO
|
||||
from typing import Any, Optional, Protocol, TextIO, Union, overload
|
||||
from typing_extensions import Literal
|
||||
@@ -31,7 +31,7 @@ class _WritableFileobj(Protocol):
|
||||
|
||||
@overload
|
||||
def open(
|
||||
filename: Union[AnyPath, _ReadableFileobj],
|
||||
filename: Union[StrOrBytesPath, _ReadableFileobj],
|
||||
mode: _ReadBinaryMode = ...,
|
||||
compresslevel: int = ...,
|
||||
encoding: None = ...,
|
||||
@@ -40,7 +40,7 @@ def open(
|
||||
) -> GzipFile: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: Union[AnyPath, _WritableFileobj],
|
||||
filename: Union[StrOrBytesPath, _WritableFileobj],
|
||||
mode: _WriteBinaryMode,
|
||||
compresslevel: int = ...,
|
||||
encoding: None = ...,
|
||||
@@ -49,7 +49,7 @@ def open(
|
||||
) -> GzipFile: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: AnyPath,
|
||||
filename: StrOrBytesPath,
|
||||
mode: _OpenTextMode,
|
||||
compresslevel: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
@@ -58,7 +58,7 @@ def open(
|
||||
) -> TextIO: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: Union[AnyPath, _ReadableFileobj, _WritableFileobj],
|
||||
filename: Union[StrOrBytesPath, _ReadableFileobj, _WritableFileobj],
|
||||
mode: str,
|
||||
compresslevel: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
@@ -86,7 +86,7 @@ class GzipFile(_compression.BaseStream):
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
filename: Optional[AnyPath],
|
||||
filename: Optional[StrOrBytesPath],
|
||||
mode: _ReadBinaryMode,
|
||||
compresslevel: int = ...,
|
||||
fileobj: Optional[_ReadableFileobj] = ...,
|
||||
@@ -104,7 +104,7 @@ class GzipFile(_compression.BaseStream):
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
filename: Optional[AnyPath],
|
||||
filename: Optional[StrOrBytesPath],
|
||||
mode: _WriteBinaryMode,
|
||||
compresslevel: int = ...,
|
||||
fileobj: Optional[_WritableFileobj] = ...,
|
||||
@@ -122,7 +122,7 @@ class GzipFile(_compression.BaseStream):
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
filename: Optional[AnyPath] = ...,
|
||||
filename: Optional[StrOrBytesPath] = ...,
|
||||
mode: Optional[str] = ...,
|
||||
compresslevel: int = ...,
|
||||
fileobj: Union[_ReadableFileobj, _WritableFileobj, None] = ...,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
import types
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from importlib.machinery import ModuleSpec
|
||||
from typing import IO, Any, Iterator, Mapping, Optional, Protocol, Sequence, Tuple, Union
|
||||
@@ -73,9 +73,9 @@ class FileLoader(ResourceLoader, ExecutionLoader, metaclass=ABCMeta):
|
||||
if sys.version_info >= (3, 7):
|
||||
class ResourceReader(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def open_resource(self, resource: AnyPath) -> IO[bytes]: ...
|
||||
def open_resource(self, resource: StrOrBytesPath) -> IO[bytes]: ...
|
||||
@abstractmethod
|
||||
def resource_path(self, resource: AnyPath) -> str: ...
|
||||
def resource_path(self, resource: StrOrBytesPath) -> str: ...
|
||||
@abstractmethod
|
||||
def is_resource(self, name: str) -> bool: ...
|
||||
@abstractmethod
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import importlib.abc
|
||||
import importlib.machinery
|
||||
import types
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import Any, Callable, List, Optional
|
||||
|
||||
def module_for_loader(fxn: Callable[..., types.ModuleType]) -> Callable[..., types.ModuleType]: ...
|
||||
@@ -20,7 +20,7 @@ def spec_from_loader(
|
||||
) -> Optional[importlib.machinery.ModuleSpec]: ...
|
||||
def spec_from_file_location(
|
||||
name: str,
|
||||
location: Optional[AnyPath] = ...,
|
||||
location: Optional[StrOrBytesPath] = ...,
|
||||
*,
|
||||
loader: Optional[importlib.abc.Loader] = ...,
|
||||
submodule_search_locations: Optional[List[str]] = ...,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath, StrPath
|
||||
from _typeshed import StrOrBytesPath, StrPath
|
||||
from collections.abc import Callable
|
||||
from configparser import RawConfigParser
|
||||
from threading import Thread
|
||||
@@ -11,7 +11,7 @@ else:
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
_Path = AnyPath
|
||||
_Path = StrOrBytesPath
|
||||
else:
|
||||
_Path = StrPath
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import io
|
||||
from _typeshed import AnyPath, ReadableBuffer
|
||||
from _typeshed import ReadableBuffer, StrOrBytesPath
|
||||
from typing import IO, Any, Mapping, Optional, Sequence, TextIO, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_OpenBinaryWritingMode = Literal["w", "wb", "x", "xb", "a", "ab"]
|
||||
_OpenTextWritingMode = Literal["wt", "xt", "at"]
|
||||
|
||||
_PathOrFile = Union[AnyPath, IO[bytes]]
|
||||
_PathOrFile = Union[StrOrBytesPath, IO[bytes]]
|
||||
|
||||
_FilterChain = Sequence[Mapping[str, Any]]
|
||||
_T = TypeVar("_T")
|
||||
@@ -120,7 +120,7 @@ def open(
|
||||
) -> LZMAFile: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: AnyPath,
|
||||
filename: StrOrBytesPath,
|
||||
mode: Literal["rt"],
|
||||
*,
|
||||
format: Optional[int] = ...,
|
||||
@@ -133,7 +133,7 @@ def open(
|
||||
) -> TextIO: ...
|
||||
@overload
|
||||
def open(
|
||||
filename: AnyPath,
|
||||
filename: StrOrBytesPath,
|
||||
mode: _OpenTextWritingMode,
|
||||
*,
|
||||
format: Optional[int] = ...,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import AnyPath, BytesPath, StrPath
|
||||
from _typeshed import BytesPath, StrOrBytesPath, StrPath
|
||||
from genericpath import (
|
||||
commonprefix as commonprefix,
|
||||
exists as exists,
|
||||
@@ -56,7 +56,7 @@ def normpath(s: AnyStr) -> AnyStr: ...
|
||||
def realpath(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
def islink(s: AnyPath) -> bool: ...
|
||||
def islink(s: StrOrBytesPath) -> bool: ...
|
||||
|
||||
# Mypy complains that the signatures overlap, but things seem to behave correctly anyway.
|
||||
@overload
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import email.message
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
IO,
|
||||
@@ -43,7 +43,9 @@ class Mailbox(Generic[_MessageT]):
|
||||
|
||||
_path: Union[bytes, str] # undocumented
|
||||
_factory: Optional[Callable[[IO[Any]], _MessageT]] # undocumented
|
||||
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], _MessageT]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self, path: StrOrBytesPath, factory: Optional[Callable[[IO[Any]], _MessageT]] = ..., create: bool = ...
|
||||
) -> None: ...
|
||||
def add(self, message: _MessageData) -> str: ...
|
||||
def remove(self, key: str) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
@@ -86,7 +88,7 @@ class Maildir(Mailbox[MaildirMessage]):
|
||||
|
||||
colon: str
|
||||
def __init__(
|
||||
self, dirname: AnyPath, factory: Optional[Callable[[IO[Any]], MaildirMessage]] = ..., create: bool = ...
|
||||
self, dirname: StrOrBytesPath, factory: Optional[Callable[[IO[Any]], MaildirMessage]] = ..., create: bool = ...
|
||||
) -> None: ...
|
||||
def get_file(self, key: str) -> _ProxyFile[bytes]: ...
|
||||
def list_folders(self) -> List[str]: ...
|
||||
@@ -104,24 +106,32 @@ class _mboxMMDF(_singlefileMailbox[_MessageT]):
|
||||
def get_string(self, key: str, from_: bool = ...) -> str: ...
|
||||
|
||||
class mbox(_mboxMMDF[mboxMessage]):
|
||||
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self, path: StrOrBytesPath, factory: Optional[Callable[[IO[Any]], mboxMessage]] = ..., create: bool = ...
|
||||
) -> None: ...
|
||||
|
||||
class MMDF(_mboxMMDF[MMDFMessage]):
|
||||
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], MMDFMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self, path: StrOrBytesPath, factory: Optional[Callable[[IO[Any]], MMDFMessage]] = ..., create: bool = ...
|
||||
) -> None: ...
|
||||
|
||||
class MH(Mailbox[MHMessage]):
|
||||
def __init__(self, path: AnyPath, factory: Optional[Callable[[IO[Any]], MHMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self, path: StrOrBytesPath, 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: AnyPath) -> MH: ...
|
||||
def add_folder(self, folder: AnyPath) -> MH: ...
|
||||
def remove_folder(self, folder: AnyPath) -> None: ...
|
||||
def get_folder(self, folder: StrOrBytesPath) -> MH: ...
|
||||
def add_folder(self, folder: StrOrBytesPath) -> MH: ...
|
||||
def remove_folder(self, folder: StrOrBytesPath) -> 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, path: AnyPath, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self, path: StrOrBytesPath, factory: Optional[Callable[[IO[Any]], BabylMessage]] = ..., create: bool = ...
|
||||
) -> None: ...
|
||||
def get_file(self, key: str) -> IO[bytes]: ...
|
||||
def get_labels(self) -> List[str]: ...
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
|
||||
class NetrcParseError(Exception):
|
||||
filename: Optional[str]
|
||||
lineno: Optional[int]
|
||||
msg: str
|
||||
def __init__(self, msg: str, filename: Optional[AnyPath] = ..., lineno: Optional[int] = ...) -> None: ...
|
||||
def __init__(self, msg: str, filename: Optional[StrOrBytesPath] = ..., lineno: Optional[int] = ...) -> None: ...
|
||||
|
||||
# (login, account, password) tuple
|
||||
_NetrcTuple = Tuple[str, Optional[str], Optional[str]]
|
||||
@@ -13,5 +13,5 @@ _NetrcTuple = Tuple[str, Optional[str], Optional[str]]
|
||||
class netrc:
|
||||
hosts: Dict[str, _NetrcTuple]
|
||||
macros: Dict[str, List[str]]
|
||||
def __init__(self, file: Optional[AnyPath] = ...) -> None: ...
|
||||
def __init__(self, file: Optional[StrOrBytesPath] = ...) -> None: ...
|
||||
def authenticators(self, host: str) -> Optional[_NetrcTuple]: ...
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import sys
|
||||
from _typeshed import (
|
||||
AnyPath,
|
||||
FileDescriptorLike,
|
||||
OpenBinaryMode,
|
||||
OpenBinaryModeReading,
|
||||
OpenBinaryModeUpdating,
|
||||
OpenBinaryModeWriting,
|
||||
OpenTextMode,
|
||||
StrOrBytesPath,
|
||||
StrPath,
|
||||
)
|
||||
from builtins import OSError
|
||||
@@ -311,7 +311,7 @@ class stat_result:
|
||||
class PathLike(Protocol[_AnyStr_co]):
|
||||
def __fspath__(self) -> _AnyStr_co: ...
|
||||
|
||||
_FdOrAnyPath = Union[int, AnyPath]
|
||||
_FdOrAnyPath = Union[int, StrOrBytesPath]
|
||||
|
||||
class DirEntry(Generic[AnyStr]):
|
||||
# This is what the scandir interator yields
|
||||
@@ -368,8 +368,8 @@ if sys.platform != "win32":
|
||||
f_namemax: int
|
||||
|
||||
# ----- os function stubs -----
|
||||
def fsencode(filename: AnyPath) -> bytes: ...
|
||||
def fsdecode(filename: AnyPath) -> str: ...
|
||||
def fsencode(filename: StrOrBytesPath) -> bytes: ...
|
||||
def fsdecode(filename: StrOrBytesPath) -> str: ...
|
||||
@overload
|
||||
def fspath(path: str) -> str: ...
|
||||
@overload
|
||||
@@ -528,7 +528,7 @@ else:
|
||||
def fstat(fd: int) -> stat_result: ...
|
||||
def fsync(fd: FileDescriptorLike) -> None: ...
|
||||
def lseek(__fd: int, __position: int, __how: int) -> int: ...
|
||||
def open(path: AnyPath, flags: int, mode: int = ..., *, dir_fd: Optional[int] = ...) -> int: ...
|
||||
def open(path: StrOrBytesPath, flags: int, mode: int = ..., *, dir_fd: Optional[int] = ...) -> int: ...
|
||||
def pipe() -> Tuple[int, int]: ...
|
||||
def read(__fd: int, __length: int) -> bytes: ...
|
||||
|
||||
@@ -595,43 +595,52 @@ def getcwdb() -> bytes: ...
|
||||
def chmod(path: _FdOrAnyPath, mode: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def chflags(path: AnyPath, flags: int, follow_symlinks: bool = ...) -> None: ... # some flavors of Unix
|
||||
def chflags(path: StrOrBytesPath, 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: 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 chroot(path: StrOrBytesPath) -> None: ...
|
||||
def lchflags(path: StrOrBytesPath, flags: int) -> None: ...
|
||||
def lchmod(path: StrOrBytesPath, mode: int) -> None: ...
|
||||
def lchown(path: StrOrBytesPath, uid: int, gid: int) -> None: ...
|
||||
|
||||
def link(
|
||||
src: AnyPath, dst: AnyPath, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ..., follow_symlinks: bool = ...
|
||||
src: StrOrBytesPath,
|
||||
dst: StrOrBytesPath,
|
||||
*,
|
||||
src_dir_fd: Optional[int] = ...,
|
||||
dst_dir_fd: Optional[int] = ...,
|
||||
follow_symlinks: bool = ...,
|
||||
) -> None: ...
|
||||
def lstat(path: AnyPath, *, dir_fd: Optional[int] = ...) -> stat_result: ...
|
||||
def mkdir(path: AnyPath, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def lstat(path: StrOrBytesPath, *, dir_fd: Optional[int] = ...) -> stat_result: ...
|
||||
def mkdir(path: StrOrBytesPath, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def mkfifo(path: AnyPath, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... # Unix only
|
||||
def mkfifo(path: StrOrBytesPath, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... # Unix only
|
||||
|
||||
def makedirs(name: AnyPath, mode: int = ..., exist_ok: bool = ...) -> None: ...
|
||||
def makedirs(name: StrOrBytesPath, mode: int = ..., exist_ok: bool = ...) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def mknod(path: AnyPath, mode: int = ..., device: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def mknod(path: StrOrBytesPath, 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: _FdOrAnyPath, name: Union[str, int]) -> int: ... # Unix only
|
||||
|
||||
def readlink(path: Union[AnyStr, PathLike[AnyStr]], *, dir_fd: Optional[int] = ...) -> AnyStr: ...
|
||||
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: ...
|
||||
def remove(path: StrOrBytesPath, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def removedirs(name: StrOrBytesPath) -> None: ...
|
||||
def rename(
|
||||
src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...
|
||||
) -> None: ...
|
||||
def renames(old: StrOrBytesPath, new: StrOrBytesPath) -> None: ...
|
||||
def replace(
|
||||
src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...
|
||||
) -> None: ...
|
||||
def rmdir(path: StrOrBytesPath, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
|
||||
class _ScandirIterator(Iterator[DirEntry[AnyStr]], ContextManager[_ScandirIterator[AnyStr]]):
|
||||
def __next__(self) -> DirEntry[AnyStr]: ...
|
||||
@@ -662,13 +671,15 @@ if sys.version_info < (3, 7):
|
||||
if sys.platform != "win32":
|
||||
def statvfs(path: _FdOrAnyPath) -> statvfs_result: ... # Unix only
|
||||
|
||||
def symlink(src: AnyPath, dst: AnyPath, target_is_directory: bool = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def symlink(
|
||||
src: StrOrBytesPath, dst: StrOrBytesPath, target_is_directory: bool = ..., *, dir_fd: Optional[int] = ...
|
||||
) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def sync() -> None: ... # Unix only
|
||||
|
||||
def truncate(path: _FdOrAnyPath, length: int) -> None: ... # Unix only up to version 3.4
|
||||
def unlink(path: AnyPath, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def unlink(path: StrOrBytesPath, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def utime(
|
||||
path: _FdOrAnyPath,
|
||||
times: Optional[Union[Tuple[int, int], Tuple[float, float]]] = ...,
|
||||
@@ -714,22 +725,22 @@ if sys.platform != "win32":
|
||||
dir_fd: Optional[int] = ...,
|
||||
) -> Iterator[Tuple[str, List[str], List[str], int]]: ...
|
||||
if sys.platform == "linux":
|
||||
def getxattr(path: _FdOrAnyPath, attribute: AnyPath, *, follow_symlinks: bool = ...) -> bytes: ...
|
||||
def getxattr(path: _FdOrAnyPath, attribute: StrOrBytesPath, *, follow_symlinks: bool = ...) -> bytes: ...
|
||||
def listxattr(path: Optional[_FdOrAnyPath] = ..., *, follow_symlinks: bool = ...) -> List[str]: ...
|
||||
def removexattr(path: _FdOrAnyPath, attribute: AnyPath, *, follow_symlinks: bool = ...) -> None: ...
|
||||
def removexattr(path: _FdOrAnyPath, attribute: StrOrBytesPath, *, follow_symlinks: bool = ...) -> None: ...
|
||||
def setxattr(
|
||||
path: _FdOrAnyPath, attribute: AnyPath, value: bytes, flags: int = ..., *, follow_symlinks: bool = ...
|
||||
path: _FdOrAnyPath, attribute: StrOrBytesPath, 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: AnyPath, __arg0: AnyPath, *args: AnyPath) -> NoReturn: ...
|
||||
def execlp(file: AnyPath, __arg0: AnyPath, *args: AnyPath) -> NoReturn: ...
|
||||
def execl(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: StrOrBytesPath) -> NoReturn: ...
|
||||
def execlp(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: StrOrBytesPath) -> NoReturn: ...
|
||||
|
||||
# These are: execle(file, *args, env) but env is pulled from the last element of the args.
|
||||
def execle(file: AnyPath, __arg0: AnyPath, *args: Any) -> NoReturn: ...
|
||||
def execlpe(file: AnyPath, __arg0: AnyPath, *args: Any) -> NoReturn: ...
|
||||
def execle(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: Any) -> NoReturn: ...
|
||||
def execlpe(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: Any) -> NoReturn: ...
|
||||
|
||||
# The docs say `args: tuple or list of strings`
|
||||
# The implementation enforces tuple or list so we can't use Sequence.
|
||||
@@ -737,7 +748,7 @@ def execlpe(file: AnyPath, __arg0: AnyPath, *args: Any) -> NoReturn: ...
|
||||
# in practice, and doing so would explode the number of combinations in this already long union.
|
||||
# All these combinations are necessary due to List being invariant.
|
||||
_ExecVArgs = Union[
|
||||
Tuple[AnyPath, ...],
|
||||
Tuple[StrOrBytesPath, ...],
|
||||
List[bytes],
|
||||
List[str],
|
||||
List[PathLike[Any]],
|
||||
@@ -748,10 +759,10 @@ _ExecVArgs = Union[
|
||||
]
|
||||
_ExecEnv = Union[Mapping[bytes, Union[bytes, str]], Mapping[str, Union[bytes, str]]]
|
||||
|
||||
def execv(__path: AnyPath, __argv: _ExecVArgs) -> NoReturn: ...
|
||||
def execv(__path: StrOrBytesPath, __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 execvp(file: StrOrBytesPath, args: _ExecVArgs) -> NoReturn: ...
|
||||
def execvpe(file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> NoReturn: ...
|
||||
def _exit(status: int) -> NoReturn: ...
|
||||
def kill(__pid: int, __signal: int) -> None: ...
|
||||
|
||||
@@ -769,30 +780,30 @@ 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: AnyPath, arg0: AnyPath, *args: AnyPath) -> int: ...
|
||||
def spawnle(mode: int, file: AnyPath, arg0: AnyPath, *args: Any) -> int: ... # Imprecise sig
|
||||
def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
|
||||
def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig
|
||||
|
||||
if sys.platform != "win32":
|
||||
def spawnv(mode: int, file: AnyPath, args: _ExecVArgs) -> int: ...
|
||||
def spawnve(mode: int, file: AnyPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
|
||||
def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
|
||||
def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
|
||||
|
||||
else:
|
||||
def spawnv(__mode: int, __path: AnyPath, __argv: _ExecVArgs) -> int: ...
|
||||
def spawnve(__mode: int, __path: AnyPath, __argv: _ExecVArgs, __env: _ExecEnv) -> int: ...
|
||||
def spawnv(__mode: int, __path: StrOrBytesPath, __argv: _ExecVArgs) -> int: ...
|
||||
def spawnve(__mode: int, __path: StrOrBytesPath, __argv: _ExecVArgs, __env: _ExecEnv) -> int: ...
|
||||
|
||||
def system(command: AnyPath) -> int: ...
|
||||
def system(command: StrOrBytesPath) -> int: ...
|
||||
def times() -> times_result: ...
|
||||
def waitpid(__pid: int, __options: int) -> Tuple[int, int]: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def startfile(path: AnyPath, operation: Optional[str] = ...) -> None: ...
|
||||
def startfile(path: StrOrBytesPath, operation: Optional[str] = ...) -> None: ...
|
||||
|
||||
else:
|
||||
# Unix only
|
||||
def spawnlp(mode: int, file: AnyPath, arg0: AnyPath, *args: AnyPath) -> int: ...
|
||||
def spawnlpe(mode: int, file: AnyPath, arg0: AnyPath, *args: Any) -> int: ... # Imprecise signature
|
||||
def spawnvp(mode: int, file: AnyPath, args: _ExecVArgs) -> int: ...
|
||||
def spawnvpe(mode: int, file: AnyPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
|
||||
def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
|
||||
def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature
|
||||
def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
|
||||
def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
|
||||
def wait() -> Tuple[int, int]: ... # Unix only
|
||||
if sys.platform != "darwin":
|
||||
from posix import waitid_result
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from types import CodeType
|
||||
from typing import Any, List, Sequence, Tuple
|
||||
|
||||
@@ -8,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: AnyPath = ...) -> CodeType: ...
|
||||
def compilest(st: STType, filename: StrOrBytesPath = ...) -> CodeType: ...
|
||||
def isexpr(st: STType) -> bool: ...
|
||||
def issuite(st: STType) -> bool: ...
|
||||
|
||||
class ParserError(Exception): ...
|
||||
|
||||
class STType:
|
||||
def compile(self, filename: AnyPath = ...) -> CodeType: ...
|
||||
def compile(self, filename: StrOrBytesPath = ...) -> CodeType: ...
|
||||
def isexpr(self) -> bool: ...
|
||||
def issuite(self) -> bool: ...
|
||||
def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath, BytesPath, StrPath
|
||||
from _typeshed import BytesPath, StrOrBytesPath, StrPath
|
||||
from genericpath import (
|
||||
commonprefix as commonprefix,
|
||||
exists as exists,
|
||||
@@ -93,7 +93,7 @@ def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitext(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
|
||||
@overload
|
||||
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def isabs(s: AnyPath) -> bool: ...
|
||||
def islink(path: AnyPath) -> bool: ...
|
||||
def ismount(path: AnyPath) -> bool: ...
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
def isabs(s: StrOrBytesPath) -> bool: ...
|
||||
def islink(path: StrOrBytesPath) -> bool: ...
|
||||
def ismount(path: StrOrBytesPath) -> bool: ...
|
||||
def lexists(path: StrOrBytesPath) -> bool: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar, Union
|
||||
|
||||
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
|
||||
@@ -18,7 +18,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: AnyPath) -> None: ...
|
||||
def dump_stats(self, file: StrOrBytesPath) -> None: ...
|
||||
def create_stats(self) -> None: ...
|
||||
def snapshot_stats(self) -> None: ...
|
||||
def run(self: _SelfT, cmd: str) -> _SelfT: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from cProfile import Profile as _cProfile
|
||||
from profile import Profile
|
||||
from typing import IO, Any, Dict, Iterable, List, Optional, Tuple, TypeVar, Union, overload
|
||||
@@ -32,7 +32,7 @@ class Stats:
|
||||
def load_stats(self, arg: Union[None, str, Profile, _cProfile]) -> None: ...
|
||||
def get_top_level_stats(self) -> None: ...
|
||||
def add(self: _T, *arg_list: Union[None, str, Profile, _cProfile, _T]) -> _T: ...
|
||||
def dump_stats(self, filename: AnyPath) -> None: ...
|
||||
def dump_stats(self, filename: StrOrBytesPath) -> None: ...
|
||||
def get_sort_arg_defs(self) -> Dict[str, Tuple[Tuple[Tuple[int, int], ...], str]]: ...
|
||||
@overload
|
||||
def sort_stats(self: _T, field: int) -> _T: ...
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import Callable, Optional, Sequence
|
||||
|
||||
_CompleterT = Optional[Callable[[str, int], Optional[str]]]
|
||||
_CompDispT = Optional[Callable[[str, Sequence[str], int], None]]
|
||||
|
||||
def parse_and_bind(__string: str) -> None: ...
|
||||
def read_init_file(__filename: Optional[AnyPath] = ...) -> None: ...
|
||||
def read_init_file(__filename: Optional[StrOrBytesPath] = ...) -> None: ...
|
||||
def get_line_buffer() -> str: ...
|
||||
def insert_text(__string: str) -> None: ...
|
||||
def redisplay() -> None: ...
|
||||
def read_history_file(__filename: Optional[AnyPath] = ...) -> None: ...
|
||||
def write_history_file(__filename: Optional[AnyPath] = ...) -> None: ...
|
||||
def append_history_file(__nelements: int, __filename: Optional[AnyPath] = ...) -> None: ...
|
||||
def read_history_file(__filename: Optional[StrOrBytesPath] = ...) -> None: ...
|
||||
def write_history_file(__filename: Optional[StrOrBytesPath] = ...) -> None: ...
|
||||
def append_history_file(__nelements: int, __filename: Optional[StrOrBytesPath] = ...) -> None: ...
|
||||
def get_history_length() -> int: ...
|
||||
def set_history_length(__length: int) -> None: ...
|
||||
def clear_history() -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import NamedTuple, Optional, Union
|
||||
|
||||
class SndHeaders(NamedTuple):
|
||||
@@ -8,5 +8,5 @@ class SndHeaders(NamedTuple):
|
||||
nframes: int
|
||||
sampwidth: Union[int, str]
|
||||
|
||||
def what(filename: AnyPath) -> Optional[SndHeaders]: ...
|
||||
def whathdr(filename: AnyPath) -> Optional[SndHeaders]: ...
|
||||
def what(filename: StrOrBytesPath) -> Optional[SndHeaders]: ...
|
||||
def whathdr(filename: StrOrBytesPath) -> Optional[SndHeaders]: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from datetime import date, datetime, time
|
||||
from typing import Any, Callable, Generator, Iterable, Iterator, List, Optional, Protocol, Tuple, Type, TypeVar, Union
|
||||
|
||||
@@ -66,7 +66,7 @@ def complete_statement(sql: str) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def connect(
|
||||
database: AnyPath,
|
||||
database: StrOrBytesPath,
|
||||
timeout: float = ...,
|
||||
detect_types: int = ...,
|
||||
isolation_level: Optional[str] = ...,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
@@ -24,15 +24,15 @@ if sys.version_info >= (3, 9):
|
||||
_FILE = Union[None, int, IO[Any]]
|
||||
_TXT = Union[bytes, str]
|
||||
if sys.version_info >= (3, 8):
|
||||
_CMD = Union[AnyPath, Sequence[AnyPath]]
|
||||
_CMD = Union[StrOrBytesPath, Sequence[StrOrBytesPath]]
|
||||
else:
|
||||
# Python 3.6 doesn't support _CMD being a single PathLike.
|
||||
# See: https://bugs.python.org/issue31961
|
||||
_CMD = Union[_TXT, Sequence[AnyPath]]
|
||||
_CMD = Union[_TXT, Sequence[StrOrBytesPath]]
|
||||
if sys.platform == "win32":
|
||||
_ENV = Mapping[str, str]
|
||||
else:
|
||||
_ENV = Union[Mapping[bytes, AnyPath], Mapping[str, AnyPath]]
|
||||
_ENV = Union[Mapping[bytes, StrOrBytesPath], Mapping[str, StrOrBytesPath]]
|
||||
|
||||
_S = TypeVar("_S")
|
||||
_T = TypeVar("_T")
|
||||
@@ -56,14 +56,14 @@ if sys.version_info >= (3, 7):
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -84,14 +84,14 @@ if sys.version_info >= (3, 7):
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -112,14 +112,14 @@ if sys.version_info >= (3, 7):
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -140,14 +140,14 @@ if sys.version_info >= (3, 7):
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
*,
|
||||
universal_newlines: Literal[True],
|
||||
@@ -169,14 +169,14 @@ if sys.version_info >= (3, 7):
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: Literal[False] = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -197,14 +197,14 @@ if sys.version_info >= (3, 7):
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -228,14 +228,14 @@ else:
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -254,14 +254,14 @@ else:
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -280,14 +280,14 @@ else:
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
*,
|
||||
universal_newlines: Literal[True],
|
||||
@@ -307,14 +307,14 @@ else:
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: Literal[False] = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -333,14 +333,14 @@ else:
|
||||
def run(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -360,14 +360,14 @@ else:
|
||||
def call(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -383,14 +383,14 @@ def call(
|
||||
def check_call(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: AnyPath = ...,
|
||||
executable: StrOrBytesPath = ...,
|
||||
stdin: _FILE = ...,
|
||||
stdout: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -407,13 +407,13 @@ if sys.version_info >= (3, 7):
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -432,13 +432,13 @@ if sys.version_info >= (3, 7):
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -457,13 +457,13 @@ if sys.version_info >= (3, 7):
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -482,13 +482,13 @@ if sys.version_info >= (3, 7):
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
*,
|
||||
universal_newlines: Literal[True],
|
||||
@@ -508,13 +508,13 @@ if sys.version_info >= (3, 7):
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: Literal[False] = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -533,13 +533,13 @@ if sys.version_info >= (3, 7):
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -560,13 +560,13 @@ else:
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -584,13 +584,13 @@ else:
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -608,13 +608,13 @@ else:
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
startupinfo: Any = ...,
|
||||
creationflags: int = ...,
|
||||
@@ -632,13 +632,13 @@ else:
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: Literal[False] = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -656,13 +656,13 @@ else:
|
||||
def check_output(
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: _FILE = ...,
|
||||
stderr: _FILE = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Any = ...,
|
||||
@@ -724,14 +724,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
@@ -749,14 +749,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
@@ -774,14 +774,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
*,
|
||||
universal_newlines: Literal[True],
|
||||
@@ -800,14 +800,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
@@ -825,14 +825,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: Literal[False] = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
@@ -850,14 +850,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
@@ -876,14 +876,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
@@ -900,14 +900,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
@@ -924,14 +924,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
*,
|
||||
universal_newlines: Literal[True],
|
||||
@@ -949,14 +949,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: Literal[False] = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
@@ -973,14 +973,14 @@ class Popen(Generic[AnyStr]):
|
||||
cls,
|
||||
args: _CMD,
|
||||
bufsize: int = ...,
|
||||
executable: Optional[AnyPath] = ...,
|
||||
executable: Optional[StrOrBytesPath] = ...,
|
||||
stdin: Optional[_FILE] = ...,
|
||||
stdout: Optional[_FILE] = ...,
|
||||
stderr: Optional[_FILE] = ...,
|
||||
preexec_fn: Optional[Callable[[], Any]] = ...,
|
||||
close_fds: bool = ...,
|
||||
shell: bool = ...,
|
||||
cwd: Optional[AnyPath] = ...,
|
||||
cwd: Optional[StrOrBytesPath] = ...,
|
||||
env: Optional[_ENV] = ...,
|
||||
universal_newlines: bool = ...,
|
||||
startupinfo: Optional[Any] = ...,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import Iterable, Tuple
|
||||
|
||||
verbose: int
|
||||
@@ -10,5 +10,5 @@ class NannyNag(Exception):
|
||||
def get_msg(self) -> str: ...
|
||||
def get_line(self) -> str: ...
|
||||
|
||||
def check(file: AnyPath) -> None: ...
|
||||
def check(file: StrOrBytesPath) -> None: ...
|
||||
def process_tokens(tokens: Iterable[Tuple[int, str, Tuple[int, int], Tuple[int, int], str]]) -> None: ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import io
|
||||
import sys
|
||||
from _typeshed import AnyPath, StrPath
|
||||
from _typeshed import StrOrBytesPath, StrPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Set, Tuple, Type, Union
|
||||
|
||||
@@ -50,7 +50,7 @@ PAX_NAME_FIELDS: Set[str]
|
||||
ENCODING: str
|
||||
|
||||
def open(
|
||||
name: Optional[AnyPath] = ...,
|
||||
name: Optional[StrOrBytesPath] = ...,
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
bufsize: int = ...,
|
||||
@@ -72,7 +72,7 @@ class ExFileObject(io.BufferedReader):
|
||||
|
||||
class TarFile(Iterable[TarInfo]):
|
||||
OPEN_METH: Mapping[str, str]
|
||||
name: Optional[AnyPath]
|
||||
name: Optional[StrOrBytesPath]
|
||||
mode: str
|
||||
fileobj: Optional[IO[bytes]]
|
||||
format: Optional[int]
|
||||
@@ -88,7 +88,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
offset: int # undocumented
|
||||
def __init__(
|
||||
self,
|
||||
name: Optional[AnyPath] = ...,
|
||||
name: Optional[StrOrBytesPath] = ...,
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
format: Optional[int] = ...,
|
||||
@@ -110,7 +110,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
@classmethod
|
||||
def open(
|
||||
cls,
|
||||
name: Optional[AnyPath] = ...,
|
||||
name: Optional[StrOrBytesPath] = ...,
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
bufsize: int = ...,
|
||||
@@ -128,7 +128,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
@classmethod
|
||||
def taropen(
|
||||
cls,
|
||||
name: Optional[AnyPath],
|
||||
name: Optional[StrOrBytesPath],
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
*,
|
||||
@@ -145,7 +145,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
@classmethod
|
||||
def gzopen(
|
||||
cls,
|
||||
name: Optional[AnyPath],
|
||||
name: Optional[StrOrBytesPath],
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
compresslevel: int = ...,
|
||||
@@ -162,7 +162,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
@classmethod
|
||||
def bz2open(
|
||||
cls,
|
||||
name: Optional[AnyPath],
|
||||
name: Optional[StrOrBytesPath],
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
compresslevel: int = ...,
|
||||
@@ -179,7 +179,7 @@ class TarFile(Iterable[TarInfo]):
|
||||
@classmethod
|
||||
def xzopen(
|
||||
cls,
|
||||
name: Optional[AnyPath],
|
||||
name: Optional[StrOrBytesPath],
|
||||
mode: str = ...,
|
||||
fileobj: Optional[IO[bytes]] = ...,
|
||||
preset: Optional[int] = ...,
|
||||
@@ -199,21 +199,21 @@ class TarFile(Iterable[TarInfo]):
|
||||
def list(self, verbose: bool = ..., *, members: Optional[List[TarInfo]] = ...) -> None: ...
|
||||
def next(self) -> Optional[TarInfo]: ...
|
||||
def extractall(
|
||||
self, path: AnyPath = ..., members: Optional[Iterable[TarInfo]] = ..., *, numeric_owner: bool = ...
|
||||
self, path: StrOrBytesPath = ..., members: Optional[Iterable[TarInfo]] = ..., *, numeric_owner: bool = ...
|
||||
) -> None: ...
|
||||
def extract(
|
||||
self, member: Union[str, TarInfo], path: AnyPath = ..., set_attrs: bool = ..., *, numeric_owner: bool = ...
|
||||
self, member: Union[str, TarInfo], path: StrOrBytesPath = ..., set_attrs: bool = ..., *, numeric_owner: bool = ...
|
||||
) -> None: ...
|
||||
def extractfile(self, member: Union[str, TarInfo]) -> Optional[IO[bytes]]: ...
|
||||
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
|
||||
def chown(self, tarinfo: TarInfo, targetpath: AnyPath, numeric_owner: bool) -> None: ... # undocumented
|
||||
def chmod(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def utime(self, tarinfo: TarInfo, targetpath: AnyPath) -> None: ... # undocumented
|
||||
def makedir(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented
|
||||
def makefile(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented
|
||||
def makeunknown(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented
|
||||
def makefifo(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented
|
||||
def makedev(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented
|
||||
def makelink(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented
|
||||
def chown(self, tarinfo: TarInfo, targetpath: StrOrBytesPath, numeric_owner: bool) -> None: ... # undocumented
|
||||
def chmod(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented
|
||||
def utime(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented
|
||||
if sys.version_info >= (3, 7):
|
||||
def add(
|
||||
self,
|
||||
@@ -240,10 +240,10 @@ class TarFile(Iterable[TarInfo]):
|
||||
def close(self) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def is_tarfile(name: Union[AnyPath, IO[bytes]]) -> bool: ...
|
||||
def is_tarfile(name: Union[StrOrBytesPath, IO[bytes]]) -> bool: ...
|
||||
|
||||
else:
|
||||
def is_tarfile(name: AnyPath) -> bool: ...
|
||||
def is_tarfile(name: StrOrBytesPath) -> bool: ...
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
def filemode(mode: int) -> str: ... # undocumented
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _tkinter
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from enum import Enum
|
||||
from tkinter.constants import * # comment this out to find undefined identifier names with flake8
|
||||
from tkinter.font import _FontDescription
|
||||
@@ -2791,7 +2791,7 @@ class PhotoImage(Image):
|
||||
*,
|
||||
data: Union[str, bytes] = ..., # not same as data argument of put()
|
||||
format: str = ...,
|
||||
file: AnyPath = ...,
|
||||
file: StrOrBytesPath = ...,
|
||||
gamma: float = ...,
|
||||
height: int = ...,
|
||||
palette: Union[int, str] = ...,
|
||||
@@ -2802,7 +2802,7 @@ class PhotoImage(Image):
|
||||
*,
|
||||
data: Union[str, bytes] = ...,
|
||||
format: str = ...,
|
||||
file: AnyPath = ...,
|
||||
file: StrOrBytesPath = ...,
|
||||
gamma: float = ...,
|
||||
height: int = ...,
|
||||
palette: Union[int, str] = ...,
|
||||
@@ -2819,7 +2819,9 @@ class PhotoImage(Image):
|
||||
def put(
|
||||
self, data: Union[str, _TkinterSequence[str], _TkinterSequence2D[_Color]], to: Optional[Tuple[int, int]] = ...
|
||||
) -> None: ...
|
||||
def write(self, filename: AnyPath, format: Optional[str] = ..., from_coords: Optional[Tuple[int, int]] = ...) -> None: ...
|
||||
def write(
|
||||
self, filename: StrOrBytesPath, format: Optional[str] = ..., from_coords: Optional[Tuple[int, int]] = ...
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def transparency_get(self, x: int, y: int) -> bool: ...
|
||||
def transparency_set(self, x: int, y: int, boolean: bool) -> None: ...
|
||||
@@ -2833,10 +2835,10 @@ class BitmapImage(Image):
|
||||
*,
|
||||
background: _Color = ...,
|
||||
data: Union[str, bytes] = ...,
|
||||
file: AnyPath = ...,
|
||||
file: StrOrBytesPath = ...,
|
||||
foreground: _Color = ...,
|
||||
maskdata: str = ...,
|
||||
maskfile: AnyPath = ...,
|
||||
maskfile: StrOrBytesPath = ...,
|
||||
) -> None: ...
|
||||
|
||||
def image_names() -> Tuple[str, ...]: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from builtins import open as _builtin_open
|
||||
from token import * # noqa: F403
|
||||
from typing import (
|
||||
@@ -62,7 +62,7 @@ def untokenize(iterable: Iterable[_Token]) -> Any: ...
|
||||
def detect_encoding(readline: Callable[[], bytes]) -> Tuple[str, Sequence[bytes]]: ...
|
||||
def tokenize(readline: Callable[[], bytes]) -> Generator[TokenInfo, None, None]: ...
|
||||
def generate_tokens(readline: Callable[[], str]) -> Generator[TokenInfo, None, None]: ... # undocumented
|
||||
def open(filename: Union[AnyPath, int]) -> TextIO: ...
|
||||
def open(filename: Union[StrOrBytesPath, int]) -> TextIO: ...
|
||||
def group(*choices: str) -> str: ... # undocumented
|
||||
def any(*choices: str) -> str: ... # undocumented
|
||||
def maybe(*choices: str) -> str: ... # undocumented
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ssl
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from email.message import Message
|
||||
from http.client import HTTPMessage, HTTPResponse, _HTTPConnectionProtocol
|
||||
from http.cookiejar import CookieJar
|
||||
@@ -271,7 +271,7 @@ class HTTPErrorProcessor(BaseHandler):
|
||||
|
||||
def urlretrieve(
|
||||
url: str,
|
||||
filename: Optional[AnyPath] = ...,
|
||||
filename: Optional[StrOrBytesPath] = ...,
|
||||
reporthook: Optional[Callable[[int, int, int], None]] = ...,
|
||||
data: Optional[bytes] = ...,
|
||||
) -> Tuple[str, HTTPMessage]: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from types import SimpleNamespace
|
||||
from typing import Optional, Sequence
|
||||
|
||||
@@ -32,11 +32,13 @@ class EnvBuilder:
|
||||
with_pip: bool = ...,
|
||||
prompt: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
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(self, env_dir: StrOrBytesPath) -> None: ...
|
||||
def clear_directory(self, path: StrOrBytesPath) -> None: ... # undocumented
|
||||
def ensure_directories(self, env_dir: StrOrBytesPath) -> SimpleNamespace: ...
|
||||
def create_configuration(self, context: SimpleNamespace) -> None: ...
|
||||
def symlink_or_copy(self, src: AnyPath, dst: AnyPath, relative_symlinks_ok: bool = ...) -> None: ... # undocumented
|
||||
def symlink_or_copy(
|
||||
self, src: StrOrBytesPath, dst: StrOrBytesPath, 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: ...
|
||||
@@ -48,7 +50,7 @@ class EnvBuilder:
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
def create(
|
||||
env_dir: AnyPath,
|
||||
env_dir: StrOrBytesPath,
|
||||
system_site_packages: bool = ...,
|
||||
clear: bool = ...,
|
||||
symlinks: bool = ...,
|
||||
@@ -59,7 +61,7 @@ if sys.version_info >= (3, 9):
|
||||
|
||||
else:
|
||||
def create(
|
||||
env_dir: AnyPath,
|
||||
env_dir: StrOrBytesPath,
|
||||
system_site_packages: bool = ...,
|
||||
clear: bool = ...,
|
||||
symlinks: bool = ...,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath, FileDescriptor, SupportsWrite
|
||||
from _typeshed import FileDescriptor, StrOrBytesPath, SupportsWrite
|
||||
from typing import (
|
||||
IO,
|
||||
Any,
|
||||
@@ -22,7 +22,7 @@ from typing import (
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_File = Union[AnyPath, FileDescriptor, IO[Any]]
|
||||
_File = Union[StrOrBytesPath, FileDescriptor, IO[Any]]
|
||||
|
||||
VERSION: str
|
||||
|
||||
|
||||
Reference in New Issue
Block a user