mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Enable --disallow-any-generics for stubs (#3288)
This commit is contained in:
committed by
Jelle Zijlstra
parent
23b353303b
commit
c32e1e2280
@@ -55,8 +55,8 @@ class _Readable(Protocol):
|
||||
|
||||
class RawConfigParser:
|
||||
_dict: Any
|
||||
_sections: dict
|
||||
_defaults: dict
|
||||
_sections: Dict[Any, Any]
|
||||
_defaults: Dict[Any, Any]
|
||||
_optcre: Any
|
||||
SECTCRE: Any
|
||||
OPTCRE: Any
|
||||
@@ -86,12 +86,14 @@ class RawConfigParser:
|
||||
|
||||
class ConfigParser(RawConfigParser):
|
||||
_KEYCRE: Any
|
||||
def get(self, section: str, option: str, raw: bool = ..., vars: Optional[dict] = ...) -> Any: ...
|
||||
def items(self, section: str, raw: bool = ..., vars: Optional[dict] = ...) -> List[Tuple[str, Any]]: ...
|
||||
def get(self, section: str, option: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> Any: ...
|
||||
def items(self, section: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> List[Tuple[str, Any]]: ...
|
||||
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
|
||||
def _interpolation_replace(self, match: Any) -> str: ...
|
||||
|
||||
class SafeConfigParser(ConfigParser):
|
||||
_interpvar_re: Any
|
||||
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
|
||||
def _interpolate_some(self, option: str, accum: list, rest: str, section: str, map: dict, depth: int) -> None: ...
|
||||
def _interpolate_some(
|
||||
self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
class CookieError(Exception): ...
|
||||
|
||||
class Morsel(dict):
|
||||
class Morsel(Dict[Any, Any]):
|
||||
key: Any
|
||||
def __init__(self): ...
|
||||
def __setitem__(self, K, V): ...
|
||||
@@ -14,7 +14,7 @@ class Morsel(dict):
|
||||
def js_output(self, attrs: Optional[Any] = ...): ...
|
||||
def OutputString(self, attrs: Optional[Any] = ...): ...
|
||||
|
||||
class BaseCookie(dict):
|
||||
class BaseCookie(Dict[Any, Any]):
|
||||
def value_decode(self, val): ...
|
||||
def value_encode(self, val): ...
|
||||
def __init__(self, input: Optional[Any] = ...): ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Stubs for Queue (Python 2)
|
||||
|
||||
from collections import deque
|
||||
from typing import Any, TypeVar, Generic, Optional
|
||||
from typing import Any, Deque, TypeVar, Generic, Optional
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
@@ -15,7 +15,7 @@ class Queue(Generic[_T]):
|
||||
not_full: Any
|
||||
all_tasks_done: Any
|
||||
unfinished_tasks: Any
|
||||
queue: deque # undocumented
|
||||
queue: Deque[Any] # undocumented
|
||||
def __init__(self, maxsize: int = ...) -> None: ...
|
||||
def task_done(self) -> None: ...
|
||||
def join(self) -> None: ...
|
||||
|
||||
@@ -9,7 +9,7 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
def do_GET(self) -> None: ...
|
||||
def do_HEAD(self) -> None: ...
|
||||
def send_head(self) -> Optional[IO[str]]: ...
|
||||
def list_directory(self, path: Union[str, unicode]) -> Optional[StringIO]: ...
|
||||
def list_directory(self, path: Union[str, unicode]) -> Optional[StringIO[Any]]: ...
|
||||
def translate_path(self, path: AnyStr) -> AnyStr: ...
|
||||
def copyfile(self, source: IO[AnyStr], outputfile: IO[AnyStr]): ...
|
||||
def guess_type(self, path: Union[str, unicode]) -> str: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import Iterable, MutableSequence, TypeVar, Union, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_ULT = TypeVar("_ULT", bound=UserList)
|
||||
_S = TypeVar("_S")
|
||||
|
||||
class UserList(MutableSequence[_T]):
|
||||
def insert(self, index: int, object: _T) -> None: ...
|
||||
@@ -14,5 +14,5 @@ class UserList(MutableSequence[_T]):
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(self: _ULT, s: slice) -> _ULT: ...
|
||||
def __getitem__(self: _S, s: slice) -> _S: ...
|
||||
def sort(self) -> None: ...
|
||||
|
||||
@@ -870,7 +870,7 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
@overload
|
||||
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
|
||||
@overload
|
||||
def __add__(self, x: tuple) -> tuple: ...
|
||||
def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ...
|
||||
def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
|
||||
def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
|
||||
def count(self, x: Any) -> int: ...
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
"""Stub file for the '_collections' module."""
|
||||
|
||||
from typing import Any, Generic, Iterator, TypeVar, Optional, Union
|
||||
|
||||
class defaultdict(dict):
|
||||
default_factory: None
|
||||
def __init__(self, default: Any = ..., init: Any = ...) -> None: ...
|
||||
def __missing__(self, key) -> Any:
|
||||
raise KeyError()
|
||||
def __copy__(self) -> defaultdict: ...
|
||||
def copy(self) -> defaultdict: ...
|
||||
from typing import Any, Callable, Dict, Generic, Iterator, TypeVar, Optional, Union
|
||||
|
||||
_K = TypeVar("_K")
|
||||
_V = TypeVar("_V")
|
||||
_T = TypeVar('_T')
|
||||
_T2 = TypeVar('_T2')
|
||||
|
||||
class defaultdict(Dict[_K, _V]):
|
||||
default_factory: None
|
||||
def __init__(self, __default_factory: Callable[[], _V] = ..., init: Any = ...) -> None: ...
|
||||
def __missing__(self, key: _K) -> _V: ...
|
||||
def __copy__(self: _T) -> _T: ...
|
||||
def copy(self: _T) -> _T: ...
|
||||
|
||||
class deque(Generic[_T]):
|
||||
maxlen: Optional[int]
|
||||
def __init__(self, iterable: Iterator[_T] = ..., maxlen: int = ...) -> None: ...
|
||||
|
||||
@@ -14,7 +14,7 @@ def logreader(a: str) -> LogReaderType:
|
||||
def profiler(a: str, *args, **kwargs) -> Any:
|
||||
raise IOError()
|
||||
|
||||
def resolution() -> tuple: ...
|
||||
def resolution() -> Tuple[Any, ...]: ...
|
||||
|
||||
|
||||
class LogReaderType(object):
|
||||
|
||||
@@ -84,8 +84,8 @@ class BufferedWriter(_BufferedIOBase):
|
||||
|
||||
class BytesIO(_BufferedIOBase):
|
||||
def __init__(self, initial_bytes: bytes = ...) -> None: ...
|
||||
def __setstate__(self, tuple) -> None: ...
|
||||
def __getstate__(self) -> tuple: ...
|
||||
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
|
||||
def __getstate__(self) -> Tuple[Any, ...]: ...
|
||||
# BytesIO does not contain a "name" field. This workaround is necessary
|
||||
# to allow BytesIO sub-classes to add this field, as it is defined
|
||||
# as a read-only property on IO[].
|
||||
@@ -129,7 +129,7 @@ class _TextIOBase(TextIO):
|
||||
def _checkSeekable(self) -> None: ...
|
||||
def _checkWritable(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def detach(self) -> IO: ...
|
||||
def detach(self) -> IO[Any]: ...
|
||||
def fileno(self) -> int: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
@@ -154,8 +154,8 @@ class StringIO(_TextIOBase):
|
||||
def __init__(self,
|
||||
initial_value: Optional[unicode] = ...,
|
||||
newline: Optional[unicode] = ...) -> None: ...
|
||||
def __setstate__(self, state: tuple) -> None: ...
|
||||
def __getstate__(self) -> tuple: ...
|
||||
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
|
||||
def __getstate__(self) -> Tuple[Any, ...]: ...
|
||||
# StringIO does not contain a "name" field. This workaround is necessary
|
||||
# to allow StringIO sub-classes to add this field, as it is defined
|
||||
# as a read-only property on IO[].
|
||||
@@ -167,12 +167,15 @@ class TextIOWrapper(_TextIOBase):
|
||||
line_buffering: bool
|
||||
buffer: BinaryIO
|
||||
_CHUNK_SIZE: int
|
||||
def __init__(self, buffer: IO,
|
||||
encoding: Optional[Text] = ...,
|
||||
errors: Optional[Text] = ...,
|
||||
newline: Optional[Text] = ...,
|
||||
line_buffering: bool = ...,
|
||||
write_through: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
buffer: IO[Any],
|
||||
encoding: Optional[Text] = ...,
|
||||
errors: Optional[Text] = ...,
|
||||
newline: Optional[Text] = ...,
|
||||
line_buffering: bool = ...,
|
||||
write_through: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
def open(file: Union[str, unicode, int],
|
||||
mode: Text = ...,
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
"""Stub file for the '_json' module."""
|
||||
# This is an autogenerated file. It serves as a starting point
|
||||
# for a more precise manual annotation of this module.
|
||||
# Feel free to edit the source below, but remove this header when you do.
|
||||
|
||||
from typing import Any, List, Tuple, Dict, Generic
|
||||
|
||||
def encode_basestring_ascii(*args, **kwargs) -> str:
|
||||
raise TypeError()
|
||||
|
||||
def scanstring(a, b, *args, **kwargs) -> tuple:
|
||||
raise TypeError()
|
||||
from typing import Any, List, Tuple, Dict, Generic, Tuple
|
||||
|
||||
def encode_basestring_ascii(*args, **kwargs) -> str: ...
|
||||
def scanstring(a, b, *args, **kwargs) -> Tuple[Any, ...]: ...
|
||||
|
||||
class Encoder(object): ...
|
||||
|
||||
class Scanner(object): ...
|
||||
|
||||
@@ -253,17 +253,17 @@ class SocketType(object):
|
||||
timeout: float
|
||||
|
||||
def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ...
|
||||
def accept(self) -> Tuple[SocketType, tuple]: ...
|
||||
def bind(self, address: tuple) -> None: ...
|
||||
def accept(self) -> Tuple[SocketType, Tuple[Any, ...]]: ...
|
||||
def bind(self, address: Tuple[Any, ...]) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def connect(self, address: tuple) -> None:
|
||||
def connect(self, address: Tuple[Any, ...]) -> None:
|
||||
raise gaierror
|
||||
raise timeout
|
||||
def connect_ex(self, address: tuple) -> int: ...
|
||||
def connect_ex(self, address: Tuple[Any, ...]) -> int: ...
|
||||
def dup(self) -> SocketType: ...
|
||||
def fileno(self) -> int: ...
|
||||
def getpeername(self) -> tuple: ...
|
||||
def getsockname(self) -> tuple: ...
|
||||
def getpeername(self) -> Tuple[Any, ...]: ...
|
||||
def getsockname(self) -> Tuple[Any, ...]: ...
|
||||
def getsockopt(self, level: int, option: int, buffersize: int = ...) -> str: ...
|
||||
def gettimeout(self) -> float: ...
|
||||
def listen(self, backlog: int) -> None:
|
||||
@@ -271,16 +271,16 @@ class SocketType(object):
|
||||
def makefile(self, mode: str = ..., buffersize: int = ...) -> IO[Any]: ...
|
||||
def recv(self, buffersize: int, flags: int = ...) -> str: ...
|
||||
def recv_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ...
|
||||
def recvfrom(self, buffersize: int, flags: int = ...) -> tuple:
|
||||
def recvfrom(self, buffersize: int, flags: int = ...) -> Tuple[Any, ...]:
|
||||
raise error
|
||||
def recvfrom_into(self, buffer: bytearray, nbytes: int = ...,
|
||||
flags: int = ...) -> int: ...
|
||||
def send(self, data: str, flags: int = ...) -> int: ...
|
||||
def sendall(self, data: str, flags: int = ...) -> None: ...
|
||||
@overload
|
||||
def sendto(self, data: str, address: tuple) -> int: ...
|
||||
def sendto(self, data: str, address: Tuple[Any, ...]) -> int: ...
|
||||
@overload
|
||||
def sendto(self, data: str, flags: int, address: tuple) -> int: ...
|
||||
def sendto(self, data: str, flags: int, address: Tuple[Any, ...]) -> int: ...
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
def setsockopt(self, level: int, option: int, value: Union[int, str]) -> None: ...
|
||||
def settimeout(self, value: Optional[float]) -> None: ...
|
||||
|
||||
@@ -35,14 +35,14 @@ class SRE_Pattern(object):
|
||||
groups: int
|
||||
groupindex: Mapping[str, int]
|
||||
indexgroup: Sequence[int]
|
||||
def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Union[tuple, str]]: ...
|
||||
def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Union[tuple, str]]: ...
|
||||
def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Union[Tuple[Any, ...], str]]: ...
|
||||
def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Union[Tuple[Any, ...], str]]: ...
|
||||
def match(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
|
||||
def scanner(self, s: str, start: int = ..., end: int = ...) -> SRE_Scanner: ...
|
||||
def search(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
|
||||
def split(self, source: str, maxsplit: int = ...) -> List[Optional[str]]: ...
|
||||
def sub(self, repl: str, string: str, count: int = ...) -> tuple: ...
|
||||
def subn(self, repl: str, string: str, count: int = ...) -> tuple: ...
|
||||
def sub(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...
|
||||
def subn(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...
|
||||
|
||||
def compile(pattern: str, flags: int, code: List[int],
|
||||
groups: int = ...,
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
from typing import Any, List, Optional, Type
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type
|
||||
|
||||
default_action: str
|
||||
filters: List[tuple]
|
||||
once_registry: dict
|
||||
filters: List[Tuple[Any, ...]]
|
||||
once_registry: Dict[Any, Any]
|
||||
|
||||
def warn(message: Warning, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
|
||||
def warn_explicit(message: Warning, category: Optional[Type[Warning]],
|
||||
filename: str, lineno: int,
|
||||
module: Any = ..., registry: dict = ...,
|
||||
module_globals: dict = ...) -> None: ...
|
||||
def warn_explicit(
|
||||
message: Warning,
|
||||
category: Optional[Type[Warning]],
|
||||
filename: str,
|
||||
lineno: int,
|
||||
module: Any = ...,
|
||||
registry: Dict[Any, Any] = ...,
|
||||
module_globals: Dict[Any, Any] = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -10,11 +10,11 @@ def abstractmethod(funcobj: _FuncT) -> _FuncT: ...
|
||||
class ABCMeta(type):
|
||||
# TODO: FrozenSet
|
||||
__abstractmethods__: Set[Any]
|
||||
_abc_cache: _weakrefset.WeakSet
|
||||
_abc_cache: _weakrefset.WeakSet[Any]
|
||||
_abc_invalidation_counter: int
|
||||
_abc_negative_cache: _weakrefset.WeakSet
|
||||
_abc_negative_cache: _weakrefset.WeakSet[Any]
|
||||
_abc_negative_cache_version: int
|
||||
_abc_registry: _weakrefset.WeakSet
|
||||
_abc_registry: _weakrefset.WeakSet[Any]
|
||||
def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[Any, Any]) -> None: ...
|
||||
def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ...
|
||||
def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# These are not exported.
|
||||
from typing import Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
|
||||
from typing import Any, Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
|
||||
|
||||
# These are exported.
|
||||
from typing import (
|
||||
@@ -28,7 +28,7 @@ _VT = TypeVar('_VT')
|
||||
|
||||
# namedtuple is special-cased in the type checker; the initializer is ignored.
|
||||
def namedtuple(typename: Union[str, unicode], field_names: Union[str, unicode, Iterable[Union[str, unicode]]],
|
||||
verbose: bool = ..., rename: bool = ...) -> Type[tuple]: ...
|
||||
verbose: bool = ..., rename: bool = ...) -> Type[Tuple[Any, ...]]: ...
|
||||
|
||||
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...,
|
||||
@@ -56,8 +56,6 @@ class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ...
|
||||
|
||||
_CounterT = TypeVar('_CounterT', bound=Counter)
|
||||
|
||||
class Counter(Dict[_T, int], Generic[_T]):
|
||||
@overload
|
||||
def __init__(self, **kwargs: int) -> None: ...
|
||||
@@ -65,7 +63,7 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
def __init__(self, mapping: Mapping[_T, int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def copy(self: _CounterT) -> _CounterT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
def elements(self) -> Iterator[_T]: ...
|
||||
def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ...
|
||||
@overload
|
||||
@@ -93,15 +91,11 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
def __iand__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __ior__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
|
||||
_OrderedDictT = TypeVar('_OrderedDictT', bound=OrderedDict)
|
||||
|
||||
class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
|
||||
def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ...
|
||||
def copy(self: _OrderedDictT) -> _OrderedDictT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
def __reversed__(self) -> Iterator[_KT]: ...
|
||||
|
||||
_DefaultDictT = TypeVar('_DefaultDictT', bound=defaultdict)
|
||||
|
||||
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
default_factory: Callable[[], _VT]
|
||||
@overload
|
||||
@@ -123,4 +117,4 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __init__(self, default_factory: Optional[Callable[[], _VT]],
|
||||
iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
def __missing__(self, key: _KT) -> _VT: ...
|
||||
def copy(self: _DefaultDictT) -> _DefaultDictT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
# Stubs for compileall (Python 2)
|
||||
|
||||
from typing import Optional, Pattern, Union
|
||||
from typing import Any, Optional, Pattern, Union
|
||||
|
||||
_Path = Union[str, bytes]
|
||||
|
||||
# rx can be any object with a 'search' method; once we have Protocols we can change the type
|
||||
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> int: ...
|
||||
def compile_file(fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> int: ...
|
||||
def compile_dir(
|
||||
dir: _Path,
|
||||
maxlevels: int = ...,
|
||||
ddir: Optional[_Path] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
) -> int: ...
|
||||
def compile_file(
|
||||
fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...,
|
||||
) -> int: ...
|
||||
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from typing import Generator
|
||||
from typing import Any, Generator
|
||||
|
||||
def walk(self) -> Generator: ...
|
||||
def body_line_iterator(msg, decode: bool = ...) -> Generator: ...
|
||||
def typed_subpart_iterator(msg, maintype=..., subtype=...) -> Generator: ...
|
||||
def walk(self) -> Generator[Any, Any, Any]: ...
|
||||
def body_line_iterator(msg, decode: bool = ...) -> Generator[Any, Any, Any]: ...
|
||||
def typed_subpart_iterator(msg, maintype=..., subtype=...) -> Generator[Any, Any, Any]: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Generator
|
||||
from typing import Any, Generator
|
||||
|
||||
class Message:
|
||||
preamble = ...
|
||||
@@ -42,4 +42,4 @@ class Message:
|
||||
def set_boundary(self, boundary) -> None: ...
|
||||
def get_content_charset(self, failobj=...): ...
|
||||
def get_charsets(self, failobj=...): ...
|
||||
def walk(self) -> Generator: ...
|
||||
def walk(self) -> Generator[Any, Any, Any]: ...
|
||||
|
||||
@@ -52,8 +52,7 @@ def isgetsetdescriptor(object: object) -> bool: ...
|
||||
def ismemberdescriptor(object: object) -> bool: ...
|
||||
|
||||
# Retrieving source code
|
||||
_SourceObjectType = Union[ModuleType, Type, MethodType, FunctionType,
|
||||
TracebackType, FrameType, CodeType]
|
||||
_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType]
|
||||
|
||||
def findsource(object: _SourceObjectType) -> Tuple[List[str], int]: ...
|
||||
def getabsfile(object: _SourceObjectType) -> str: ...
|
||||
@@ -69,13 +68,12 @@ def cleandoc(doc: str) -> str: ...
|
||||
def indentsize(line: str) -> int: ...
|
||||
|
||||
# Classes and functions
|
||||
def getclasstree(classes: List[type], unique: bool = ...) -> List[
|
||||
Union[Tuple[type, Tuple[type, ...]], list]]: ...
|
||||
def getclasstree(classes: List[type], unique: bool = ...) -> List[Union[Tuple[type, Tuple[type, ...]], List[Any]]]: ...
|
||||
|
||||
ArgSpec = NamedTuple('ArgSpec', [('args', List[str]),
|
||||
('varargs', Optional[str]),
|
||||
('keywords', Optional[str]),
|
||||
('defaults', tuple),
|
||||
('defaults', Tuple[Any, ...]),
|
||||
])
|
||||
|
||||
ArgInfo = NamedTuple('ArgInfo', [('args', List[str]),
|
||||
|
||||
@@ -36,7 +36,7 @@ def dump(obj: Any,
|
||||
def loads(s: Union[Text, bytes],
|
||||
encoding: Any = ...,
|
||||
cls: Optional[Type[JSONDecoder]] = ...,
|
||||
object_hook: Optional[Callable[[Dict], Any]] = ...,
|
||||
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
@@ -49,7 +49,7 @@ class _Reader(Protocol):
|
||||
def load(fp: _Reader,
|
||||
encoding: Optional[str] = ...,
|
||||
cls: Optional[Type[JSONDecoder]] = ...,
|
||||
object_hook: Optional[Callable[[Dict], Any]] = ...,
|
||||
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
|
||||
@@ -14,7 +14,7 @@ from Queue import Queue
|
||||
|
||||
|
||||
class DummyProcess(threading.Thread):
|
||||
_children: weakref.WeakKeyDictionary
|
||||
_children: weakref.WeakKeyDictionary[Any, Any]
|
||||
_parent: threading.Thread
|
||||
_pid: None
|
||||
_start_called: bool
|
||||
@@ -42,10 +42,10 @@ class Value(object):
|
||||
|
||||
JoinableQueue = Queue
|
||||
|
||||
def Array(typecode, sequence, lock=...) -> array.array: ...
|
||||
def Array(typecode, sequence, lock=...) -> array.array[Any]: ...
|
||||
def Manager() -> Any: ...
|
||||
def Pool(processes=..., initializer=..., initargs=...) -> Any: ...
|
||||
def active_children() -> List: ...
|
||||
def active_children() -> List[Any]: ...
|
||||
def current_process() -> threading.Thread: ...
|
||||
def freeze_support() -> None: ...
|
||||
def shutdown() -> None: ...
|
||||
|
||||
@@ -15,7 +15,7 @@ class Connection(object):
|
||||
def poll(self, timeout=...) -> Any: ...
|
||||
|
||||
class Listener(object):
|
||||
_backlog_queue: Optional[Queue]
|
||||
_backlog_queue: Optional[Queue[Any]]
|
||||
address: Any
|
||||
def __init__(self, address=..., family=..., backlog=...) -> None: ...
|
||||
def accept(self) -> Connection: ...
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# Source: https://hg.python.org/cpython/file/2.7/Lib/mutex.py
|
||||
|
||||
from collections import deque
|
||||
from typing import Any, Callable, TypeVar
|
||||
from typing import Any, Callable, Deque, TypeVar
|
||||
|
||||
_ArgType = TypeVar('_ArgType')
|
||||
|
||||
class mutex:
|
||||
locked: bool
|
||||
queue: deque
|
||||
queue: Deque[Any]
|
||||
def __init__(self) -> None: ...
|
||||
def test(self) -> bool: ...
|
||||
def testandset(self) -> bool: ...
|
||||
|
||||
@@ -5,24 +5,24 @@ _T = TypeVar('_T')
|
||||
|
||||
class Popen3:
|
||||
sts: int
|
||||
cmd: Iterable
|
||||
cmd: Iterable[Any]
|
||||
pid: int
|
||||
tochild: TextIO
|
||||
fromchild: TextIO
|
||||
childerr: Optional[TextIO]
|
||||
def __init__(self, cmd: Iterable = ..., capturestderr: bool = ..., bufsize: int = ...) -> None: ...
|
||||
def __init__(self, cmd: Iterable[Any] = ..., capturestderr: bool = ..., bufsize: int = ...) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def poll(self, _deadstate: _T = ...) -> Union[int, _T]: ...
|
||||
def wait(self) -> int: ...
|
||||
|
||||
class Popen4(Popen3):
|
||||
childerr: None
|
||||
cmd: Iterable
|
||||
cmd: Iterable[Any]
|
||||
pid: int
|
||||
tochild: TextIO
|
||||
fromchild: TextIO
|
||||
def __init__(self, cmd: Iterable = ..., bufsize: int = ...) -> None: ...
|
||||
def __init__(self, cmd: Iterable[Any] = ..., bufsize: int = ...) -> None: ...
|
||||
|
||||
def popen2(cmd: Iterable = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
|
||||
def popen3(cmd: Iterable = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO, TextIO]: ...
|
||||
def popen4(cmd: Iterable = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
|
||||
def popen2(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
|
||||
def popen3(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO, TextIO]: ...
|
||||
def popen4(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from typing import Any, List
|
||||
|
||||
class Repr:
|
||||
maxarray: int
|
||||
maxdeque: int
|
||||
@@ -25,7 +27,7 @@ class Repr:
|
||||
def repr_str(self, x, level: complex) -> str: ...
|
||||
def repr_tuple(self, x, level: complex) -> str: ...
|
||||
|
||||
def _possibly_sorted(x) -> list: ...
|
||||
def _possibly_sorted(x) -> List[Any]: ...
|
||||
|
||||
aRepr: Repr
|
||||
def repr(x) -> str: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import Any, Callable, Hashable, Iterable, Iterator, MutableMapping,
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_Setlike = Union[BaseSet[_T], Iterable[_T]]
|
||||
_SelfT = TypeVar('_SelfT', bound=BaseSet)
|
||||
_SelfT = TypeVar('_SelfT')
|
||||
|
||||
class BaseSet(Iterable[_T]):
|
||||
def __init__(self) -> None: ...
|
||||
@@ -18,13 +18,13 @@ class BaseSet(Iterable[_T]):
|
||||
def __copy__(self: _SelfT) -> _SelfT: ...
|
||||
def __deepcopy__(self: _SelfT, memo: MutableMapping[int, BaseSet[_T]]) -> _SelfT: ...
|
||||
def __or__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def union(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def union(self: _SelfT, other: _Setlike[_T]) -> _SelfT: ...
|
||||
def __and__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def intersection(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def intersection(self: _SelfT, other: _Setlike[Any]) -> _SelfT: ...
|
||||
def __xor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def symmetric_difference(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def symmetric_difference(self: _SelfT, other: _Setlike[_T]) -> _SelfT: ...
|
||||
def __sub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def difference(self: _SelfT, other: _Setlike) -> _SelfT: ...
|
||||
def difference(self: _SelfT, other: _Setlike[Any]) -> _SelfT: ...
|
||||
def __contains__(self, element: Any) -> bool: ...
|
||||
def issubset(self, other: BaseSet[_T]) -> bool: ...
|
||||
def issuperset(self, other: BaseSet[_T]) -> bool: ...
|
||||
@@ -34,20 +34,20 @@ class BaseSet(Iterable[_T]):
|
||||
def __gt__(self, other: BaseSet[_T]) -> bool: ...
|
||||
|
||||
class ImmutableSet(BaseSet[_T], Hashable):
|
||||
def __init__(self, iterable: Optional[_Setlike] = ...) -> None: ...
|
||||
def __init__(self, iterable: Optional[_Setlike[_T]] = ...) -> None: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
class Set(BaseSet[_T]):
|
||||
def __init__(self, iterable: Optional[_Setlike] = ...) -> None: ...
|
||||
def __ior__(self, other: BaseSet[_T]) -> Set: ...
|
||||
def union_update(self, other: _Setlike) -> None: ...
|
||||
def __iand__(self, other: BaseSet[_T]) -> Set: ...
|
||||
def intersection_update(self, other: _Setlike) -> None: ...
|
||||
def __ixor__(self, other: BaseSet[_T]) -> Set: ...
|
||||
def symmetric_difference_update(self, other: _Setlike) -> None: ...
|
||||
def __isub__(self, other: BaseSet[_T]) -> Set: ...
|
||||
def difference_update(self, other: _Setlike) -> None: ...
|
||||
def update(self, iterable: _Setlike) -> None: ...
|
||||
def __init__(self, iterable: Optional[_Setlike[_T]] = ...) -> None: ...
|
||||
def __ior__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def union_update(self, other: _Setlike[_T]) -> None: ...
|
||||
def __iand__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def intersection_update(self, other: _Setlike[Any]) -> None: ...
|
||||
def __ixor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def symmetric_difference_update(self, other: _Setlike[_T]) -> None: ...
|
||||
def __isub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
|
||||
def difference_update(self, other: _Setlike[Any]) -> None: ...
|
||||
def update(self, iterable: _Setlike[_T]) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def add(self, element: _T) -> None: ...
|
||||
def remove(self, element: _T) -> None: ...
|
||||
|
||||
@@ -2,7 +2,7 @@ from typing import Any, Dict, Iterator, List, Optional, Tuple
|
||||
import collections
|
||||
|
||||
|
||||
class Shelf(collections.MutableMapping):
|
||||
class Shelf(collections.MutableMapping[Any, Any]):
|
||||
def __init__(self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def keys(self) -> List[Any]: ...
|
||||
|
||||
@@ -4,10 +4,10 @@ from typing import Any, Dict, Iterable, List, Match, Optional, Pattern as _Patte
|
||||
|
||||
SPECIAL_CHARS: str
|
||||
REPEAT_CHARS: str
|
||||
DIGITS: Set
|
||||
OCTDIGITS: Set
|
||||
HEXDIGITS: Set
|
||||
WHITESPACE: Set
|
||||
DIGITS: Set[Any]
|
||||
OCTDIGITS: Set[Any]
|
||||
HEXDIGITS: Set[Any]
|
||||
WHITESPACE: Set[Any]
|
||||
ESCAPES: Dict[str, Tuple[str, int]]
|
||||
CATEGORIES: Dict[str, Union[Tuple[str, str], Tuple[str, List[Tuple[str, str]]]]]
|
||||
FLAGS: Dict[str, int]
|
||||
@@ -59,5 +59,5 @@ def isdigit(char: str) -> bool: ...
|
||||
def isname(name: str) -> bool: ...
|
||||
def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ...
|
||||
_Template = Tuple[List[Tuple[int, int]], List[Optional[int]]]
|
||||
def parse_template(source: str, pattern: _Pattern) -> _Template: ...
|
||||
def expand_template(template: _Template, match: Match) -> str: ...
|
||||
def parse_template(source: str, pattern: _Pattern[Any]) -> _Template: ...
|
||||
def expand_template(template: _Template, match: Match[Any]) -> str: ...
|
||||
|
||||
@@ -105,8 +105,6 @@ class Popen(Generic[_T]):
|
||||
def send_signal(self, signal: int) -> None: ...
|
||||
def terminate(self) -> None: ...
|
||||
def kill(self) -> None: ...
|
||||
def __enter__(self) -> Popen: ...
|
||||
def __exit__(self, type, value, traceback) -> None: ...
|
||||
|
||||
def list2cmdline(seq: Sequence[str]) -> str: ... # undocumented
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ class _RandomNameSequence:
|
||||
|
||||
class _TemporaryFileWrapper(IO[str]):
|
||||
delete: bool
|
||||
file: IO
|
||||
file: IO[str]
|
||||
name: Any
|
||||
def __init__(self, file: IO, name: Any, delete: bool = ...) -> None: ...
|
||||
def __init__(self, file: IO[str], name: Any, delete: bool = ...) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> _TemporaryFileWrapper: ...
|
||||
def __exit__(self, exc, value, tb) -> Optional[bool]: ...
|
||||
|
||||
@@ -103,7 +103,7 @@ class UnboundMethodType:
|
||||
__name__: str
|
||||
__func__ = im_func
|
||||
__self__ = im_self
|
||||
def __init__(self, func: Callable, obj: object) -> None: ...
|
||||
def __init__(self, func: Callable[..., Any], obj: object) -> None: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
class InstanceType(object): ...
|
||||
@@ -154,7 +154,7 @@ class EllipsisType: ...
|
||||
class DictProxyType:
|
||||
# TODO is it possible to have non-string keys?
|
||||
# no __init__
|
||||
def copy(self) -> dict: ...
|
||||
def copy(self) -> Dict[Any, Any]: ...
|
||||
def get(self, key: str, default: _T = ...) -> Union[Any, _T]: ...
|
||||
def has_key(self, key: str) -> bool: ...
|
||||
def items(self) -> List[Tuple[str, Any]]: ...
|
||||
|
||||
@@ -69,7 +69,7 @@ _KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers.
|
||||
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
|
||||
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
|
||||
_TC = TypeVar('_TC', bound=Type[object])
|
||||
_C = TypeVar("_C", bound=Callable)
|
||||
_C = TypeVar("_C", bound=Callable[..., Any])
|
||||
|
||||
def runtime_checkable(cls: _TC) -> _TC: ...
|
||||
|
||||
@@ -447,8 +447,9 @@ class Pattern(Generic[AnyStr]):
|
||||
|
||||
# Functions
|
||||
|
||||
def get_type_hints(obj: Callable, globalns: Optional[dict[Text, Any]] = ...,
|
||||
localns: Optional[dict[Text, Any]] = ...) -> None: ...
|
||||
def get_type_hints(
|
||||
obj: Callable[..., Any], globalns: Optional[Dict[Text, Any]] = ..., localns: Optional[Dict[Text, Any]] = ...,
|
||||
) -> None: ...
|
||||
|
||||
@overload
|
||||
def cast(tp: Type[_T], obj: Any) -> _T: ...
|
||||
@@ -458,7 +459,7 @@ def cast(tp: str, obj: Any) -> Any: ...
|
||||
# Type constructors
|
||||
|
||||
# NamedTuple is special-cased in the type checker
|
||||
class NamedTuple(tuple):
|
||||
class NamedTuple(Tuple[Any, ...]):
|
||||
_fields: Tuple[str, ...]
|
||||
|
||||
def __init__(self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ..., *,
|
||||
@@ -467,7 +468,7 @@ class NamedTuple(tuple):
|
||||
@classmethod
|
||||
def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ...
|
||||
|
||||
def _asdict(self) -> dict: ...
|
||||
def _asdict(self) -> Dict[str, Any]: ...
|
||||
def _replace(self: _T, **kwargs: Any) -> _T: ...
|
||||
|
||||
# Internal mypy fallback type for all typed dicts (does not exist at runtime)
|
||||
|
||||
@@ -12,7 +12,7 @@ from gzip import GzipFile
|
||||
_Unmarshaller = Any
|
||||
_timeTuple = Tuple[int, int, int, int, int, int, int, int, int]
|
||||
# Represents types that can be compared against a DateTime object
|
||||
_dateTimeComp = Union[AnyStr, DateTime, datetime, _timeTuple]
|
||||
_dateTimeComp = Union[unicode, DateTime, datetime]
|
||||
# A "host description" used by Transport factories
|
||||
_hostDesc = Union[str, Tuple[str, Mapping[Any, Any]]]
|
||||
|
||||
@@ -55,26 +55,26 @@ Boolean: Type[bool]
|
||||
class DateTime:
|
||||
value: str
|
||||
def __init__(self, value: Union[str, unicode, datetime, float, int, _timeTuple, struct_time] = ...) -> None: ...
|
||||
def make_comparable(self, other: _dateTimeComp) -> Tuple[_dateTimeComp, _dateTimeComp]: ...
|
||||
def make_comparable(self, other: _dateTimeComp) -> Tuple[unicode, unicode]: ...
|
||||
def __lt__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __le__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __gt__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __ge__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __eq__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __ne__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __eq__(self, other: _dateTimeComp) -> bool: ... # type: ignore
|
||||
def __ne__(self, other: _dateTimeComp) -> bool: ... # type: ignore
|
||||
def timetuple(self) -> struct_time: ...
|
||||
def __cmp__(self, other: _dateTimeComp) -> int: ...
|
||||
def decode(self, data: Any) -> None: ...
|
||||
def encode(self, out: IO) -> None: ...
|
||||
def encode(self, out: IO[str]) -> None: ...
|
||||
|
||||
class Binary:
|
||||
data: str
|
||||
def __init__(self, data: Optional[str] = ...) -> None: ...
|
||||
def __cmp__(self, other: Any) -> int: ...
|
||||
def decode(self, data: str) -> None: ...
|
||||
def encode(self, out: IO) -> None: ...
|
||||
def encode(self, out: IO[str]) -> None: ...
|
||||
|
||||
WRAPPERS: tuple
|
||||
WRAPPERS: Tuple[Type[Any], ...]
|
||||
|
||||
# Still part of the public API, but see http://bugs.python.org/issue1773632
|
||||
FastParser: None
|
||||
@@ -104,7 +104,28 @@ class Marshaller:
|
||||
allow_none: bool
|
||||
def __init__(self, encoding: Optional[str] = ..., allow_none: bool = ...) -> None: ...
|
||||
dispatch: Mapping[type, Callable[[Marshaller, str, Callable[[str], None]], None]]
|
||||
def dumps(self, values: Union[Iterable[Union[None, int, bool, long, float, str, unicode, List, Tuple, Mapping, datetime, InstanceType]], Fault]) -> str: ...
|
||||
def dumps(
|
||||
self,
|
||||
values: Union[
|
||||
Iterable[
|
||||
Union[
|
||||
None,
|
||||
int,
|
||||
bool,
|
||||
long,
|
||||
float,
|
||||
str,
|
||||
unicode,
|
||||
List[Any],
|
||||
Tuple[Any, ...],
|
||||
Mapping[Any, Any],
|
||||
datetime,
|
||||
InstanceType,
|
||||
],
|
||||
],
|
||||
Fault,
|
||||
],
|
||||
) -> str: ...
|
||||
def dump_nil(self, value: None, write: Callable[[str], None]) -> None: ...
|
||||
def dump_int(self, value: int, write: Callable[[str], None]) -> None: ...
|
||||
def dump_bool(self, value: bool, write: Callable[[str], None]) -> None: ...
|
||||
@@ -112,15 +133,20 @@ class Marshaller:
|
||||
def dump_double(self, value: float, write: Callable[[str], None]) -> None: ...
|
||||
def dump_string(self, value: str, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
|
||||
def dump_unicode(self, value: unicode, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
|
||||
def dump_array(self, value: Union[List, Tuple], write: Callable[[str], None]) -> None: ...
|
||||
def dump_struct(self, value: Mapping, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
|
||||
def dump_array(self, value: Iterable[Any], write: Callable[[str], None]) -> None: ...
|
||||
def dump_struct(
|
||||
self,
|
||||
value: Mapping[unicode, Any],
|
||||
write: Callable[[str], None],
|
||||
escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...,
|
||||
) -> None: ...
|
||||
def dump_datetime(self, value: datetime, write: Callable[[str], None]) -> None: ...
|
||||
def dump_instance(self, value: InstanceType, write: Callable[[str], None]) -> None: ...
|
||||
|
||||
class Unmarshaller:
|
||||
def append(self, object: Any) -> None: ...
|
||||
def __init__(self, use_datetime: bool = ...) -> None: ...
|
||||
def close(self) -> tuple: ...
|
||||
def close(self) -> Tuple[Any, ...]: ...
|
||||
def getmethodname(self) -> Optional[str]: ...
|
||||
def xml(self, encoding: str, standalone: bool) -> None: ...
|
||||
def start(self, tag: str, attrs: Any) -> None: ...
|
||||
@@ -143,9 +169,9 @@ class Unmarshaller:
|
||||
def end_methodName(self, data: str) -> None: ...
|
||||
|
||||
class _MultiCallMethod:
|
||||
def __init__(self, call_list: List[Tuple[str, tuple]], name: str) -> None: ...
|
||||
def __init__(self, call_list: List[Tuple[str, Tuple[Any, ...]]], name: str) -> None: ...
|
||||
class MultiCallIterator:
|
||||
def __init__(self, results: List) -> None: ...
|
||||
def __init__(self, results: List[Any]) -> None: ...
|
||||
|
||||
class MultiCall:
|
||||
def __init__(self, server: ServerProxy) -> None: ...
|
||||
@@ -153,19 +179,25 @@ class MultiCall:
|
||||
def __call__(self) -> MultiCallIterator: ...
|
||||
|
||||
def getparser(use_datetime: bool = ...) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
|
||||
def dumps(params: Union[tuple, Fault], methodname: Optional[str] = ..., methodresponse: Optional[bool] = ..., encoding: Optional[str] = ..., allow_none: bool = ...) -> str: ...
|
||||
def loads(data: str, use_datetime: bool = ...) -> Tuple[tuple, Optional[str]]: ...
|
||||
def dumps(
|
||||
params: Union[Tuple[Any, ...], Fault],
|
||||
methodname: Optional[str] = ...,
|
||||
methodresponse: Optional[bool] = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
allow_none: bool = ...,
|
||||
) -> str: ...
|
||||
def loads(data: str, use_datetime: bool = ...) -> Tuple[Tuple[Any, ...], Optional[str]]: ...
|
||||
|
||||
def gzip_encode(data: str) -> str: ...
|
||||
def gzip_decode(data: str, max_decode: int = ...) -> str: ...
|
||||
|
||||
class GzipDecodedResponse(GzipFile):
|
||||
stringio: StringIO
|
||||
stringio: StringIO[Any]
|
||||
def __init__(self, response: HTTPResponse) -> None: ...
|
||||
def close(self): ...
|
||||
|
||||
class _Method:
|
||||
def __init__(self, send: Callable[[str, tuple], Any], name: str) -> None: ...
|
||||
def __init__(self, send: Callable[[str, Tuple[Any, ...]], Any], name: str) -> None: ...
|
||||
def __getattr__(self, name: str) -> _Method: ...
|
||||
def __call__(self, *args: Any) -> Any: ...
|
||||
|
||||
@@ -174,9 +206,9 @@ class Transport:
|
||||
accept_gzip_encoding: bool
|
||||
encode_threshold: Optional[int]
|
||||
def __init__(self, use_datetime: bool = ...) -> None: ...
|
||||
def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
|
||||
def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ...
|
||||
verbose: bool
|
||||
def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
|
||||
def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ...
|
||||
def getparser(self) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
|
||||
def get_host_info(self, host: _hostDesc) -> Tuple[str, Optional[List[Tuple[str, str]]], Optional[Mapping[Any, Any]]]: ...
|
||||
def make_connection(self, host: _hostDesc) -> HTTPConnection: ...
|
||||
@@ -185,7 +217,7 @@ class Transport:
|
||||
def send_host(self, connection: HTTPConnection, host: str) -> None: ...
|
||||
def send_user_agent(self, connection: HTTPConnection) -> None: ...
|
||||
def send_content(self, connection: HTTPConnection, request_body: str) -> None: ...
|
||||
def parse_response(self, response: HTTPResponse) -> tuple: ...
|
||||
def parse_response(self, response: HTTPResponse) -> Tuple[Any, ...]: ...
|
||||
|
||||
class SafeTransport(Transport):
|
||||
def __init__(self, use_datetime: bool = ..., context: Optional[SSLContext] = ...) -> None: ...
|
||||
|
||||
@@ -870,7 +870,7 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
@overload
|
||||
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
|
||||
@overload
|
||||
def __add__(self, x: tuple) -> tuple: ...
|
||||
def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ...
|
||||
def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
|
||||
def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
|
||||
def count(self, x: Any) -> int: ...
|
||||
|
||||
@@ -7,7 +7,7 @@ localdict = Dict[Any, Any]
|
||||
|
||||
class _localimpl:
|
||||
key: str
|
||||
dicts: Dict[int, Tuple[ReferenceType, localdict]]
|
||||
dicts: Dict[int, Tuple[ReferenceType[Any], localdict]]
|
||||
def __init__(self) -> None: ...
|
||||
def get_dict(self) -> localdict: ...
|
||||
def create_dict(self) -> localdict: ...
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# for a more precise manual annotation of this module.
|
||||
# Feel free to edit the source below, but remove this header when you do.
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, Tuple
|
||||
|
||||
def _get_object_traceback(*args, **kwargs) -> Any: ...
|
||||
|
||||
@@ -14,7 +14,7 @@ def clear_traces() -> None: ...
|
||||
|
||||
def get_traceback_limit() -> int: ...
|
||||
|
||||
def get_traced_memory() -> tuple: ...
|
||||
def get_traced_memory() -> Tuple[Any, ...]: ...
|
||||
|
||||
def get_tracemalloc_memory() -> Any: ...
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from typing import Any, List, Optional, Type
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type
|
||||
|
||||
_defaultaction: str
|
||||
_onceregistry: dict
|
||||
filters: List[tuple]
|
||||
_onceregistry: Dict[Any, Any]
|
||||
filters: List[Tuple[Any, ...]]
|
||||
|
||||
def warn(message: Warning, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
|
||||
def warn_explicit(message: Warning, category: Optional[Type[Warning]],
|
||||
filename: str, lineno: int,
|
||||
module: Any = ..., registry: dict = ...,
|
||||
module_globals: dict = ...) -> None: ...
|
||||
module: Any = ..., registry: Dict[Any, Any] = ...,
|
||||
module_globals: Dict[Any, Any] = ...) -> None: ...
|
||||
|
||||
@@ -61,7 +61,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
|
||||
family: int = ..., type: int = ..., proto: int = ...,
|
||||
flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any, ...]]]]: ...
|
||||
@coroutine
|
||||
def getnameinfo(self, sockaddr: tuple, flags: int = ...) -> Generator[Any, None, Tuple[str, int]]: ...
|
||||
def getnameinfo(self, sockaddr: Tuple[Any, ...], flags: int = ...) -> Generator[Any, None, Tuple[str, int]]: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
async def sock_sendfile(self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *,
|
||||
fallback: bool = ...) -> int: ...
|
||||
|
||||
@@ -107,7 +107,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
|
||||
flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any, ...]]]]: ...
|
||||
@abstractmethod
|
||||
@coroutine
|
||||
def getnameinfo(self, sockaddr: tuple, flags: int = ...) -> Generator[Any, None, Tuple[str, int]]: ...
|
||||
def getnameinfo(self, sockaddr: Tuple[Any, ...], flags: int = ...) -> Generator[Any, None, Tuple[str, int]]: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
@abstractmethod
|
||||
async def sock_sendfile(self, sock: socket, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *,
|
||||
|
||||
@@ -14,7 +14,7 @@ if sys.version_info >= (3, 7):
|
||||
__all__: List[str]
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_S = TypeVar('_S', bound=Future)
|
||||
_S = TypeVar('_S')
|
||||
|
||||
class InvalidStateError(Error): ...
|
||||
|
||||
|
||||
@@ -95,9 +95,9 @@ def wait_for(fut: _FutureT[_T], timeout: Optional[float],
|
||||
|
||||
class Task(Future[_T], Generic[_T]):
|
||||
@classmethod
|
||||
def current_task(cls, loop: Optional[AbstractEventLoop] = ...) -> Task: ...
|
||||
def current_task(cls, loop: Optional[AbstractEventLoop] = ...) -> Task[Any]: ...
|
||||
@classmethod
|
||||
def all_tasks(cls, loop: Optional[AbstractEventLoop] = ...) -> Set[Task]: ...
|
||||
def all_tasks(cls, loop: Optional[AbstractEventLoop] = ...) -> Set[Task[Any]]: ...
|
||||
def __init__(self, coro: Union[Generator[Any, None, _T], Awaitable[_T]], *, loop: AbstractEventLoop = ...) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def get_stack(self, *, limit: int = ...) -> List[FrameType]: ...
|
||||
@@ -107,6 +107,6 @@ class Task(Future[_T], Generic[_T]):
|
||||
def _wakeup(self, future: Future[Any]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def all_tasks(loop: Optional[AbstractEventLoop] = ...) -> Set[Task]: ...
|
||||
def create_task(coro: Union[Generator[Any, None, _T], Awaitable[_T]]) -> Task: ...
|
||||
def current_task(loop: Optional[AbstractEventLoop] = ...) -> Optional[Task]: ...
|
||||
def all_tasks(loop: Optional[AbstractEventLoop] = ...) -> Set[Task[Any]]: ...
|
||||
def create_task(coro: Union[Generator[Any, None, _T], Awaitable[_T]]) -> Task[Any]: ...
|
||||
def current_task(loop: Optional[AbstractEventLoop] = ...) -> Optional[Task[Any]]: ...
|
||||
|
||||
@@ -47,16 +47,27 @@ _VT = TypeVar('_VT')
|
||||
|
||||
# namedtuple is special-cased in the type checker; the initializer is ignored.
|
||||
if sys.version_info >= (3, 7):
|
||||
def namedtuple(typename: str, field_names: Union[str, Iterable[str]], *,
|
||||
rename: bool = ..., module: Optional[str] = ..., defaults: Optional[Iterable[Any]] = ...) -> Type[tuple]: ...
|
||||
def namedtuple(
|
||||
typename: str,
|
||||
field_names: Union[str, Iterable[str]],
|
||||
*,
|
||||
rename: bool = ...,
|
||||
module: Optional[str] = ...,
|
||||
defaults: Optional[Iterable[Any]] = ...,
|
||||
) -> Type[Tuple[Any, ...]]: ...
|
||||
elif sys.version_info >= (3, 6):
|
||||
def namedtuple(typename: str, field_names: Union[str, Iterable[str]], *,
|
||||
verbose: bool = ..., rename: bool = ..., module: Optional[str] = ...) -> Type[tuple]: ...
|
||||
def namedtuple(
|
||||
typename: str,
|
||||
field_names: Union[str, Iterable[str]],
|
||||
*,
|
||||
verbose: bool = ...,
|
||||
rename: bool = ...,
|
||||
module: Optional[str] = ...,
|
||||
) -> Type[Tuple[Any, ...]]: ...
|
||||
else:
|
||||
def namedtuple(typename: str, field_names: Union[str, Iterable[str]],
|
||||
verbose: bool = ..., rename: bool = ...) -> Type[tuple]: ...
|
||||
|
||||
_UserDictT = TypeVar('_UserDictT', bound=UserDict)
|
||||
def namedtuple(
|
||||
typename: str, field_names: Union[str, Iterable[str]], verbose: bool = ..., rename: bool = ...,
|
||||
) -> Type[Tuple[Any, ...]]: ...
|
||||
|
||||
class UserDict(MutableMapping[_KT, _VT]):
|
||||
data: Dict[_KT, _VT]
|
||||
@@ -67,11 +78,9 @@ class UserDict(MutableMapping[_KT, _VT]):
|
||||
def __delitem__(self, key: _KT) -> None: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __contains__(self, key: object) -> bool: ...
|
||||
def copy(self: _UserDictT) -> _UserDictT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
@classmethod
|
||||
def fromkeys(cls: Type[_UserDictT], iterable: Iterable[_KT], value: Optional[_VT] = ...) -> _UserDictT: ...
|
||||
|
||||
_UserListT = TypeVar('_UserListT', bound=UserList)
|
||||
def fromkeys(cls: Type[_S], iterable: Iterable[_KT], value: Optional[_VT] = ...) -> _S: ...
|
||||
|
||||
class UserList(MutableSequence[_T]):
|
||||
data: List[_T]
|
||||
@@ -91,16 +100,16 @@ class UserList(MutableSequence[_T]):
|
||||
@overload
|
||||
def __setitem__(self, i: slice, o: Iterable[_T]) -> None: ...
|
||||
def __delitem__(self, i: Union[int, slice]) -> None: ...
|
||||
def __add__(self: _UserListT, other: Iterable[_T]) -> _UserListT: ...
|
||||
def __iadd__(self: _UserListT, other: Iterable[_T]) -> _UserListT: ...
|
||||
def __mul__(self: _UserListT, n: int) -> _UserListT: ...
|
||||
def __imul__(self: _UserListT, n: int) -> _UserListT: ...
|
||||
def __add__(self: _S, other: Iterable[_T]) -> _S: ...
|
||||
def __iadd__(self: _S, other: Iterable[_T]) -> _S: ...
|
||||
def __mul__(self: _S, n: int) -> _S: ...
|
||||
def __imul__(self: _S, n: int) -> _S: ...
|
||||
def append(self, item: _T) -> None: ...
|
||||
def insert(self, i: int, item: _T) -> None: ...
|
||||
def pop(self, i: int = ...) -> _T: ...
|
||||
def remove(self, item: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def copy(self: _UserListT) -> _UserListT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
def count(self, item: _T) -> int: ...
|
||||
def index(self, item: _T, *args: Any) -> int: ...
|
||||
def reverse(self) -> None: ...
|
||||
@@ -233,8 +242,6 @@ class deque(MutableSequence[_T], Generic[_T]):
|
||||
def __mul__(self, other: int) -> deque[_T]: ...
|
||||
def __imul__(self, other: int) -> None: ...
|
||||
|
||||
_CounterT = TypeVar('_CounterT', bound=Counter)
|
||||
|
||||
class Counter(Dict[_T, int], Generic[_T]):
|
||||
@overload
|
||||
def __init__(self, **kwargs: int) -> None: ...
|
||||
@@ -242,7 +249,7 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
def __init__(self, mapping: Mapping[_T, int]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def copy(self: _CounterT) -> _CounterT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
def elements(self) -> Iterator[_T]: ...
|
||||
|
||||
def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ...
|
||||
@@ -275,8 +282,6 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
def __iand__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __ior__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
|
||||
_OrderedDictT = TypeVar('_OrderedDictT', bound=OrderedDict)
|
||||
|
||||
class _OrderedDictKeysView(KeysView[_KT], Reversible[_KT]):
|
||||
def __reversed__(self) -> Iterator[_KT]: ...
|
||||
class _OrderedDictItemsView(ItemsView[_KT, _VT], Reversible[Tuple[_KT, _VT]]):
|
||||
@@ -287,14 +292,12 @@ class _OrderedDictValuesView(ValuesView[_VT], Reversible[_VT]):
|
||||
class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
|
||||
def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ...
|
||||
def move_to_end(self, key: _KT, last: bool = ...) -> None: ...
|
||||
def copy(self: _OrderedDictT) -> _OrderedDictT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
def __reversed__(self) -> Iterator[_KT]: ...
|
||||
def keys(self) -> _OrderedDictKeysView[_KT]: ...
|
||||
def items(self) -> _OrderedDictItemsView[_KT, _VT]: ...
|
||||
def values(self) -> _OrderedDictValuesView[_VT]: ...
|
||||
|
||||
_DefaultDictT = TypeVar('_DefaultDictT', bound=defaultdict)
|
||||
|
||||
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
default_factory: Optional[Callable[[], _VT]]
|
||||
|
||||
@@ -318,7 +321,7 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
def __missing__(self, key: _KT) -> _VT: ...
|
||||
# TODO __reversed__
|
||||
def copy(self: _DefaultDictT) -> _DefaultDictT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
|
||||
class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ...
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Optional, Union, Pattern
|
||||
from typing import Any, Optional, Union, Pattern
|
||||
|
||||
if sys.version_info < (3, 6):
|
||||
_Path = Union[str, bytes]
|
||||
@@ -12,6 +12,24 @@ else:
|
||||
_SuccessType = int
|
||||
|
||||
# rx can be any object with a 'search' method; once we have Protocols we can change the type
|
||||
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ..., workers: int = ...) -> _SuccessType: ...
|
||||
def compile_file(fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> _SuccessType: ...
|
||||
def compile_dir(
|
||||
dir: _Path,
|
||||
maxlevels: int = ...,
|
||||
ddir: Optional[_Path] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
legacy: bool = ...,
|
||||
optimize: int = ...,
|
||||
workers: int = ...,
|
||||
) -> _SuccessType: ...
|
||||
def compile_file(
|
||||
fullname: _Path,
|
||||
ddir: Optional[_Path] = ...,
|
||||
force: bool = ...,
|
||||
rx: Optional[Pattern[Any]] = ...,
|
||||
quiet: int = ...,
|
||||
legacy: bool = ...,
|
||||
optimize: int = ...,
|
||||
) -> _SuccessType: ...
|
||||
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ..., legacy: bool = ..., optimize: int = ...) -> _SuccessType: ...
|
||||
|
||||
@@ -62,25 +62,25 @@ def wait(fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when:
|
||||
|
||||
class _Waiter:
|
||||
event: threading.Event
|
||||
finished_futures: List[Future]
|
||||
finished_futures: List[Future[Any]]
|
||||
def __init__(self) -> None: ...
|
||||
def add_result(self, future: Future) -> None: ...
|
||||
def add_exception(self, future: Future) -> None: ...
|
||||
def add_cancelled(self, future: Future) -> None: ...
|
||||
def add_result(self, future: Future[Any]) -> None: ...
|
||||
def add_exception(self, future: Future[Any]) -> None: ...
|
||||
def add_cancelled(self, future: Future[Any]) -> None: ...
|
||||
|
||||
|
||||
class _AsCompletedWaiter(_Waiter):
|
||||
lock: threading.Lock
|
||||
def __init__(self) -> None: ...
|
||||
def add_result(self, future: Future) -> None: ...
|
||||
def add_exception(self, future: Future) -> None: ...
|
||||
def add_cancelled(self, future: Future) -> None: ...
|
||||
def add_result(self, future: Future[Any]) -> None: ...
|
||||
def add_exception(self, future: Future[Any]) -> None: ...
|
||||
def add_cancelled(self, future: Future[Any]) -> None: ...
|
||||
|
||||
|
||||
class _FirstCompletedWaiter(_Waiter):
|
||||
def add_result(self, future: Future) -> None: ...
|
||||
def add_exception(self, future: Future) -> None: ...
|
||||
def add_cancelled(self, future: Future) -> None: ...
|
||||
def add_result(self, future: Future[Any]) -> None: ...
|
||||
def add_exception(self, future: Future[Any]) -> None: ...
|
||||
def add_cancelled(self, future: Future[Any]) -> None: ...
|
||||
|
||||
|
||||
class _AllCompletedWaiter(_Waiter):
|
||||
@@ -88,13 +88,13 @@ class _AllCompletedWaiter(_Waiter):
|
||||
stop_on_exception: bool
|
||||
lock: threading.Lock
|
||||
def __init__(self, num_pending_calls: int, stop_on_exception: bool) -> None: ...
|
||||
def add_result(self, future: Future) -> None: ...
|
||||
def add_exception(self, future: Future) -> None: ...
|
||||
def add_cancelled(self, future: Future) -> None: ...
|
||||
def add_result(self, future: Future[Any]) -> None: ...
|
||||
def add_exception(self, future: Future[Any]) -> None: ...
|
||||
def add_cancelled(self, future: Future[Any]) -> None: ...
|
||||
|
||||
|
||||
class _AcquireFutures:
|
||||
futures: Iterable[Future]
|
||||
def __init__(self, futures: Iterable[Future]) -> None: ...
|
||||
futures: Iterable[Future[Any]]
|
||||
def __init__(self, futures: Iterable[Future[Any]]) -> None: ...
|
||||
def __enter__(self) -> None: ...
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Optional, Tuple, TypeVar, Generic
|
||||
from typing import Any, Callable, Iterable, Mapping, Optional, Tuple, TypeVar, Generic
|
||||
from ._base import Executor, Future
|
||||
import sys
|
||||
|
||||
@@ -22,10 +22,9 @@ class ThreadPoolExecutor(Executor):
|
||||
|
||||
|
||||
class _WorkItem(Generic[_S]):
|
||||
future: Future
|
||||
fn: Callable[[Future[_S]], Any]
|
||||
args: Any
|
||||
kwargs: Any
|
||||
def __init__(self, future: Future, fn: Callable[[Future[_S]], Any], args: Any,
|
||||
kwargs: Any) -> None: ...
|
||||
future: Future[_S]
|
||||
fn: Callable[..., _S]
|
||||
args: Iterable[Any]
|
||||
kwargs: Mapping[str, Any]
|
||||
def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
|
||||
@@ -177,7 +177,7 @@ class SectionProxy(MutableMapping[str, str]):
|
||||
def __getattr__(self, key: str) -> Callable[..., Any]: ...
|
||||
|
||||
class ConverterMapping(MutableMapping[str, Optional[_converter]]):
|
||||
GETTERCRE: Pattern
|
||||
GETTERCRE: Pattern[Any]
|
||||
def __init__(self, parser: RawConfigParser) -> None: ...
|
||||
def __getitem__(self, key: str) -> _converter: ...
|
||||
def __setitem__(self, key: str, value: Optional[_converter]) -> None: ...
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from typing import Generic, Dict, List, Mapping, MutableMapping, Optional, TypeVar, Union, Any
|
||||
|
||||
_DataType = Union[str, Mapping[str, Union[str, Morsel]]]
|
||||
_DataType = Union[str, Mapping[str, Union[str, Morsel[Any]]]]
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class CookieError(Exception): ...
|
||||
@@ -18,7 +18,7 @@ class Morsel(Dict[str, Any], Generic[_T]):
|
||||
def js_output(self, attrs: Optional[List[str]] = ...) -> str: ...
|
||||
def OutputString(self, attrs: Optional[List[str]] = ...) -> str: ...
|
||||
|
||||
class BaseCookie(Dict[str, Morsel], Generic[_T]):
|
||||
class BaseCookie(Dict[str, Morsel[_T]], Generic[_T]):
|
||||
def __init__(self, input: Optional[_DataType] = ...) -> None: ...
|
||||
def value_decode(self, val: str) -> _T: ...
|
||||
def value_encode(self, val: _T) -> str: ...
|
||||
@@ -26,6 +26,6 @@ class BaseCookie(Dict[str, Morsel], Generic[_T]):
|
||||
sep: str = ...) -> str: ...
|
||||
def js_output(self, attrs: Optional[List[str]] = ...) -> str: ...
|
||||
def load(self, rawdata: _DataType) -> None: ...
|
||||
def __setitem__(self, key: str, value: Union[str, Morsel]) -> None: ...
|
||||
def __setitem__(self, key: str, value: Union[str, Morsel[_T]]) -> None: ...
|
||||
|
||||
class SimpleCookie(BaseCookie): ...
|
||||
class SimpleCookie(BaseCookie[_T], Generic[_T]): ...
|
||||
|
||||
@@ -77,8 +77,7 @@ def ismemberdescriptor(object: object) -> bool: ...
|
||||
#
|
||||
# Retrieving source code
|
||||
#
|
||||
_SourceObjectType = Union[ModuleType, Type, MethodType, FunctionType,
|
||||
TracebackType, FrameType, CodeType]
|
||||
_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType]
|
||||
|
||||
def findsource(object: _SourceObjectType) -> Tuple[List[str], int]: ...
|
||||
def getabsfile(object: _SourceObjectType) -> str: ...
|
||||
@@ -174,7 +173,7 @@ def getclasstree(classes: List[type], unique: bool = ...) -> Any: ...
|
||||
ArgSpec = NamedTuple('ArgSpec', [('args', List[str]),
|
||||
('varargs', str),
|
||||
('keywords', str),
|
||||
('defaults', tuple),
|
||||
('defaults', Tuple[Any, ...]),
|
||||
])
|
||||
|
||||
Arguments = NamedTuple('Arguments', [('args', List[str]),
|
||||
@@ -188,7 +187,7 @@ def getargspec(func: object) -> ArgSpec: ...
|
||||
FullArgSpec = NamedTuple('FullArgSpec', [('args', List[str]),
|
||||
('varargs', Optional[str]),
|
||||
('varkw', Optional[str]),
|
||||
('defaults', tuple),
|
||||
('defaults', Tuple[Any, ...]),
|
||||
('kwonlyargs', List[str]),
|
||||
('kwonlydefaults', Dict[str, Any]),
|
||||
('annotations', Dict[str, Any]),
|
||||
|
||||
@@ -54,7 +54,7 @@ class _BaseAddress(_IPAddressBase, SupportsInt):
|
||||
@property
|
||||
def packed(self) -> bytes: ...
|
||||
|
||||
class _BaseNetwork(_IPAddressBase, Container, Iterable[_A], Generic[_A]):
|
||||
class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]):
|
||||
network_address: _A
|
||||
netmask: _A
|
||||
def __init__(self, address: object, strict: bool = ...) -> None: ...
|
||||
|
||||
@@ -37,7 +37,7 @@ else:
|
||||
def loads(s: _LoadsString,
|
||||
encoding: Any = ..., # ignored and deprecated
|
||||
cls: Optional[Type[JSONDecoder]] = ...,
|
||||
object_hook: Optional[Callable[[Dict], Any]] = ...,
|
||||
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
@@ -49,7 +49,7 @@ class _Reader(Protocol):
|
||||
|
||||
def load(fp: _Reader,
|
||||
cls: Optional[Type[JSONDecoder]] = ...,
|
||||
object_hook: Optional[Callable[[Dict], Any]] = ...,
|
||||
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
|
||||
parse_float: Optional[Callable[[str], Any]] = ...,
|
||||
parse_int: Optional[Callable[[str], Any]] = ...,
|
||||
parse_constant: Optional[Callable[[str], Any]] = ...,
|
||||
|
||||
@@ -14,7 +14,7 @@ class JSONEncoder:
|
||||
def __init__(self, skipkeys: bool = ..., ensure_ascii: bool = ...,
|
||||
check_circular: bool = ..., allow_nan: bool = ..., sort_keys: bool = ...,
|
||||
indent: Optional[int] = ..., separators: Optional[Tuple[str, str]] = ...,
|
||||
default: Optional[Callable] = ...) -> None: ...
|
||||
default: Optional[Callable[..., Any]] = ...) -> None: ...
|
||||
|
||||
def default(self, o: Any) -> Any: ...
|
||||
def encode(self, o: Any) -> str: ...
|
||||
|
||||
@@ -26,7 +26,7 @@ import sys
|
||||
# Sychronization primitives
|
||||
_LockLike = Union[synchronize.Lock, synchronize.RLock]
|
||||
def Barrier(parties: int,
|
||||
action: Optional[Callable] = ...,
|
||||
action: Optional[Callable[..., Any]] = ...,
|
||||
timeout: Optional[float] = ...) -> synchronize.Barrier: ...
|
||||
def BoundedSemaphore(value: int = ...) -> synchronize.BoundedSemaphore: ...
|
||||
def Condition(lock: Optional[_LockLike] = ...) -> synchronize.Condition: ...
|
||||
@@ -52,7 +52,7 @@ class Process():
|
||||
# TODO: set type of group to None
|
||||
def __init__(self,
|
||||
group: Any = ...,
|
||||
target: Optional[Callable] = ...,
|
||||
target: Optional[Callable[..., Any]] = ...,
|
||||
name: Optional[str] = ...,
|
||||
args: Iterable[Any] = ...,
|
||||
kwargs: Mapping[Any, Any] = ...,
|
||||
|
||||
@@ -41,7 +41,7 @@ class BaseContext(object):
|
||||
|
||||
def Barrier(self,
|
||||
parties: int,
|
||||
action: Optional[Callable] = ...,
|
||||
action: Optional[Callable[..., Any]] = ...,
|
||||
timeout: Optional[float] = ...) -> synchronize.Barrier: ...
|
||||
def BoundedSemaphore(self,
|
||||
value: int = ...) -> synchronize.BoundedSemaphore: ...
|
||||
@@ -52,9 +52,9 @@ class BaseContext(object):
|
||||
def RLock(self) -> synchronize.RLock: ...
|
||||
def Semaphore(self, value: int = ...) -> synchronize.Semaphore: ...
|
||||
|
||||
def Queue(self, maxsize: int = ...) -> queues.Queue: ...
|
||||
def JoinableQueue(self, maxsize: int = ...) -> queues.JoinableQueue: ...
|
||||
def SimpleQueue(self) -> queues.SimpleQueue: ...
|
||||
def Queue(self, maxsize: int = ...) -> queues.Queue[Any]: ...
|
||||
def JoinableQueue(self, maxsize: int = ...) -> queues.JoinableQueue[Any]: ...
|
||||
def SimpleQueue(self) -> queues.SimpleQueue[Any]: ...
|
||||
def Pool(
|
||||
self,
|
||||
processes: Optional[int] = ...,
|
||||
@@ -65,7 +65,7 @@ class BaseContext(object):
|
||||
def Process(
|
||||
self,
|
||||
group: Any = ...,
|
||||
target: Optional[Callable] = ...,
|
||||
target: Optional[Callable[..., Any]] = ...,
|
||||
name: Optional[str] = ...,
|
||||
args: Iterable[Any] = ...,
|
||||
kwargs: Mapping[Any, Any] = ...,
|
||||
|
||||
@@ -14,7 +14,7 @@ JoinableQueue = Queue
|
||||
|
||||
|
||||
class DummyProcess(threading.Thread):
|
||||
_children: weakref.WeakKeyDictionary
|
||||
_children: weakref.WeakKeyDictionary[Any, Any]
|
||||
_parent: threading.Thread
|
||||
_pid: None
|
||||
_start_called: int
|
||||
@@ -33,10 +33,10 @@ class Value(object):
|
||||
def __init__(self, typecode, value, lock=...) -> None: ...
|
||||
|
||||
|
||||
def Array(typecode, sequence, lock=...) -> array.array: ...
|
||||
def Array(typecode, sequence, lock=...) -> array.array[Any]: ...
|
||||
def Manager() -> Any: ...
|
||||
def Pool(processes=..., initializer=..., initargs=...) -> Any: ...
|
||||
def active_children() -> List: ...
|
||||
def active_children() -> List[Any]: ...
|
||||
def current_process() -> threading.Thread: ...
|
||||
def freeze_support() -> None: ...
|
||||
def shutdown() -> None: ...
|
||||
|
||||
@@ -21,9 +21,9 @@ class Connection(object):
|
||||
def poll(self, timeout: float = ...) -> bool: ...
|
||||
|
||||
class Listener(object):
|
||||
_backlog_queue: Optional[Queue]
|
||||
_backlog_queue: Optional[Queue[Any]]
|
||||
@property
|
||||
def address(self) -> Optional[Queue]: ...
|
||||
def address(self) -> Optional[Queue[Any]]: ...
|
||||
def __enter__(self: _TListener) -> _TListener: ...
|
||||
def __exit__(self, exc_type, exc_value, exc_tb) -> None: ...
|
||||
def __init__(self, address=..., family=..., backlog=...) -> None: ...
|
||||
|
||||
@@ -28,7 +28,7 @@ class BaseManager(ContextManager[BaseManager]):
|
||||
address: Union[str, Tuple[str, int]]
|
||||
def connect(self) -> None: ...
|
||||
@classmethod
|
||||
def register(cls, typeid: str, callable: Optional[Callable] = ...,
|
||||
def register(cls, typeid: str, callable: Optional[Callable[..., Any]] = ...,
|
||||
proxytype: Any = ...,
|
||||
exposed: Optional[Sequence[str]] = ...,
|
||||
method_to_typeid: Optional[Mapping[str, str]] = ...,
|
||||
@@ -43,7 +43,7 @@ class SyncManager(BaseManager, ContextManager[SyncManager]):
|
||||
def Event(self) -> threading.Event: ...
|
||||
def Lock(self) -> threading.Lock: ...
|
||||
def Namespace(self) -> _Namespace: ...
|
||||
def Queue(self, maxsize: int = ...) -> queue.Queue: ...
|
||||
def Queue(self, maxsize: int = ...) -> queue.Queue[Any]: ...
|
||||
def RLock(self) -> threading.RLock: ...
|
||||
def Semaphore(self, value: Any = ...) -> threading.Semaphore: ...
|
||||
def Array(self, typecode: Any, sequence: Sequence[_T]) -> Sequence[_T]: ...
|
||||
|
||||
@@ -19,14 +19,12 @@ AsyncResult = ApplyResult
|
||||
|
||||
class MapResult(ApplyResult[List[_T]]): ...
|
||||
|
||||
_IMIT = TypeVar('_IMIT', bound=IMapIterator)
|
||||
|
||||
class IMapIterator(Iterator[_T]):
|
||||
def __iter__(self: _IMIT) -> _IMIT: ...
|
||||
def __iter__(self: _S) -> _S: ...
|
||||
def next(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
def __next__(self, timeout: Optional[float] = ...) -> _T: ...
|
||||
|
||||
class IMapUnorderedIterator(IMapIterator): ...
|
||||
class IMapUnorderedIterator(IMapIterator[_T]): ...
|
||||
|
||||
class Pool(ContextManager[Pool]):
|
||||
def __init__(self, processes: Optional[int] = ...,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Callable, ContextManager, Optional, Union
|
||||
from typing import Any, Callable, ContextManager, Optional, Union
|
||||
|
||||
from multiprocessing.context import BaseContext
|
||||
import threading
|
||||
@@ -9,7 +9,7 @@ _LockLike = Union[Lock, RLock]
|
||||
class Barrier(threading.Barrier):
|
||||
def __init__(self,
|
||||
parties: int,
|
||||
action: Optional[Callable] = ...,
|
||||
action: Optional[Callable[..., Any]] = ...,
|
||||
timeout: Optional[float] = ...,
|
||||
*
|
||||
ctx: BaseContext) -> None: ...
|
||||
|
||||
@@ -282,12 +282,12 @@ if sys.platform != 'win32':
|
||||
|
||||
# ----- os function stubs -----
|
||||
if sys.version_info >= (3, 6):
|
||||
def fsencode(filename: Union[str, bytes, PathLike]) -> bytes: ...
|
||||
def fsencode(filename: Union[str, bytes, PathLike[Any]]) -> bytes: ...
|
||||
else:
|
||||
def fsencode(filename: Union[str, bytes]) -> bytes: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
def fsdecode(filename: Union[str, bytes, PathLike]) -> str: ...
|
||||
def fsdecode(filename: Union[str, bytes, PathLike[Any]]) -> str: ...
|
||||
else:
|
||||
def fsdecode(filename: Union[str, bytes]) -> str: ...
|
||||
|
||||
@@ -297,7 +297,7 @@ if sys.version_info >= (3, 6):
|
||||
@overload
|
||||
def fspath(path: bytes) -> bytes: ...
|
||||
@overload
|
||||
def fspath(path: PathLike) -> Any: ...
|
||||
def fspath(path: PathLike[Any]) -> Any: ...
|
||||
|
||||
def get_exec_path(env: Optional[Mapping[str, str]] = ...) -> List[str]: ...
|
||||
# NOTE: get_exec_path(): returns List[bytes] when env not None
|
||||
@@ -506,32 +506,34 @@ def utime(
|
||||
follow_symlinks: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
_OnError = Callable[[OSError], Any]
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
def walk(top: Union[AnyStr, PathLike[AnyStr]], topdown: bool = ...,
|
||||
onerror: Optional[Callable[[OSError], Any]] = ...,
|
||||
onerror: Optional[_OnError] = ...,
|
||||
followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
|
||||
List[AnyStr]]]: ...
|
||||
else:
|
||||
def walk(top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ...,
|
||||
def walk(top: AnyStr, topdown: bool = ..., onerror: Optional[_OnError] = ...,
|
||||
followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
|
||||
List[AnyStr]]]: ...
|
||||
if sys.platform != 'win32':
|
||||
if sys.version_info >= (3, 7):
|
||||
@overload
|
||||
def fwalk(top: Union[str, PathLike[str]] = ..., topdown: bool = ...,
|
||||
onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ...,
|
||||
onerror: Optional[_OnError] = ..., *, follow_symlinks: bool = ...,
|
||||
dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ...
|
||||
@overload
|
||||
def fwalk(top: bytes, topdown: bool = ...,
|
||||
onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ...,
|
||||
onerror: Optional[_OnError] = ..., *, follow_symlinks: bool = ...,
|
||||
dir_fd: Optional[int] = ...) -> Iterator[Tuple[bytes, List[bytes], List[bytes], int]]: ...
|
||||
elif sys.version_info >= (3, 6):
|
||||
def fwalk(top: Union[str, PathLike[str]] = ..., topdown: bool = ...,
|
||||
onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ...,
|
||||
onerror: Optional[_OnError] = ..., *, follow_symlinks: bool = ...,
|
||||
dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ...
|
||||
else:
|
||||
def fwalk(top: str = ..., topdown: bool = ...,
|
||||
onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ...,
|
||||
onerror: Optional[_OnError] = ..., *, follow_symlinks: bool = ...,
|
||||
dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ...
|
||||
def getxattr(path: _FdOrPathType, attribute: _PathType, *, follow_symlinks: bool = ...) -> bytes: ... # Linux only
|
||||
def listxattr(path: _FdOrPathType, *, follow_symlinks: bool = ...) -> List[str]: ... # Linux only
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from collections import deque
|
||||
from threading import Condition, Lock
|
||||
from typing import Any, TypeVar, Generic, Optional
|
||||
from typing import Any, Deque, TypeVar, Generic, Optional
|
||||
import sys
|
||||
|
||||
_T = TypeVar('_T')
|
||||
@@ -21,7 +20,7 @@ class Queue(Generic[_T]):
|
||||
all_tasks_done: Condition # undocumented
|
||||
unfinished_tasks: int # undocumented
|
||||
|
||||
queue: deque # undocumented
|
||||
queue: Deque[Any] # undocumented
|
||||
def __init__(self, maxsize: int = ...) -> None: ...
|
||||
def _init(self, maxsize: int) -> None: ...
|
||||
def empty(self) -> bool: ...
|
||||
|
||||
@@ -8,17 +8,15 @@
|
||||
|
||||
import _random
|
||||
import sys
|
||||
from typing import (
|
||||
Any, TypeVar, Sequence, List, Callable, AbstractSet, Union, Optional
|
||||
)
|
||||
from typing import Any, TypeVar, Sequence, List, Callable, AbstractSet, Union, Optional, Tuple
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class Random(_random.Random):
|
||||
def __init__(self, x: Any = ...) -> None: ...
|
||||
def seed(self, a: Any = ..., version: int = ...) -> None: ...
|
||||
def getstate(self) -> tuple: ...
|
||||
def setstate(self, state: tuple) -> None: ...
|
||||
def getstate(self) -> Tuple[Any, ...]: ...
|
||||
def setstate(self, state: Tuple[Any, ...]) -> None: ...
|
||||
def getrandbits(self, k: int) -> int: ...
|
||||
def randrange(self, start: int, stop: Union[int, None] = ..., step: int = ...) -> int: ...
|
||||
def randint(self, a: int, b: int) -> int: ...
|
||||
|
||||
@@ -24,7 +24,7 @@ class Repr:
|
||||
def repr1(self, x: Any, level: int) -> str: ...
|
||||
def repr_tuple(self, x: Tuple[Any, ...], level: int) -> str: ...
|
||||
def repr_list(self, x: List[Any], level: int) -> str: ...
|
||||
def repr_array(self, x: array, level: int) -> str: ...
|
||||
def repr_array(self, x: array[Any], level: int) -> str: ...
|
||||
def repr_set(self, x: Set[Any], level: int) -> str: ...
|
||||
def repr_frozenset(self, x: FrozenSet[Any], level: int) -> str: ...
|
||||
def repr_deque(self, x: Deque[Any], level: int) -> str: ...
|
||||
|
||||
@@ -2,7 +2,7 @@ from typing import Any, Dict, Iterator, Optional, Tuple
|
||||
import collections
|
||||
|
||||
|
||||
class Shelf(collections.MutableMapping):
|
||||
class Shelf(collections.MutableMapping[Any, Any]):
|
||||
def __init__(self, dict: Dict[bytes, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@@ -77,5 +77,5 @@ class Tokenizer:
|
||||
def fix_flags(src: Union[str, bytes], flag: int) -> int: ...
|
||||
def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ...
|
||||
_TemplateType = Tuple[List[Tuple[int, int]], List[str]]
|
||||
def parse_template(source: str, pattern: _Pattern) -> _TemplateType: ...
|
||||
def expand_template(template: _TemplateType, match: Match) -> str: ...
|
||||
def parse_template(source: str, pattern: _Pattern[Any]) -> _TemplateType: ...
|
||||
def expand_template(template: _TemplateType, match: Match[Any]) -> str: ...
|
||||
|
||||
@@ -40,6 +40,7 @@ else:
|
||||
_CMD = Union[_TXT, Sequence[_PATH]]
|
||||
_ENV = Union[Mapping[bytes, _TXT], Mapping[Text, _TXT]]
|
||||
|
||||
_S = TypeVar('_S')
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class CompletedProcess(Generic[_T]):
|
||||
@@ -1169,7 +1170,7 @@ class Popen(Generic[AnyStr]):
|
||||
def send_signal(self, signal: int) -> None: ...
|
||||
def terminate(self) -> None: ...
|
||||
def kill(self) -> None: ...
|
||||
def __enter__(self) -> Popen: ...
|
||||
def __enter__(self: _S) -> _S: ...
|
||||
def __exit__(self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]) -> None: ...
|
||||
|
||||
# The result really is always a str.
|
||||
|
||||
@@ -18,6 +18,7 @@ TMP_MAX: int
|
||||
tempdir: Optional[str]
|
||||
template: str
|
||||
|
||||
_S = TypeVar("_S")
|
||||
_T = TypeVar("_T") # for pytype, define typevar in same file as alias
|
||||
if sys.version_info >= (3, 6):
|
||||
_DirT = Union[_T, os.PathLike[_T]]
|
||||
@@ -98,7 +99,7 @@ class SpooledTemporaryFile(IO[AnyStr]):
|
||||
prefix: Optional[str] = ..., dir: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def rollover(self) -> None: ...
|
||||
def __enter__(self) -> SpooledTemporaryFile: ...
|
||||
def __enter__(self: _S) -> _S: ...
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]],
|
||||
exc_val: Optional[BaseException],
|
||||
exc_tb: Optional[TracebackType]) -> Optional[bool]: ...
|
||||
|
||||
@@ -45,7 +45,7 @@ def generate_tokens(readline: Callable[[], str]) -> Generator[TokenInfo, None, N
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
from os import PathLike
|
||||
def open(filename: Union[str, bytes, int, PathLike]) -> TextIO: ...
|
||||
def open(filename: Union[str, bytes, int, PathLike[Any]]) -> TextIO: ...
|
||||
else:
|
||||
def open(filename: Union[str, bytes, int]) -> TextIO: ...
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ class MethodType:
|
||||
__self__: object
|
||||
__name__: str
|
||||
__qualname__: str
|
||||
def __init__(self, func: Callable, obj: object) -> None: ...
|
||||
def __init__(self, func: Callable[..., Any], obj: object) -> None: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
class BuiltinFunctionType:
|
||||
__self__: Union[object, ModuleType]
|
||||
|
||||
@@ -75,7 +75,7 @@ _KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers.
|
||||
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
|
||||
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
|
||||
_TC = TypeVar('_TC', bound=Type[object])
|
||||
_C = TypeVar("_C", bound=Callable)
|
||||
_C = TypeVar("_C", bound=Callable[..., Any])
|
||||
|
||||
def runtime_checkable(cls: _TC) -> _TC: ...
|
||||
|
||||
@@ -166,7 +166,7 @@ class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
|
||||
@property
|
||||
def gi_running(self) -> bool: ...
|
||||
@property
|
||||
def gi_yieldfrom(self) -> Optional[Generator]: ...
|
||||
def gi_yieldfrom(self) -> Optional[Generator[Any, Any, Any]]: ...
|
||||
|
||||
@runtime_checkable
|
||||
class Awaitable(Protocol[_T_co]):
|
||||
@@ -581,8 +581,9 @@ class Pattern(Generic[AnyStr]):
|
||||
|
||||
# Functions
|
||||
|
||||
def get_type_hints(obj: Callable, globalns: Optional[dict[str, Any]] = ...,
|
||||
localns: Optional[dict[str, Any]] = ...) -> dict[str, Any]: ...
|
||||
def get_type_hints(
|
||||
obj: Callable[..., Any], globalns: Optional[Dict[str, Any]] = ..., localns: Optional[Dict[str, Any]] = ...,
|
||||
) -> Dict[str, Any]: ...
|
||||
|
||||
@overload
|
||||
def cast(tp: Type[_T], obj: Any) -> _T: ...
|
||||
@@ -592,7 +593,7 @@ def cast(tp: str, obj: Any) -> Any: ...
|
||||
# Type constructors
|
||||
|
||||
# NamedTuple is special-cased in the type checker
|
||||
class NamedTuple(tuple):
|
||||
class NamedTuple(Tuple[Any, ...]):
|
||||
_field_types: collections.OrderedDict[str, Type[Any]]
|
||||
_field_defaults: Dict[str, Any] = ...
|
||||
_fields: Tuple[str, ...]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# Stubs for mock
|
||||
|
||||
import sys
|
||||
from typing import Any, Optional, Text, Type
|
||||
from typing import Any, List, Optional, Text, Tuple, Type, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
FILTER_DIR: Any
|
||||
|
||||
@@ -18,7 +20,7 @@ class _Sentinel:
|
||||
sentinel: Any
|
||||
DEFAULT: Any
|
||||
|
||||
class _CallList(list):
|
||||
class _CallList(List[_T]):
|
||||
def __contains__(self, value: Any) -> bool: ...
|
||||
|
||||
class _MockIter:
|
||||
@@ -111,7 +113,7 @@ class _ANY:
|
||||
|
||||
ANY: Any
|
||||
|
||||
class _Call(tuple):
|
||||
class _Call(Tuple[Any, ...]):
|
||||
def __new__(cls, value: Any = ..., name: Optional[Any] = ..., parent: Optional[Any] = ..., two: bool = ..., from_kall: bool = ...) -> Any: ...
|
||||
name: Any
|
||||
parent: Any
|
||||
|
||||
@@ -35,7 +35,7 @@ class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): ...
|
||||
|
||||
class _NetlocResultMixinBytes(_NetlocResultMixinBase[bytes], _ResultMixinBytes): ...
|
||||
|
||||
class _DefragResultBase(tuple, Generic[AnyStr]):
|
||||
class _DefragResultBase(Tuple[Any, ...], Generic[AnyStr]):
|
||||
url: AnyStr
|
||||
fragment: AnyStr
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ class HTTPErrorProcessor(BaseHandler):
|
||||
def https_response(self, request, response) -> _UrlopenRet: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
def urlretrieve(url: str, filename: Optional[Union[str, os.PathLike]] = ...,
|
||||
def urlretrieve(url: str, filename: Optional[Union[str, os.PathLike[Any]]] = ...,
|
||||
reporthook: Optional[Callable[[int, int, int], None]] = ...,
|
||||
data: Optional[bytes] = ...) -> Tuple[str, HTTPMessage]: ...
|
||||
else:
|
||||
|
||||
@@ -132,6 +132,7 @@ def main():
|
||||
flags.append('--no-site-packages')
|
||||
flags.append('--show-traceback')
|
||||
flags.append('--no-implicit-optional')
|
||||
flags.append('--disallow-any-generics')
|
||||
if args.warn_unused_ignores:
|
||||
flags.append('--warn-unused-ignores')
|
||||
sys.argv = ['mypy'] + flags + files
|
||||
|
||||
30
third_party/2/concurrent/futures/_base.pyi
vendored
30
third_party/2/concurrent/futures/_base.pyi
vendored
@@ -62,25 +62,25 @@ def wait(fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when:
|
||||
|
||||
class _Waiter:
|
||||
event: threading.Event
|
||||
finished_futures: List[Future]
|
||||
finished_futures: List[Future[Any]]
|
||||
def __init__(self) -> None: ...
|
||||
def add_result(self, future: Future) -> None: ...
|
||||
def add_exception(self, future: Future) -> None: ...
|
||||
def add_cancelled(self, future: Future) -> None: ...
|
||||
def add_result(self, future: Future[Any]) -> None: ...
|
||||
def add_exception(self, future: Future[Any]) -> None: ...
|
||||
def add_cancelled(self, future: Future[Any]) -> None: ...
|
||||
|
||||
|
||||
class _AsCompletedWaiter(_Waiter):
|
||||
lock: threading.Lock
|
||||
def __init__(self) -> None: ...
|
||||
def add_result(self, future: Future) -> None: ...
|
||||
def add_exception(self, future: Future) -> None: ...
|
||||
def add_cancelled(self, future: Future) -> None: ...
|
||||
def add_result(self, future: Future[Any]) -> None: ...
|
||||
def add_exception(self, future: Future[Any]) -> None: ...
|
||||
def add_cancelled(self, future: Future[Any]) -> None: ...
|
||||
|
||||
|
||||
class _FirstCompletedWaiter(_Waiter):
|
||||
def add_result(self, future: Future) -> None: ...
|
||||
def add_exception(self, future: Future) -> None: ...
|
||||
def add_cancelled(self, future: Future) -> None: ...
|
||||
def add_result(self, future: Future[Any]) -> None: ...
|
||||
def add_exception(self, future: Future[Any]) -> None: ...
|
||||
def add_cancelled(self, future: Future[Any]) -> None: ...
|
||||
|
||||
|
||||
class _AllCompletedWaiter(_Waiter):
|
||||
@@ -88,13 +88,13 @@ class _AllCompletedWaiter(_Waiter):
|
||||
stop_on_exception: bool
|
||||
lock: threading.Lock
|
||||
def __init__(self, num_pending_calls: int, stop_on_exception: bool) -> None: ...
|
||||
def add_result(self, future: Future) -> None: ...
|
||||
def add_exception(self, future: Future) -> None: ...
|
||||
def add_cancelled(self, future: Future) -> None: ...
|
||||
def add_result(self, future: Future[Any]) -> None: ...
|
||||
def add_exception(self, future: Future[Any]) -> None: ...
|
||||
def add_cancelled(self, future: Future[Any]) -> None: ...
|
||||
|
||||
|
||||
class _AcquireFutures:
|
||||
futures: Iterable[Future]
|
||||
def __init__(self, futures: Iterable[Future]) -> None: ...
|
||||
futures: Iterable[Future[Any]]
|
||||
def __init__(self, futures: Iterable[Future[Any]]) -> None: ...
|
||||
def __enter__(self) -> None: ...
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
|
||||
13
third_party/2/concurrent/futures/thread.pyi
vendored
13
third_party/2/concurrent/futures/thread.pyi
vendored
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Optional, Tuple, TypeVar, Generic
|
||||
from typing import Any, Callable, Iterable, Mapping, Optional, Tuple, TypeVar, Generic
|
||||
from ._base import Executor, Future
|
||||
import sys
|
||||
|
||||
@@ -22,10 +22,9 @@ class ThreadPoolExecutor(Executor):
|
||||
|
||||
|
||||
class _WorkItem(Generic[_S]):
|
||||
future: Future
|
||||
fn: Callable[[Future[_S]], Any]
|
||||
args: Any
|
||||
kwargs: Any
|
||||
def __init__(self, future: Future, fn: Callable[[Future[_S]], Any], args: Any,
|
||||
kwargs: Any) -> None: ...
|
||||
future: Future[_S]
|
||||
fn: Callable[..., _S]
|
||||
args: Iterable[Any]
|
||||
kwargs: Mapping[str, Any]
|
||||
def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
|
||||
2
third_party/2and3/boto/utils.pyi
vendored
2
third_party/2and3/boto/utils.pyi
vendored
@@ -37,7 +37,7 @@ if sys.version_info >= (3,):
|
||||
else:
|
||||
# TODO move _StringIO definition into boto.compat once stubs exist and rename to StringIO
|
||||
import StringIO
|
||||
_StringIO = StringIO.StringIO
|
||||
_StringIO = StringIO.StringIO[Any]
|
||||
|
||||
from hashlib import _hash
|
||||
_HashType = _hash
|
||||
|
||||
8
third_party/2and3/mock.pyi
vendored
8
third_party/2and3/mock.pyi
vendored
@@ -1,7 +1,9 @@
|
||||
# Stubs for mock
|
||||
|
||||
import sys
|
||||
from typing import Any, Optional, Text, Type
|
||||
from typing import Any, List, Optional, Text, Tuple, Type, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
FILTER_DIR: Any
|
||||
|
||||
@@ -18,7 +20,7 @@ class _Sentinel:
|
||||
sentinel: Any
|
||||
DEFAULT: Any
|
||||
|
||||
class _CallList(list):
|
||||
class _CallList(List[_T]):
|
||||
def __contains__(self, value: Any) -> bool: ...
|
||||
|
||||
class _MockIter:
|
||||
@@ -111,7 +113,7 @@ class _ANY:
|
||||
|
||||
ANY: Any
|
||||
|
||||
class _Call(tuple):
|
||||
class _Call(Tuple[Any, ...]):
|
||||
def __new__(cls, value: Any = ..., name: Optional[Any] = ..., parent: Optional[Any] = ..., two: bool = ..., from_kall: bool = ...) -> Any: ...
|
||||
name: Any
|
||||
parent: Any
|
||||
|
||||
Reference in New Issue
Block a user