apply black and isort (#4287)

* apply black and isort

* move some type ignores
This commit is contained in:
Jelle Zijlstra
2020-06-28 13:31:00 -07:00
committed by GitHub
parent fe58699ca5
commit 5d553c9584
800 changed files with 13875 additions and 10332 deletions
+6 -10
View File
@@ -1,14 +1,13 @@
# Stubs for BaseHTTPServer (Python 2.7)
from typing import Any, BinaryIO, Callable, Mapping, Optional, Tuple, Union
import SocketServer
import mimetools
import SocketServer
from typing import Any, BinaryIO, Callable, Mapping, Optional, Tuple, Union
class HTTPServer(SocketServer.TCPServer):
server_name: str
server_port: int
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...
def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...
class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
client_address: Tuple[str, int]
@@ -27,18 +26,15 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
protocol_version: str
MessageClass: type
responses: Mapping[int, Tuple[str, str]]
def __init__(self, request: bytes, client_address: Tuple[str, int],
server: SocketServer.BaseServer) -> None: ...
def __init__(self, request: bytes, client_address: Tuple[str, int], server: SocketServer.BaseServer) -> None: ...
def handle(self) -> None: ...
def handle_one_request(self) -> None: ...
def send_error(self, code: int, message: Optional[str] = ...) -> None: ...
def send_response(self, code: int,
message: Optional[str] = ...) -> None: ...
def send_response(self, code: int, message: Optional[str] = ...) -> None: ...
def send_header(self, keyword: str, value: str) -> None: ...
def end_headers(self) -> None: ...
def flush_headers(self) -> None: ...
def log_request(self, code: Union[int, str] = ...,
size: Union[int, str] = ...) -> None: ...
def log_request(self, code: Union[int, str] = ..., size: Union[int, str] = ...) -> None: ...
def log_error(self, format: str, *args: Any) -> None: ...
def log_message(self, format: str, *args: Any) -> None: ...
def version_string(self) -> str: ...
+1 -1
View File
@@ -1,7 +1,7 @@
# Stubs for CGIHTTPServer (Python 2.7)
from typing import List
import SimpleHTTPServer
from typing import List
class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
cgi_directories: List[str]
+2 -1
View File
@@ -1,4 +1,5 @@
from typing import Any, IO, Sequence, Tuple, Union, List, Dict, Optional
from typing import IO, Any, Dict, List, Optional, Sequence, Tuple, Union
from _typeshed import SupportsReadline
DEFAULTSECT: str
+2 -5
View File
@@ -1,4 +1,5 @@
from typing import List, Tuple, AnyStr
from typing import AnyStr, List, Tuple
from markupbase import ParserBase
class HTMLParser(ParserBase):
@@ -6,11 +7,9 @@ class HTMLParser(ParserBase):
def feed(self, feed: AnyStr) -> None: ...
def close(self) -> None: ...
def reset(self) -> None: ...
def get_starttag_text(self) -> AnyStr: ...
def set_cdata_mode(self, AnyStr) -> None: ...
def clear_cdata_mode(self) -> None: ...
def handle_startendtag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ...
def handle_starttag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ...
def handle_endtag(self, tag: AnyStr): ...
@@ -20,9 +19,7 @@ class HTMLParser(ParserBase):
def handle_comment(self, data: AnyStr): ...
def handle_decl(self, decl: AnyStr): ...
def handle_pi(self, data: AnyStr): ...
def unknown_decl(self, data: AnyStr): ...
def unescape(self, s: AnyStr) -> AnyStr: ...
class HTMLParseError(Exception):
+2 -2
View File
@@ -1,9 +1,9 @@
# Stubs for Queue (Python 2)
from collections import deque
from typing import Any, Deque, TypeVar, Generic, Optional
from typing import Any, Deque, Generic, Optional, TypeVar
_T = TypeVar('_T')
_T = TypeVar("_T")
class Empty(Exception): ...
class Full(Exception): ...
+1 -1
View File
@@ -1,8 +1,8 @@
# Stubs for SimpleHTTPServer (Python 2)
from typing import Any, AnyStr, IO, Mapping, Optional, Union
import BaseHTTPServer
from StringIO import StringIO
from typing import IO, Any, AnyStr, Mapping, Optional, Union
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
server_version: str
+41 -38
View File
@@ -1,10 +1,10 @@
# NB: SocketServer.pyi and socketserver.pyi must remain consistent!
# Stubs for socketserver
from typing import Any, BinaryIO, Callable, ClassVar, List, Optional, Tuple, Type, Text, Union
from socket import SocketType
import sys
import types
from socket import SocketType
from typing import Any, BinaryIO, Callable, ClassVar, List, Optional, Text, Tuple, Type, Union
class BaseServer:
address_family: int
@@ -15,53 +15,59 @@ class BaseServer:
request_queue_size: int
socket_type: int
timeout: Optional[float]
def __init__(self, server_address: Any,
RequestHandlerClass: Callable[..., BaseRequestHandler]) -> None: ...
def __init__(self, server_address: Any, RequestHandlerClass: Callable[..., BaseRequestHandler]) -> None: ...
def fileno(self) -> int: ...
def handle_request(self) -> None: ...
def serve_forever(self, poll_interval: float = ...) -> None: ...
def shutdown(self) -> None: ...
def server_close(self) -> None: ...
def finish_request(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
def finish_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def get_request(self) -> None: ...
def handle_error(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
def handle_error(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def handle_timeout(self) -> None: ...
def process_request(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def server_activate(self) -> None: ...
def server_bind(self) -> None: ...
def verify_request(self, request: bytes,
client_address: Tuple[str, int]) -> bool: ...
def verify_request(self, request: bytes, client_address: Tuple[str, int]) -> bool: ...
if sys.version_info >= (3, 6):
def __enter__(self) -> BaseServer: ...
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[types.TracebackType]) -> None: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[types.TracebackType]
) -> None: ...
if sys.version_info >= (3, 3):
def service_actions(self) -> None: ...
class TCPServer(BaseServer):
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...) -> None: ...
def __init__(
self,
server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
class UDPServer(BaseServer):
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...) -> None: ...
def __init__(
self,
server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
if sys.platform != 'win32':
if sys.platform != "win32":
class UnixStreamServer(BaseServer):
def __init__(self, server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...) -> None: ...
def __init__(
self,
server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
class UnixDatagramServer(BaseServer):
def __init__(self, server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...) -> None: ...
def __init__(
self,
server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
if sys.platform != "win32":
class ForkingMixIn:
@@ -77,8 +83,7 @@ if sys.platform != "win32":
def handle_timeout(self) -> None: ... # undocumented
if sys.version_info >= (3, 3):
def service_actions(self) -> None: ... # undocumented
def process_request(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
if sys.version_info >= (3, 6):
def server_close(self) -> None: ...
@@ -86,23 +91,22 @@ class ThreadingMixIn:
daemon_threads: bool
if sys.version_info >= (3, 7):
block_on_close: bool
def process_request_thread(self, request: bytes,
client_address: Tuple[str, int]) -> None: ... # undocumented
def process_request(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
def process_request_thread(self, request: bytes, client_address: Tuple[str, int]) -> None: ... # undocumented
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
if sys.version_info >= (3, 6):
def server_close(self) -> None: ...
if sys.platform != "win32":
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
class ForkingUDPServer(ForkingMixIn, UDPServer): ...
class ThreadingTCPServer(ThreadingMixIn, TCPServer): ...
class ThreadingUDPServer(ThreadingMixIn, UDPServer): ...
if sys.platform != 'win32':
if sys.platform != "win32":
class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): ...
class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): ...
class BaseRequestHandler:
# Those are technically of types, respectively:
# * Union[SocketType, Tuple[bytes, SocketType]]
@@ -113,7 +117,6 @@ class BaseRequestHandler:
request: Any
client_address: Any
server: BaseServer
def __init__(self, request: Any, client_address: Any, server: BaseServer) -> None: ...
def setup(self) -> None: ...
def handle(self) -> None: ...
+1 -1
View File
@@ -1,6 +1,6 @@
# Stubs for StringIO (Python 2)
from typing import Any, IO, AnyStr, Iterator, Iterable, Generic, List, Optional
from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List, Optional
class StringIO(IO[AnyStr], Generic[AnyStr]):
closed: bool
+20 -11
View File
@@ -1,25 +1,35 @@
from typing import (Any, Container, Dict, Generic, Iterable, Iterator, List,
Mapping, Optional, Sized, Tuple, TypeVar, Union, overload)
from typing import (
Any,
Container,
Dict,
Generic,
Iterable,
Iterator,
List,
Mapping,
Optional,
Sized,
Tuple,
TypeVar,
Union,
overload,
)
_KT = TypeVar('_KT')
_VT = TypeVar('_VT')
_T = TypeVar('_T')
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_T = TypeVar("_T")
class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
data: Dict[_KT, _VT]
def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ...
# TODO: __iter__ is not available for UserDict
class IterableUserDict(UserDict[_KT, _VT], Generic[_KT, _VT]):
...
class IterableUserDict(UserDict[_KT, _VT], Generic[_KT, _VT]): ...
class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]):
def has_key(self, key: _KT) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_KT]: ...
# From typing.Mapping[_KT, _VT]
# (can't inherit because of keys())
@overload
@@ -32,7 +42,6 @@ class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]):
def itervalues(self) -> Iterator[_VT]: ...
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
def __contains__(self, o: Any) -> bool: ...
# From typing.MutableMapping[_KT, _VT]
def clear(self) -> None: ...
def pop(self, k: _KT, default: _VT = ...) -> _VT: ...
+1 -1
View File
@@ -1,4 +1,4 @@
from typing import Iterable, MutableSequence, TypeVar, Union, overload, List
from typing import Iterable, List, MutableSequence, TypeVar, Union, overload
_T = TypeVar("_T")
_S = TypeVar("_S")
+1 -1
View File
@@ -1,5 +1,5 @@
import collections
from typing import Any, Iterable, List, MutableSequence, Sequence, Optional, overload, Text, TypeVar, Tuple, Union
from typing import Any, Iterable, List, MutableSequence, Optional, Sequence, Text, Tuple, TypeVar, Union, overload
_UST = TypeVar("_UST", bound=UserString)
_MST = TypeVar("_MST", bound=MutableString)
+346 -232
View File
File diff suppressed because it is too large Load Diff
+8 -35
View File
@@ -10,8 +10,7 @@ class AST:
_fields: typing.Tuple[str, ...]
def __init__(self, *args, **kwargs) -> None: ...
class mod(AST):
...
class mod(AST): ...
class Module(mod):
body: typing.List[stmt]
@@ -25,7 +24,6 @@ class Expression(mod):
class Suite(mod):
body: typing.List[stmt]
class stmt(AST):
lineno: int
col_offset: int
@@ -123,10 +121,7 @@ class Expr(stmt):
class Pass(stmt): ...
class Break(stmt): ...
class Continue(stmt): ...
class slice(AST):
...
class slice(AST): ...
_slice = slice # this lets us type the variable named 'slice' below
@@ -143,7 +138,6 @@ class Index(slice):
class Ellipsis(slice): ...
class expr(AST):
lineno: int
col_offset: int
@@ -240,27 +234,17 @@ class Tuple(expr):
elts: typing.List[expr]
ctx: expr_context
class expr_context(AST):
...
class expr_context(AST): ...
class AugLoad(expr_context): ...
class AugStore(expr_context): ...
class Del(expr_context): ...
class Load(expr_context): ...
class Param(expr_context): ...
class Store(expr_context): ...
class boolop(AST):
...
class boolop(AST): ...
class And(boolop): ...
class Or(boolop): ...
class operator(AST):
...
class operator(AST): ...
class Add(operator): ...
class BitAnd(operator): ...
class BitOr(operator): ...
@@ -273,18 +257,12 @@ class Mult(operator): ...
class Pow(operator): ...
class RShift(operator): ...
class Sub(operator): ...
class unaryop(AST):
...
class unaryop(AST): ...
class Invert(unaryop): ...
class Not(unaryop): ...
class UAdd(unaryop): ...
class USub(unaryop): ...
class cmpop(AST):
...
class cmpop(AST): ...
class Eq(cmpop): ...
class Gt(cmpop): ...
class GtE(cmpop): ...
@@ -296,16 +274,12 @@ class LtE(cmpop): ...
class NotEq(cmpop): ...
class NotIn(cmpop): ...
class comprehension(AST):
target: expr
iter: expr
ifs: typing.List[expr]
class excepthandler(AST):
...
class excepthandler(AST): ...
class ExceptHandler(excepthandler):
type: Optional[expr]
@@ -314,7 +288,6 @@ class ExceptHandler(excepthandler):
lineno: int
col_offset: int
class arguments(AST):
args: typing.List[expr]
vararg: Optional[_identifier]
+3 -3
View File
@@ -1,11 +1,11 @@
"""Stub file for the '_collections' module."""
from typing import Any, Callable, Dict, Generic, Iterator, TypeVar, Optional, Union
from typing import Any, Callable, Dict, Generic, Iterator, Optional, TypeVar, Union
_K = TypeVar("_K")
_V = TypeVar("_V")
_T = TypeVar('_T')
_T2 = TypeVar('_T2')
_T = TypeVar("_T")
_T2 = TypeVar("_T2")
class defaultdict(Dict[_K, _V]):
default_factory: None
+3 -6
View File
@@ -1,16 +1,13 @@
"""Stub file for the '_functools' module."""
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Tuple, overload
from typing import Any, Callable, Dict, Iterable, Optional, Tuple, TypeVar, overload
_T = TypeVar("_T")
_S = TypeVar("_S")
@overload
def reduce(function: Callable[[_T, _T], _T],
sequence: Iterable[_T]) -> _T: ...
def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ...
@overload
def reduce(function: Callable[[_T, _S], _T],
sequence: Iterable[_S], initial: _T) -> _T: ...
def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ...
class partial(object):
func: Callable[..., Any]
+1 -1
View File
@@ -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, List, Tuple, Dict, Generic
from typing import Any, Dict, Generic, List, Tuple
def coverage(a: str) -> Any: ...
def logreader(a: str) -> LogReaderType: ...
+20 -22
View File
@@ -1,6 +1,6 @@
from typing import Any, AnyStr, BinaryIO, IO, Text, TextIO, Iterable, Iterator, List, Optional, Type, Tuple, TypeVar, Union
from mmap import mmap
from types import TracebackType
from typing import IO, Any, AnyStr, BinaryIO, Iterable, Iterator, List, Optional, Text, TextIO, Tuple, Type, TypeVar, Union
_bytearray_like = Union[bytearray, mmap]
@@ -32,7 +32,9 @@ class _IOBase(BinaryIO):
def truncate(self, size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
def __enter__(self: _T) -> _T: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> Optional[bool]: ...
def __exit__(
self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]
) -> Optional[bool]: ...
def __iter__(self: _T) -> _T: ...
# The parameter type of writelines[s]() is determined by that of write():
def writelines(self, lines: Iterable[bytes]) -> None: ...
@@ -53,8 +55,7 @@ class _BufferedIOBase(_IOBase):
def detach(self) -> _IOBase: ...
class BufferedRWPair(_BufferedIOBase):
def __init__(self, reader: _RawIOBase, writer: _RawIOBase,
buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
def __init__(self, reader: _RawIOBase, writer: _RawIOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
def peek(self, n: int = ...) -> bytes: ...
def __enter__(self) -> BufferedRWPair: ...
@@ -62,9 +63,7 @@ class BufferedRandom(_BufferedIOBase):
mode: str
name: str
raw: _IOBase
def __init__(self, raw: _IOBase,
buffer_size: int = ...,
max_buffer_size: int = ...) -> None: ...
def __init__(self, raw: _IOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
def peek(self, n: int = ...) -> bytes: ...
class BufferedReader(_BufferedIOBase):
@@ -78,9 +77,7 @@ class BufferedWriter(_BufferedIOBase):
name: str
raw: _IOBase
mode: str
def __init__(self, raw: _IOBase,
buffer_size: int = ...,
max_buffer_size: int = ...) -> None: ...
def __init__(self, raw: _IOBase, buffer_size: int = ..., max_buffer_size: int = ...) -> None: ...
class BytesIO(_BufferedIOBase):
def __init__(self, initial_bytes: bytes = ...) -> None: ...
@@ -115,7 +112,6 @@ class IncrementalNewlineDecoder(object):
def setstate(self, state: Tuple[Any, int]) -> None: ...
def reset(self) -> None: ...
# Note: In the actual _io.py, _TextIOBase inherits from _IOBase.
class _TextIOBase(TextIO):
errors: Optional[str]
@@ -146,14 +142,14 @@ class _TextIOBase(TextIO):
def write(self, pbuf: unicode) -> int: ...
def writelines(self, lines: Iterable[unicode]) -> None: ...
def __enter__(self: _T) -> _T: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> Optional[bool]: ...
def __exit__(
self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]
) -> Optional[bool]: ...
def __iter__(self: _T) -> _T: ...
class StringIO(_TextIOBase):
line_buffering: bool
def __init__(self,
initial_value: Optional[unicode] = ...,
newline: Optional[unicode] = ...) -> None: ...
def __init__(self, initial_value: Optional[unicode] = ..., newline: Optional[unicode] = ...) -> None: ...
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
def __getstate__(self) -> Tuple[Any, ...]: ...
# StringIO does not contain a "name" field. This workaround is necessary
@@ -177,10 +173,12 @@ class TextIOWrapper(_TextIOBase):
write_through: bool = ...,
) -> None: ...
def open(file: Union[str, unicode, int],
mode: Text = ...,
buffering: int = ...,
encoding: Optional[Text] = ...,
errors: Optional[Text] = ...,
newline: Optional[Text] = ...,
closefd: bool = ...) -> IO[Any]: ...
def open(
file: Union[str, unicode, int],
mode: Text = ...,
buffering: int = ...,
encoding: Optional[Text] = ...,
errors: Optional[Text] = ...,
newline: Optional[Text] = ...,
closefd: bool = ...,
) -> IO[Any]: ...
+2 -4
View File
@@ -1,4 +1,4 @@
from typing import Tuple, Union, IO, Any, Optional, overload
from typing import IO, Any, Optional, Tuple, Union, overload
AF_APPLETALK: int
AF_ASH: int
@@ -251,7 +251,6 @@ class SocketType(object):
type: int
proto: int
timeout: float
def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ...
def accept(self) -> Tuple[SocketType, Tuple[Any, ...]]: ...
def bind(self, address: Tuple[Any, ...]) -> None: ...
@@ -269,8 +268,7 @@ class SocketType(object):
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[Any, ...]: ...
def recvfrom_into(self, buffer: bytearray, nbytes: int = ...,
flags: int = ...) -> int: ...
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
+1 -3
View File
@@ -1,6 +1,6 @@
"""Stub file for the '_sre' module."""
from typing import Any, Union, Iterable, Optional, Mapping, Sequence, Dict, List, Tuple, overload
from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union, overload
CODESIZE: int
MAGIC: int
@@ -49,7 +49,5 @@ def compile(
groupindex: Mapping[str, int] = ...,
indexgroup: Sequence[int] = ...,
) -> SRE_Pattern: ...
def getcodesize() -> int: ...
def getlower(a: int, b: int) -> int: ...
-1
View File
@@ -7,7 +7,6 @@ class error(Exception): ...
class Struct(object):
size: int
format: str
def __init__(self, fmt: str) -> None: ...
def pack_into(self, buffer: bytearray, offset: int, obj: Any) -> None: ...
def pack(self, *args) -> str: ...
+2 -4
View File
@@ -1,4 +1,4 @@
from typing import List, Dict
from typing import Dict, List
CELL: int
DEF_BOUND: int
@@ -22,8 +22,7 @@ TYPE_FUNCTION: int
TYPE_MODULE: int
USE: int
class _symtable_entry(object):
...
class _symtable_entry(object): ...
class symtable(object):
children: List[_symtable_entry]
@@ -35,5 +34,4 @@ class symtable(object):
symbols: Dict[str, int]
type: int
varnames: List[str]
def __init__(self, src: str, filename: str, startstr: str) -> None: ...
+4 -5
View File
@@ -1,8 +1,6 @@
import sys
from typing import Optional, Type, Union, Tuple, Any
from types import TracebackType
from typing import Any, Optional, Tuple, Type, Union
_KeyType = Union[HKEYType, int]
@@ -93,7 +91,8 @@ class HKEYType:
def __bool__(self) -> bool: ...
def __int__(self) -> int: ...
def __enter__(self) -> HKEYType: ...
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> Optional[bool]: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
) -> Optional[bool]: ...
def Close(self) -> None: ...
def Detach(self) -> int: ...
+2 -2
View File
@@ -1,7 +1,7 @@
from typing import Any, Callable, Dict, Set, Tuple, Type, TypeVar
import _weakrefset
from typing import Any, Callable, Dict, Set, Tuple, Type, TypeVar
_FuncT = TypeVar('_FuncT', bound=Callable[..., Any])
_FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
# NOTE: mypy has special processing for ABCMeta and abstractmethod.
+1 -1
View File
@@ -20,7 +20,7 @@ def iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ...
def literal_eval(node_or_string: Union[str, unicode, AST]) -> Any: ...
def walk(node: AST) -> Iterator[AST]: ...
class NodeVisitor():
class NodeVisitor:
def visit(self, node: AST) -> Any: ...
def generic_visit(self, node: AST) -> Any: ...
+2 -2
View File
@@ -1,5 +1,5 @@
from typing import TypeVar, Any
from typing import Any, TypeVar
_FT = TypeVar('_FT')
_FT = TypeVar("_FT")
def register(func: _FT, *args: Any, **kargs: Any) -> _FT: ...
+1 -7
View File
@@ -1,4 +1,4 @@
from typing import Any, IO, List
from typing import IO, Any, List
HIGHEST_PROTOCOL: int
compatible_formats: List[str]
@@ -6,20 +6,14 @@ format_version: str
class Pickler:
def __init__(self, file: IO[str], protocol: int = ...) -> None: ...
def dump(self, obj: Any) -> None: ...
def clear_memo(self) -> None: ...
class Unpickler:
def __init__(self, file: IO[str]) -> None: ...
def load(self) -> Any: ...
def noload(self) -> Any: ...
def dump(obj: Any, file: IO[str], protocol: int = ...) -> None: ...
def dumps(obj: Any, protocol: int = ...) -> str: ...
def load(file: IO[str]) -> Any: ...
+1 -2
View File
@@ -2,8 +2,8 @@
# See https://docs.python.org/2/library/stringio.html
from abc import ABCMeta
from typing import overload, IO, List, Iterable, Iterator, Optional, Union
from types import TracebackType
from typing import IO, Iterable, Iterator, List, Optional, Union, overload
# TODO the typing.IO[] generics should be split into input and output.
@@ -26,7 +26,6 @@ class InputType(IO[str], Iterator[str], metaclass=ABCMeta):
def next(self) -> str: ...
def reset(self) -> None: ...
class OutputType(IO[str], Iterator[str], metaclass=ABCMeta):
@property
def softspace(self) -> int: ...
+29 -20
View File
@@ -1,38 +1,50 @@
# These are not exported.
from typing import Any, Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
# These are exported.
from typing import (
AbstractSet as Set,
Any,
Callable as Callable,
Container as Container,
Dict,
Generic,
Hashable as Hashable,
ItemsView as ItemsView,
Iterable as Iterable,
Iterator as Iterator,
KeysView as KeysView,
List,
Mapping as Mapping,
MappingView as MappingView,
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
Optional,
Reversible,
Sequence as Sequence,
AbstractSet as Set,
Sized as Sized,
Tuple,
Type,
TypeVar,
Union,
ValuesView as ValuesView,
overload,
)
_S = TypeVar('_S')
_T = TypeVar('_T')
_KT = TypeVar('_KT')
_VT = TypeVar('_VT')
_S = TypeVar("_S")
_T = TypeVar("_T")
_KT = TypeVar("_KT")
_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[Any, ...]]: ...
def namedtuple(
typename: Union[str, unicode],
field_names: Union[str, unicode, Iterable[Union[str, unicode]]],
verbose: bool = ...,
rename: bool = ...,
) -> Type[Tuple[Any, ...]]: ...
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...,
maxlen: int = ...) -> None: ...
def __init__(self, iterable: Iterable[_T] = ..., maxlen: int = ...) -> None: ...
@property
def maxlen(self) -> Optional[int]: ...
def append(self, x: _T) -> None: ...
@@ -81,7 +93,6 @@ class Counter(Dict[_T, int], Generic[_T]):
def update(self, __m: Union[Iterable[_T], Iterable[Tuple[_T, int]]], **kwargs: int) -> None: ...
@overload
def update(self, **kwargs: int) -> None: ...
def __add__(self, other: Counter[_T]) -> Counter[_T]: ...
def __sub__(self, other: Counter[_T]) -> Counter[_T]: ...
def __and__(self, other: Counter[_T]) -> Counter[_T]: ...
@@ -105,16 +116,14 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]], **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]],
map: Mapping[_KT, _VT]) -> None: ...
def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT]) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]],
map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]],
iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
def __init__(self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
@overload
def __init__(self, default_factory: Optional[Callable[[], _VT]],
iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
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: _S) -> _S: ...
+1 -3
View File
@@ -1,12 +1,10 @@
from typing import overload, AnyStr, Text, Tuple
from typing import AnyStr, Text, Tuple, overload
def getstatus(file: Text) -> str: ...
def getoutput(cmd: Text) -> str: ...
def getstatusoutput(cmd: Text) -> Tuple[int, str]: ...
@overload
def mk2arg(head: bytes, x: bytes) -> bytes: ...
@overload
def mk2arg(head: Text, x: Text) -> Text: ...
def mkarg(x: AnyStr) -> AnyStr: ...
+2 -1
View File
@@ -1,6 +1,7 @@
from _typeshed import AnyPath
from typing import Any, Optional, Pattern
from _typeshed import AnyPath
# rx can be any object with a 'search' method; once we have Protocols we can change the type
def compile_dir(
dir: AnyPath,
+36 -6
View File
@@ -17,8 +17,26 @@ class Cookie:
comment: Any
comment_url: Any
rfc2109: Any
def __init__(self, version, name, value, port, port_specified, domain, domain_specified, domain_initial_dot, path,
path_specified, secure, expires, discard, comment, comment_url, rest, rfc2109: bool = ...): ...
def __init__(
self,
version,
name,
value,
port,
port_specified,
domain,
domain_specified,
domain_initial_dot,
path,
path_specified,
secure,
expires,
discard,
comment,
comment_url,
rest,
rfc2109: bool = ...,
): ...
def has_nonstandard_attr(self, name): ...
def get_nonstandard_attr(self, name, default: Optional[Any] = ...): ...
def set_nonstandard_attr(self, name, value): ...
@@ -46,10 +64,21 @@ class DefaultCookiePolicy(CookiePolicy):
strict_ns_domain: Any
strict_ns_set_initial_dollar: Any
strict_ns_set_path: Any
def __init__(self, blocked_domains: Optional[Any] = ..., allowed_domains: Optional[Any] = ..., netscape: bool = ...,
rfc2965: bool = ..., rfc2109_as_netscape: Optional[Any] = ..., hide_cookie2: bool = ...,
strict_domain: bool = ..., strict_rfc2965_unverifiable: bool = ..., strict_ns_unverifiable: bool = ...,
strict_ns_domain=..., strict_ns_set_initial_dollar: bool = ..., strict_ns_set_path: bool = ...): ...
def __init__(
self,
blocked_domains: Optional[Any] = ...,
allowed_domains: Optional[Any] = ...,
netscape: bool = ...,
rfc2965: bool = ...,
rfc2109_as_netscape: Optional[Any] = ...,
hide_cookie2: bool = ...,
strict_domain: bool = ...,
strict_rfc2965_unverifiable: bool = ...,
strict_ns_unverifiable: bool = ...,
strict_ns_domain=...,
strict_ns_set_initial_dollar: bool = ...,
strict_ns_set_path: bool = ...,
): ...
def blocked_domains(self): ...
def set_blocked_domains(self, blocked_domains): ...
def is_blocked(self, domain): ...
@@ -109,4 +138,5 @@ class LWPCookieJar(FileCookieJar):
def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented
MozillaCookieJar = FileCookieJar
def lwp_cookie_str(cookie: Cookie) -> str: ...
+6 -4
View File
@@ -1,13 +1,15 @@
from typing import TypeVar, Callable, Union, Tuple, Any, Optional, SupportsInt, Hashable, List
from typing import Any, Callable, Hashable, List, Optional, SupportsInt, Tuple, TypeVar, Union
_Type = TypeVar("_Type", bound=type)
_Reduce = Union[Tuple[Callable[..., _Type], Tuple[Any, ...]], Tuple[Callable[..., _Type], Tuple[Any, ...], Optional[Any]]]
__all__: List[str]
def pickle(ob_type: _Type, pickle_function: Callable[[_Type], Union[str, _Reduce[_Type]]], constructor_ob: Optional[Callable[[_Reduce[_Type]], _Type]] = ...) -> None: ...
def pickle(
ob_type: _Type,
pickle_function: Callable[[_Type], Union[str, _Reduce[_Type]]],
constructor_ob: Optional[Callable[[_Reduce[_Type]], _Type]] = ...,
) -> None: ...
def constructor(object: Callable[[_Reduce[_Type]], _Type]) -> None: ...
def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ...
def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ...
+3
View File
@@ -1,8 +1,11 @@
def base64_len(s: bytes) -> int: ...
def header_encode(header, charset=..., keep_eols=..., maxlinelen=..., eol=...): ...
def encode(s, binary=..., maxlinelen=..., eol=...): ...
body_encode = encode
encodestring = encode
def decode(s, convert_eols=...): ...
body_decode = decode
decodestring = decode
-1
View File
@@ -11,7 +11,6 @@ class BufferedSubFile:
def __iter__(self): ...
def next(self): ...
class FeedParser:
def __init__(self, _factory=...) -> None: ...
def feed(self, data) -> None: ...
-1
View File
@@ -4,6 +4,5 @@ class Generator:
def flatten(self, msg, unixfrom: bool = ...) -> None: ...
def clone(self, fp): ...
class DecodedGenerator(Generator):
def __init__(self, outfp, mangle_from_: bool = ..., maxheaderlen: int = ..., fmt=...) -> None: ...
+1 -2
View File
@@ -2,8 +2,7 @@ def decode_header(header): ...
def make_header(decoded_seq, maxlinelen=..., header_name=..., continuation_ws=...): ...
class Header:
def __init__(self, s=..., charset=..., maxlinelen=..., header_name=..., continuation_ws=...,
errors=...) -> None: ...
def __init__(self, s=..., charset=..., maxlinelen=..., header_name=..., continuation_ws=..., errors=...) -> None: ...
def __unicode__(self): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
+4 -4
View File
@@ -1,11 +1,11 @@
# Stubs for email.mime.application
from typing import Callable, Optional, Tuple, Union
from email.mime.nonmultipart import MIMENonMultipart
from typing import Callable, Optional, Tuple, Union
_ParamsType = Union[str, None, Tuple[str, Optional[str], str]]
class MIMEApplication(MIMENonMultipart):
def __init__(self, _data: bytes, _subtype: str = ...,
_encoder: Callable[[MIMEApplication], None] = ...,
**_params: _ParamsType) -> None: ...
def __init__(
self, _data: bytes, _subtype: str = ..., _encoder: Callable[[MIMEApplication], None] = ..., **_params: _ParamsType
) -> None: ...
-1
View File
@@ -1,5 +1,4 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEAudio(MIMENonMultipart):
def __init__(self, _audiodata, _subtype=..., _encoder=..., **_params) -> None: ...
-1
View File
@@ -1,5 +1,4 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEImage(MIMENonMultipart):
def __init__(self, _imagedata, _subtype=..., _encoder=..., **_params) -> None: ...
-1
View File
@@ -1,5 +1,4 @@
from email.mime.nonmultipart import MIMENonMultipart
class MIMEMessage(MIMENonMultipart):
def __init__(self, _msg, _subtype=...) -> None: ...
+7 -5
View File
@@ -1,9 +1,11 @@
from email._parseaddr import AddressList as _AddressList
from email._parseaddr import mktime_tz as mktime_tz
from email._parseaddr import parsedate as _parsedate
from email._parseaddr import parsedate_tz as _parsedate_tz
from email._parseaddr import (
AddressList as _AddressList,
mktime_tz as mktime_tz,
parsedate as _parsedate,
parsedate_tz as _parsedate_tz,
)
from quopri import decodestring as _qdecode
from typing import Optional, Any
from typing import Any, Optional
def formataddr(pair): ...
def getaddresses(fieldvalues): ...
-1
View File
@@ -1,5 +1,4 @@
import codecs
from typing import Any
def search_function(encoding: str) -> codecs.CodecInfo: ...
+50 -48
View File
@@ -1,48 +1,50 @@
from __builtin__ import ArithmeticError as ArithmeticError
from __builtin__ import AssertionError as AssertionError
from __builtin__ import AttributeError as AttributeError
from __builtin__ import BaseException as BaseException
from __builtin__ import BufferError as BufferError
from __builtin__ import BytesWarning as BytesWarning
from __builtin__ import DeprecationWarning as DeprecationWarning
from __builtin__ import EOFError as EOFError
from __builtin__ import EnvironmentError as EnvironmentError
from __builtin__ import Exception as Exception
from __builtin__ import FloatingPointError as FloatingPointError
from __builtin__ import FutureWarning as FutureWarning
from __builtin__ import GeneratorExit as GeneratorExit
from __builtin__ import IOError as IOError
from __builtin__ import ImportError as ImportError
from __builtin__ import ImportWarning as ImportWarning
from __builtin__ import IndentationError as IndentationError
from __builtin__ import IndexError as IndexError
from __builtin__ import KeyError as KeyError
from __builtin__ import KeyboardInterrupt as KeyboardInterrupt
from __builtin__ import LookupError as LookupError
from __builtin__ import MemoryError as MemoryError
from __builtin__ import NameError as NameError
from __builtin__ import NotImplementedError as NotImplementedError
from __builtin__ import OSError as OSError
from __builtin__ import OverflowError as OverflowError
from __builtin__ import PendingDeprecationWarning as PendingDeprecationWarning
from __builtin__ import ReferenceError as ReferenceError
from __builtin__ import RuntimeError as RuntimeError
from __builtin__ import RuntimeWarning as RuntimeWarning
from __builtin__ import StandardError as StandardError
from __builtin__ import StopIteration as StopIteration
from __builtin__ import SyntaxError as SyntaxError
from __builtin__ import SyntaxWarning as SyntaxWarning
from __builtin__ import SystemError as SystemError
from __builtin__ import SystemExit as SystemExit
from __builtin__ import TabError as TabError
from __builtin__ import TypeError as TypeError
from __builtin__ import UnboundLocalError as UnboundLocalError
from __builtin__ import UnicodeError as UnicodeError
from __builtin__ import UnicodeDecodeError as UnicodeDecodeError
from __builtin__ import UnicodeEncodeError as UnicodeEncodeError
from __builtin__ import UnicodeTranslateError as UnicodeTranslateError
from __builtin__ import UnicodeWarning as UnicodeWarning
from __builtin__ import UserWarning as UserWarning
from __builtin__ import ValueError as ValueError
from __builtin__ import Warning as Warning
from __builtin__ import ZeroDivisionError as ZeroDivisionError
from __builtin__ import (
ArithmeticError as ArithmeticError,
AssertionError as AssertionError,
AttributeError as AttributeError,
BaseException as BaseException,
BufferError as BufferError,
BytesWarning as BytesWarning,
DeprecationWarning as DeprecationWarning,
EnvironmentError as EnvironmentError,
EOFError as EOFError,
Exception as Exception,
FloatingPointError as FloatingPointError,
FutureWarning as FutureWarning,
GeneratorExit as GeneratorExit,
ImportError as ImportError,
ImportWarning as ImportWarning,
IndentationError as IndentationError,
IndexError as IndexError,
IOError as IOError,
KeyboardInterrupt as KeyboardInterrupt,
KeyError as KeyError,
LookupError as LookupError,
MemoryError as MemoryError,
NameError as NameError,
NotImplementedError as NotImplementedError,
OSError as OSError,
OverflowError as OverflowError,
PendingDeprecationWarning as PendingDeprecationWarning,
ReferenceError as ReferenceError,
RuntimeError as RuntimeError,
RuntimeWarning as RuntimeWarning,
StandardError as StandardError,
StopIteration as StopIteration,
SyntaxError as SyntaxError,
SyntaxWarning as SyntaxWarning,
SystemError as SystemError,
SystemExit as SystemExit,
TabError as TabError,
TypeError as TypeError,
UnboundLocalError as UnboundLocalError,
UnicodeDecodeError as UnicodeDecodeError,
UnicodeEncodeError as UnicodeEncodeError,
UnicodeError as UnicodeError,
UnicodeTranslateError as UnicodeTranslateError,
UnicodeWarning as UnicodeWarning,
UserWarning as UserWarning,
ValueError as ValueError,
Warning as Warning,
ZeroDivisionError as ZeroDivisionError,
)
+3 -5
View File
@@ -1,4 +1,5 @@
from typing import Any, Union
from _typeshed import FileDescriptorLike
FASYNC: int
@@ -77,9 +78,6 @@ LOCK_WRITE: int
def fcntl(fd: FileDescriptorLike, op: int, arg: Union[int, bytes] = ...) -> Any: ...
# TODO: arg: int or read-only buffer interface or read-write buffer interface
def ioctl(fd: FileDescriptorLike, op: int, arg: Union[int, bytes] = ...,
mutate_flag: bool = ...) -> Any: ...
def ioctl(fd: FileDescriptorLike, op: int, arg: Union[int, bytes] = ..., mutate_flag: bool = ...) -> Any: ...
def flock(fd: FileDescriptorLike, op: int) -> None: ...
def lockf(fd: FileDescriptorLike, op: int, length: int = ..., start: int = ...,
whence: int = ...) -> Any: ...
def lockf(fd: FileDescriptorLike, op: int, length: int = ..., start: int = ..., whence: int = ...) -> Any: ...
+9 -8
View File
@@ -3,25 +3,26 @@
# NOTE: These are incomplete!
from abc import ABCMeta, abstractmethod
from typing import Any, Callable, Generic, Dict, Iterable, Optional, Sequence, Tuple, Type, TypeVar, overload
from typing import Any, Callable, Dict, Generic, Iterable, Optional, Sequence, Tuple, Type, TypeVar, overload
_AnyCallable = Callable[..., Any]
_T = TypeVar("_T")
_S = TypeVar("_S")
@overload
def reduce(function: Callable[[_T, _T], _T],
sequence: Iterable[_T]) -> _T: ...
def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ...
@overload
def reduce(function: Callable[[_T, _S], _T],
sequence: Iterable[_S], initial: _T) -> _T: ...
def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T) -> _T: ...
WRAPPER_ASSIGNMENTS: Sequence[str]
WRAPPER_UPDATES: Sequence[str]
def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ...,
updated: Sequence[str] = ...) -> _AnyCallable: ...
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...
def update_wrapper(
wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...
) -> _AnyCallable: ...
def wraps(
wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...
) -> Callable[[_AnyCallable], _AnyCallable]: ...
def total_ordering(cls: Type[_T]) -> Type[_T]: ...
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
+1 -9
View File
@@ -1,14 +1,6 @@
from itertools import ifilter as filter, imap as map, izip as zip
from typing import Any
from itertools import ifilter as filter
from itertools import imap as map
from itertools import izip as zip
def ascii(obj: Any) -> str: ...
def hex(x: int) -> str: ...
def oct(x: int) -> str: ...
+1 -3
View File
@@ -2,7 +2,6 @@
from typing import Any, List, Tuple
def enable() -> None: ...
def disable() -> None: ...
def isenabled() -> bool: ...
@@ -10,8 +9,7 @@ def collect(generation: int = ...) -> int: ...
def set_debug(flags: int) -> None: ...
def get_debug() -> int: ...
def get_objects() -> List[Any]: ...
def set_threshold(threshold0: int, threshold1: int = ...,
threshold2: int = ...) -> None: ...
def set_threshold(threshold0: int, threshold1: int = ..., threshold2: int = ...) -> None: ...
def get_count() -> Tuple[int, int, int]: ...
def get_threshold() -> Tuple[int, int, int]: ...
def get_referrers(*objs: Any) -> List[Any]: ...
+1 -1
View File
@@ -1,6 +1,6 @@
# Stubs for getpass (Python 2)
from typing import Any, IO
from typing import IO, Any
class GetPassWarning(UserWarning): ...
+15 -8
View File
@@ -1,4 +1,4 @@
from typing import Any, Container, Dict, IO, List, Optional, Sequence, Type, Union
from typing import IO, Any, Container, Dict, List, Optional, Sequence, Type, Union
def bindtextdomain(domain: str, localedir: str = ...) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: str = ...) -> str: ...
@@ -32,10 +32,17 @@ class GNUTranslations(NullTranslations):
LE_MAGIC: int
BE_MAGIC: int
def find(domain: str, localedir: Optional[str] = ..., languages: Optional[Sequence[str]] = ...,
all: Any = ...) -> Optional[Union[str, List[str]]]: ...
def translation(domain: str, localedir: Optional[str] = ..., languages: Optional[Sequence[str]] = ...,
class_: Optional[Type[NullTranslations]] = ..., fallback: bool = ..., codeset: Optional[str] = ...) -> NullTranslations: ...
def install(domain: str, localedir: Optional[str] = ..., unicode: bool = ..., codeset: Optional[str] = ...,
names: Container[str] = ...) -> None: ...
def find(
domain: str, localedir: Optional[str] = ..., languages: Optional[Sequence[str]] = ..., all: Any = ...
) -> Optional[Union[str, List[str]]]: ...
def translation(
domain: str,
localedir: Optional[str] = ...,
languages: Optional[Sequence[str]] = ...,
class_: Optional[Type[NullTranslations]] = ...,
fallback: bool = ...,
codeset: Optional[str] = ...,
) -> NullTranslations: ...
def install(
domain: str, localedir: Optional[str] = ..., unicode: bool = ..., codeset: Optional[str] = ..., names: Container[str] = ...
) -> None: ...
+1 -1
View File
@@ -1,4 +1,4 @@
from typing import List, Iterator, Union, AnyStr
from typing import AnyStr, Iterator, List, Union
def glob(pathname: AnyStr) -> List[AnyStr]: ...
def iglob(pathname: AnyStr) -> Iterator[AnyStr]: ...
+4 -3
View File
@@ -1,5 +1,5 @@
from typing import Any, IO, Text
import io
from typing import IO, Any, Text
class GzipFile(io.BufferedIOBase):
myfileobj: Any
@@ -14,8 +14,9 @@ class GzipFile(io.BufferedIOBase):
fileobj: Any
offset: Any
mtime: Any
def __init__(self, filename: str = ..., mode: Text = ..., compresslevel: int = ...,
fileobj: IO[str] = ..., mtime: float = ...) -> None: ...
def __init__(
self, filename: str = ..., mode: Text = ..., compresslevel: int = ..., fileobj: IO[str] = ..., mtime: float = ...
) -> None: ...
@property
def filename(self): ...
size: Any
-1
View File
@@ -16,7 +16,6 @@ class _hash(object): # This is not actually in the module namespace.
def copy(self) -> _hash: ...
def new(name: str, data: str = ...) -> _hash: ...
def md5(s: _DataType = ...) -> _hash: ...
def sha1(s: _DataType = ...) -> _hash: ...
def sha224(s: _DataType = ...) -> _hash: ...
+4 -6
View File
@@ -1,6 +1,6 @@
from typing import TypeVar, List, Iterable, Any, Callable, Optional, Protocol
from typing import Any, Callable, Iterable, List, Optional, Protocol, TypeVar
_T = TypeVar('_T')
_T = TypeVar("_T")
class _Sortable(Protocol):
def __lt__(self: _T, other: _T) -> bool: ...
@@ -12,7 +12,5 @@ def heappushpop(heap: List[_T], item: _T) -> _T: ...
def heapify(x: List[_T]) -> None: ...
def heapreplace(heap: List[_T], item: _T) -> _T: ...
def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ...
def nlargest(n: int, iterable: Iterable[_T],
key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
def nsmallest(n: int, iterable: Iterable[_T],
key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
def nlargest(n: int, iterable: Iterable[_T], key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
def nsmallest(n: int, iterable: Iterable[_T], key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
+27 -9
View File
@@ -3,9 +3,9 @@
# Generated by stubgen and manually massaged a bit.
# Needs lots more work!
from typing import Any, Dict, Optional, Protocol
import mimetools
import ssl
from typing import Any, Dict, Optional, Protocol
class HTTPMessage(mimetools.Message):
def addcontinue(self, key: str, more: str) -> None: ...
@@ -29,8 +29,9 @@ class HTTPResponse:
chunk_left: Any
length: Any
will_close: Any
def __init__(self, sock, debuglevel: int = ..., strict: int = ..., method: Optional[Any] = ...,
buffering: bool = ...) -> None: ...
def __init__(
self, sock, debuglevel: int = ..., strict: int = ..., method: Optional[Any] = ..., buffering: bool = ...
) -> None: ...
def begin(self): ...
def close(self): ...
def isclosed(self): ...
@@ -59,8 +60,9 @@ class HTTPConnection:
sock: Any
host: str = ...
port: int = ...
def __init__(self, host, port: Optional[Any] = ..., strict: Optional[Any] = ..., timeout=...,
source_address: Optional[Any] = ...) -> None: ...
def __init__(
self, host, port: Optional[Any] = ..., strict: Optional[Any] = ..., timeout=..., source_address: Optional[Any] = ...
) -> None: ...
def set_tunnel(self, host, port: Optional[Any] = ..., headers: Optional[Any] = ...): ...
def set_debuglevel(self, level): ...
def connect(self): ...
@@ -86,16 +88,32 @@ class HTTPSConnection(HTTPConnection):
default_port: Any
key_file: Any
cert_file: Any
def __init__(self, host, port: Optional[Any] = ..., key_file: Optional[Any] = ..., cert_file: Optional[Any] = ...,
strict: Optional[Any] = ..., timeout=..., source_address: Optional[Any] = ...,
context: Optional[Any] = ...) -> None: ...
def __init__(
self,
host,
port: Optional[Any] = ...,
key_file: Optional[Any] = ...,
cert_file: Optional[Any] = ...,
strict: Optional[Any] = ...,
timeout=...,
source_address: Optional[Any] = ...,
context: Optional[Any] = ...,
) -> None: ...
sock: Any
def connect(self): ...
class HTTPS(HTTP):
key_file: Any
cert_file: Any
def __init__(self, host: str = ..., port: Optional[Any] = ..., key_file: Optional[Any] = ..., cert_file: Optional[Any] = ..., strict: Optional[Any] = ..., context: Optional[Any] = ...) -> None: ...
def __init__(
self,
host: str = ...,
port: Optional[Any] = ...,
key_file: Optional[Any] = ...,
cert_file: Optional[Any] = ...,
strict: Optional[Any] = ...,
context: Optional[Any] = ...,
) -> None: ...
class HTTPException(Exception): ...
class NotConnected(HTTPException): ...
+1 -1
View File
@@ -1,7 +1,7 @@
"""Stubs for the 'imp' module."""
from typing import List, Optional, Tuple, Iterable, IO, Any
import types
from typing import IO, Any, Iterable, List, Optional, Tuple
C_BUILTIN: int
C_EXTENSION: int
+12 -16
View File
@@ -1,5 +1,5 @@
from types import CodeType, TracebackType, FrameType, FunctionType, MethodType, ModuleType
from typing import Any, Dict, Callable, List, NamedTuple, Optional, Sequence, Tuple, Type, Union, AnyStr
from types import CodeType, FrameType, FunctionType, MethodType, ModuleType, TracebackType
from typing import Any, AnyStr, Callable, Dict, List, NamedTuple, Optional, Sequence, Tuple, Type, Union
# Types and members
class EndOfBlock(Exception): ...
@@ -10,8 +10,9 @@ class BlockFinder:
started: bool
passline: bool
last: int
def tokeneater(self, type: int, token: AnyStr, srow_scol: Tuple[int, int],
erow_ecol: Tuple[int, int], line: AnyStr) -> None: ...
def tokeneater(
self, type: int, token: AnyStr, srow_scol: Tuple[int, int], erow_ecol: Tuple[int, int], line: AnyStr
) -> None: ...
CO_GENERATOR: int
CO_NESTED: int
@@ -28,13 +29,9 @@ class ModuleInfo(NamedTuple):
mode: str
module_type: int
def getmembers(
object: object,
predicate: Optional[Callable[[Any], bool]] = ...
) -> List[Tuple[str, Any]]: ...
def getmembers(object: object, predicate: Optional[Callable[[Any], bool]] = ...) -> List[Tuple[str, Any]]: ...
def getmoduleinfo(path: Union[str, unicode]) -> Optional[ModuleInfo]: ...
def getmodulename(path: AnyStr) -> Optional[AnyStr]: ...
def ismodule(object: object) -> bool: ...
def isclass(object: object) -> bool: ...
def ismethod(object: object) -> bool: ...
@@ -91,12 +88,12 @@ class Arguments(NamedTuple):
def getargs(co: CodeType) -> Arguments: ...
def getargspec(func: object) -> ArgSpec: ...
def getargvalues(frame: FrameType) -> ArgInfo: ...
def formatargspec(args, varargs=..., varkw=..., defaults=...,
formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=...,
join=...) -> str: ...
def formatargvalues(args, varargs=..., varkw=..., defaults=...,
formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=...,
join=...) -> str: ...
def formatargspec(
args, varargs=..., varkw=..., defaults=..., formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., join=...
) -> str: ...
def formatargvalues(
args, varargs=..., varkw=..., defaults=..., formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=..., join=...
) -> str: ...
def getmro(cls: type) -> Tuple[type, ...]: ...
def getcallargs(func, *args, **kwds) -> Dict[str, Any]: ...
@@ -115,7 +112,6 @@ def getouterframes(frame: FrameType, context: int = ...) -> List[_FrameInfo]: ..
def getframeinfo(frame: Union[FrameType, TracebackType], context: int = ...) -> Traceback: ...
def getinnerframes(traceback: TracebackType, context: int = ...) -> List[_FrameInfo]: ...
def getlineno(frame: FrameType) -> int: ...
def currentframe(depth: int = ...) -> FrameType: ...
def stack(context: int = ...) -> List[_FrameInfo]: ...
def trace(context: int = ...) -> List[_FrameInfo]: ...
+25 -21
View File
@@ -5,36 +5,40 @@
# Only a subset of functionality is included.
from typing import IO, Any, Union
import _io
from _io import (
DEFAULT_BUFFER_SIZE as DEFAULT_BUFFER_SIZE,
BlockingIOError as BlockingIOError,
BufferedRandom as BufferedRandom,
BufferedReader as BufferedReader,
BufferedRWPair as BufferedRWPair,
BufferedWriter as BufferedWriter,
BytesIO as BytesIO,
FileIO as FileIO,
IncrementalNewlineDecoder as IncrementalNewlineDecoder,
StringIO as StringIO,
TextIOWrapper as TextIOWrapper,
UnsupportedOperation as UnsupportedOperation,
open as open,
)
from _io import BlockingIOError as BlockingIOError
from _io import BufferedRWPair as BufferedRWPair
from _io import BufferedRandom as BufferedRandom
from _io import BufferedReader as BufferedReader
from _io import BufferedWriter as BufferedWriter
from _io import BytesIO as BytesIO
from _io import DEFAULT_BUFFER_SIZE as DEFAULT_BUFFER_SIZE
from _io import FileIO as FileIO
from _io import IncrementalNewlineDecoder as IncrementalNewlineDecoder
from _io import StringIO as StringIO
from _io import TextIOWrapper as TextIOWrapper
from _io import UnsupportedOperation as UnsupportedOperation
from _io import open as open
def _OpenWrapper(file: Union[str, unicode, int],
mode: unicode = ..., buffering: int = ..., encoding: unicode = ...,
errors: unicode = ..., newline: unicode = ...,
closefd: bool = ...) -> IO[Any]: ...
def _OpenWrapper(
file: Union[str, unicode, int],
mode: unicode = ...,
buffering: int = ...,
encoding: unicode = ...,
errors: unicode = ...,
newline: unicode = ...,
closefd: bool = ...,
) -> IO[Any]: ...
SEEK_SET: int
SEEK_CUR: int
SEEK_END: int
class IOBase(_io._IOBase): ...
class RawIOBase(_io._RawIOBase, IOBase): ...
class BufferedIOBase(_io._BufferedIOBase, IOBase): ...
# Note: In the actual io.py, TextIOBase subclasses IOBase.
+110 -109
View File
@@ -2,14 +2,12 @@
# Based on https://docs.python.org/2/library/itertools.html
from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple,
Union, Sequence, Generic, Optional)
from typing import Any, Callable, Generic, Iterable, Iterator, Optional, Sequence, Tuple, TypeVar, Union, overload
_T = TypeVar('_T')
_S = TypeVar('_S')
_T = TypeVar("_T")
_S = TypeVar("_S")
def count(start: int = ...,
step: int = ...) -> Iterator[int]: ... # more general types?
def count(start: int = ..., step: int = ...) -> Iterator[int]: ... # more general types?
class cycle(Iterator[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T]) -> None: ...
@@ -26,142 +24,145 @@ class chain(Iterator[_T], Generic[_T]):
def from_iterable(iterable: Iterable[Iterable[_S]]) -> Iterator[_S]: ...
def compress(data: Iterable[_T], selectors: Iterable[Any]) -> Iterator[_T]: ...
def dropwhile(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def ifilter(predicate: Optional[Callable[[_T], Any]],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def ifilterfalse(predicate: Optional[Callable[[_T], Any]],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def dropwhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ...
def ifilter(predicate: Optional[Callable[[_T], Any]], iterable: Iterable[_T]) -> Iterator[_T]: ...
def ifilterfalse(predicate: Optional[Callable[[_T], Any]], iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def groupby(iterable: Iterable[_T], key: None = ...) -> Iterator[Tuple[_T, Iterator[_T]]]: ...
@overload
def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...
@overload
def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ...
@overload
def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int],
step: Optional[int] = ...) -> Iterator[_T]: ...
_T1 = TypeVar('_T1')
_T2 = TypeVar('_T2')
_T3 = TypeVar('_T3')
_T4 = TypeVar('_T4')
_T5 = TypeVar('_T5')
_T6 = TypeVar('_T6')
def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> Iterator[_T]: ...
_T1 = TypeVar("_T1")
_T2 = TypeVar("_T2")
_T3 = TypeVar("_T3")
_T4 = TypeVar("_T4")
_T5 = TypeVar("_T5")
_T6 = TypeVar("_T6")
@overload
def imap(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ...
@overload
def imap(func: Callable[[_T1, _T2], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[_S]: ...
def imap(func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[_S]: ...
@overload
def imap(func: Callable[[_T1, _T2, _T3], _S],
iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> Iterator[_S]: ...
def imap(
func: Callable[[_T1, _T2, _T3], _S], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]
) -> Iterator[_S]: ...
@overload
def imap(func: Callable[[_T1, _T2, _T3, _T4], _S],
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> Iterator[_S]: ...
def imap(
func: Callable[[_T1, _T2, _T3, _T4], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
) -> Iterator[_S]: ...
@overload
def imap(func: Callable[[_T1, _T2, _T3, _T4, _T5], _S],
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> Iterator[_S]: ...
def imap(
func: Callable[[_T1, _T2, _T3, _T4, _T5], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5],
) -> Iterator[_S]: ...
@overload
def imap(func: Callable[[_T1, _T2, _T3, _T4, _T5, _T6], _S],
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4], iter5: Iterable[_T5],
iter6: Iterable[_T6]) -> Iterator[_S]: ...
def imap(
func: Callable[[_T1, _T2, _T3, _T4, _T5, _T6], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5],
iter6: Iterable[_T6],
) -> Iterator[_S]: ...
@overload
def imap(func: Callable[..., _S],
iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any],
iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any],
iter7: Iterable[Any], *iterables: Iterable[Any]) -> Iterator[_S]: ...
def imap(
func: Callable[..., _S],
iter1: Iterable[Any],
iter2: Iterable[Any],
iter3: Iterable[Any],
iter4: Iterable[Any],
iter5: Iterable[Any],
iter6: Iterable[Any],
iter7: Iterable[Any],
*iterables: Iterable[Any],
) -> Iterator[_S]: ...
def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ...
def takewhile(predicate: Callable[[_T], Any],
iterable: Iterable[_T]) -> Iterator[_T]: ...
def takewhile(predicate: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ...
def tee(iterable: Iterable[_T], n: int = ...) -> Tuple[Iterator[_T], ...]: ...
@overload
def izip(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
@overload
def izip(iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
@overload
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
@overload
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2,
_T3, _T4]]: ...
def izip(
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4]
) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ...
@overload
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3], iter4: Iterable[_T4],
iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2,
_T3, _T4, _T5]]: ...
def izip(
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5]
) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
@overload
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3], iter4: Iterable[_T4],
iter5: Iterable[_T5], iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3,
_T4, _T5, _T6]]: ...
def izip(
iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5],
iter6: Iterable[_T6],
) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
@overload
def izip(iter1: Iterable[Any], iter2: Iterable[Any],
iter3: Iterable[Any], iter4: Iterable[Any],
iter5: Iterable[Any], iter6: Iterable[Any],
iter7: Iterable[Any], *iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ...
def izip_longest(*p: Iterable[Any],
fillvalue: Any = ...) -> Iterator[Any]: ...
def izip(
iter1: Iterable[Any],
iter2: Iterable[Any],
iter3: Iterable[Any],
iter4: Iterable[Any],
iter5: Iterable[Any],
iter6: Iterable[Any],
iter7: Iterable[Any],
*iterables: Iterable[Any],
) -> Iterator[Tuple[Any, ...]]: ...
def izip_longest(*p: Iterable[Any], fillvalue: Any = ...) -> Iterator[Any]: ...
@overload
def product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
@overload
def product(iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
def product(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ...
@overload
def product(iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
def product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ...
@overload
def product(iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ...
def product(
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4]
) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ...
@overload
def product(iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
def product(
iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5]
) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
@overload
def product(iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5],
iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
def product(
iter1: Iterable[_T1],
iter2: Iterable[_T2],
iter3: Iterable[_T3],
iter4: Iterable[_T4],
iter5: Iterable[_T5],
iter6: Iterable[_T6],
) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
@overload
def product(iter1: Iterable[Any],
iter2: Iterable[Any],
iter3: Iterable[Any],
iter4: Iterable[Any],
iter5: Iterable[Any],
iter6: Iterable[Any],
iter7: Iterable[Any],
*iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ...
def product(
iter1: Iterable[Any],
iter2: Iterable[Any],
iter3: Iterable[Any],
iter4: Iterable[Any],
iter5: Iterable[Any],
iter6: Iterable[Any],
iter7: Iterable[Any],
*iterables: Iterable[Any],
) -> Iterator[Tuple[Any, ...]]: ...
@overload
def product(*iterables: Iterable[Any], repeat: int) -> Iterator[Tuple[Any, ...]]: ...
def permutations(iterable: Iterable[_T],
r: int = ...) -> Iterator[Sequence[_T]]: ...
def combinations(iterable: Iterable[_T],
r: int) -> Iterator[Sequence[_T]]: ...
def combinations_with_replacement(iterable: Iterable[_T],
r: int) -> Iterator[Sequence[_T]]: ...
def permutations(iterable: Iterable[_T], r: int = ...) -> Iterator[Sequence[_T]]: ...
def combinations(iterable: Iterable[_T], r: int) -> Iterator[Sequence[_T]]: ...
def combinations_with_replacement(iterable: Iterable[_T], r: int) -> Iterator[Sequence[_T]]: ...
+75 -69
View File
@@ -1,4 +1,5 @@
from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Type
from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type, Union
from _typeshed import SupportsRead
class JSONDecodeError(ValueError):
@@ -7,62 +8,69 @@ class JSONDecodeError(ValueError):
def loads(self, s: str) -> Any: ...
def load(self, fp: IO[str]) -> Any: ...
def dumps(obj: Any,
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Optional[Type[JSONEncoder]] = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
encoding: str = ...,
default: Optional[Callable[[Any], Any]] = ...,
sort_keys: bool = ...,
**kwds: Any) -> str: ...
def dump(obj: Any,
fp: Union[IO[str], IO[Text]],
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Optional[Type[JSONEncoder]] = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
encoding: str = ...,
default: Optional[Callable[[Any], Any]] = ...,
sort_keys: bool = ...,
**kwds: Any) -> None: ...
def loads(s: Union[Text, bytes],
encoding: Any = ...,
cls: Optional[Type[JSONDecoder]] = ...,
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]] = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
**kwds: Any) -> Any: ...
def load(fp: SupportsRead[Union[Text, bytes]],
encoding: Optional[str] = ...,
cls: Optional[Type[JSONDecoder]] = ...,
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]] = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
**kwds: Any) -> Any: ...
def dumps(
obj: Any,
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Optional[Type[JSONEncoder]] = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
encoding: str = ...,
default: Optional[Callable[[Any], Any]] = ...,
sort_keys: bool = ...,
**kwds: Any,
) -> str: ...
def dump(
obj: Any,
fp: Union[IO[str], IO[Text]],
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Optional[Type[JSONEncoder]] = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
encoding: str = ...,
default: Optional[Callable[[Any], Any]] = ...,
sort_keys: bool = ...,
**kwds: Any,
) -> None: ...
def loads(
s: Union[Text, bytes],
encoding: Any = ...,
cls: Optional[Type[JSONDecoder]] = ...,
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]] = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
**kwds: Any,
) -> Any: ...
def load(
fp: SupportsRead[Union[Text, bytes]],
encoding: Optional[str] = ...,
cls: Optional[Type[JSONDecoder]] = ...,
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]] = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
**kwds: Any,
) -> Any: ...
class JSONDecoder(object):
def __init__(self,
encoding: Union[Text, bytes] = ...,
object_hook: Callable[..., Any] = ...,
parse_float: Callable[[str], float] = ...,
parse_int: Callable[[str], int] = ...,
parse_constant: Callable[[str], Any] = ...,
strict: bool = ...,
object_pairs_hook: Callable[..., Any] = ...) -> None: ...
def __init__(
self,
encoding: Union[Text, bytes] = ...,
object_hook: Callable[..., Any] = ...,
parse_float: Callable[[str], float] = ...,
parse_int: Callable[[str], int] = ...,
parse_constant: Callable[[str], Any] = ...,
strict: bool = ...,
object_pairs_hook: Callable[..., Any] = ...,
) -> None: ...
def decode(self, s: Union[Text, bytes], _w: Any = ...) -> Any: ...
def raw_decode(self, s: Union[Text, bytes], idx: int = ...) -> Tuple[Any, Any]: ...
@@ -75,20 +83,18 @@ class JSONEncoder(object):
allow_nan: bool
sort_keys: bool
indent: Optional[int]
def __init__(self,
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
sort_keys: bool = ...,
indent: Optional[int] = ...,
separators: Tuple[Union[Text, bytes], Union[Text, bytes]] = ...,
encoding: Union[Text, bytes] = ...,
default: Callable[..., Any] = ...) -> None: ...
def __init__(
self,
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
sort_keys: bool = ...,
indent: Optional[int] = ...,
separators: Tuple[Union[Text, bytes], Union[Text, bytes]] = ...,
encoding: Union[Text, bytes] = ...,
default: Callable[..., Any] = ...,
) -> None: ...
def default(self, o: Any) -> Any: ...
def encode(self, o: Any) -> str: ...
def iterencode(self, o: Any, _one_shot: bool = ...) -> str: ...
-1
View File
@@ -5,5 +5,4 @@ class ParserBase(object):
def error(self, message: str) -> None: ...
def reset(self) -> None: ...
def getpos(self) -> Tuple[int, int]: ...
def unknown_decl(self, data: str) -> None: ...
+1 -1
View File
@@ -1,6 +1,6 @@
# Stubs for Python 2.7 md5 stdlib module
from hashlib import md5 as md5, md5 as new
from hashlib import md5 as new
blocksize: int
digest_size: int
+1 -1
View File
@@ -1,5 +1,5 @@
from typing import Any
import rfc822
from typing import Any
class Message(rfc822.Message):
encodingheader: Any
+9 -9
View File
@@ -1,16 +1,15 @@
from typing import Any, Callable, Optional, TypeVar, Iterable
from multiprocessing import pool
from multiprocessing.process import Process as Process, current_process as current_process, active_children as active_children
from multiprocessing.process import Process as Process, active_children as active_children, current_process as current_process
from multiprocessing.util import SUBDEBUG as SUBDEBUG, SUBWARNING as SUBWARNING
from Queue import Queue as _BaseQueue
from typing import Any, Callable, Iterable, Optional, TypeVar
class ProcessError(Exception): ...
class BufferTooShort(ProcessError): ...
class TimeoutError(ProcessError): ...
class AuthenticationError(ProcessError): ...
_T = TypeVar('_T')
_T = TypeVar("_T")
class Queue(_BaseQueue[_T]):
def __init__(self, maxsize: int = ...) -> None: ...
@@ -43,8 +42,9 @@ def RawValue(typecode_or_type, *args): ...
def RawArray(typecode_or_type, size_or_initializer): ...
def Value(typecode_or_type, *args, **kwds): ...
def Array(typecode_or_type, size_or_initializer, **kwds): ...
def Pool(processes: Optional[int] = ...,
initializer: Optional[Callable[..., Any]] = ...,
initargs: Iterable[Any] = ...,
maxtasksperchild: Optional[int] = ...) -> pool.Pool: ...
def Pool(
processes: Optional[int] = ...,
initializer: Optional[Callable[..., Any]] = ...,
initargs: Iterable[Any] = ...,
maxtasksperchild: Optional[int] = ...,
) -> pool.Pool: ...
+5 -10
View File
@@ -1,17 +1,13 @@
from typing import Any, Optional, List, Type
import threading
import sys
import weakref
import array
import itertools
import sys
import threading
import weakref
from multiprocessing import TimeoutError, cpu_count
from multiprocessing.dummy.connection import Pipe
from threading import Lock, RLock, Semaphore, BoundedSemaphore
from threading import Event
from Queue import Queue
from threading import BoundedSemaphore, Event, Lock, RLock, Semaphore
from typing import Any, List, Optional, Type
class DummyProcess(threading.Thread):
_children: weakref.WeakKeyDictionary[Any, Any]
@@ -22,7 +18,6 @@ class DummyProcess(threading.Thread):
@property
def exitcode(self) -> Optional[int]: ...
Process = DummyProcess
# This should be threading._Condition but threading.pyi exports it as Condition
@@ -21,6 +21,5 @@ class Listener(object):
def accept(self) -> Connection: ...
def close(self) -> None: ...
def Client(address) -> Connection: ...
def Pipe(duplex=...) -> Tuple[Connection, Connection]: ...
+32 -34
View File
@@ -1,8 +1,8 @@
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, TypeVar
_T = TypeVar('_T', bound=Pool)
_T = TypeVar("_T", bound=Pool)
class AsyncResult():
class AsyncResult:
def get(self, timeout: Optional[float] = ...) -> Any: ...
def wait(self, timeout: Optional[float] = ...) -> None: ...
def ready(self) -> bool: ...
@@ -15,40 +15,38 @@ class IMapIterator(Iterator[Any]):
class IMapUnorderedIterator(IMapIterator): ...
class Pool(object):
def __init__(self, processes: Optional[int] = ...,
initializer: Optional[Callable[..., None]] = ...,
initargs: Iterable[Any] = ...,
maxtasksperchild: Optional[int] = ...) -> None: ...
def apply(self,
func: Callable[..., Any],
args: Iterable[Any] = ...,
kwds: Dict[str, Any] = ...) -> Any: ...
def apply_async(self,
func: Callable[..., Any],
args: Iterable[Any] = ...,
kwds: Dict[str, Any] = ...,
callback: Optional[Callable[..., None]] = ...) -> AsyncResult: ...
def map(self,
func: Callable[..., Any],
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = ...) -> List[Any]: ...
def map_async(self, func: Callable[..., Any],
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = ...,
callback: Optional[Callable[..., None]] = ...) -> AsyncResult: ...
def imap(self,
func: Callable[..., Any],
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = ...) -> IMapIterator: ...
def imap_unordered(self,
func: Callable[..., Any],
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = ...) -> IMapIterator: ...
def __init__(
self,
processes: Optional[int] = ...,
initializer: Optional[Callable[..., None]] = ...,
initargs: Iterable[Any] = ...,
maxtasksperchild: Optional[int] = ...,
) -> None: ...
def apply(self, func: Callable[..., Any], args: Iterable[Any] = ..., kwds: Dict[str, Any] = ...) -> Any: ...
def apply_async(
self,
func: Callable[..., Any],
args: Iterable[Any] = ...,
kwds: Dict[str, Any] = ...,
callback: Optional[Callable[..., None]] = ...,
) -> AsyncResult: ...
def map(self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: Optional[int] = ...) -> List[Any]: ...
def map_async(
self,
func: Callable[..., Any],
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = ...,
callback: Optional[Callable[..., None]] = ...,
) -> AsyncResult: ...
def imap(self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: Optional[int] = ...) -> IMapIterator: ...
def imap_unordered(
self, func: Callable[..., Any], iterable: Iterable[Any] = ..., chunksize: Optional[int] = ...
) -> IMapIterator: ...
def close(self) -> None: ...
def terminate(self) -> None: ...
def join(self) -> None: ...
class ThreadPool(Pool):
def __init__(self, processes: Optional[int] = ...,
initializer: Optional[Callable[..., Any]] = ...,
initargs: Iterable[Any] = ...) -> None: ...
def __init__(
self, processes: Optional[int] = ..., initializer: Optional[Callable[..., Any]] = ..., initargs: Iterable[Any] = ...
) -> None: ...
+3 -2
View File
@@ -4,8 +4,9 @@ def current_process(): ...
def active_children(): ...
class Process:
def __init__(self, group: Optional[Any] = ..., target: Optional[Any] = ..., name: Optional[Any] = ..., args=...,
kwargs=...): ...
def __init__(
self, group: Optional[Any] = ..., target: Optional[Any] = ..., name: Optional[Any] = ..., args=..., kwargs=...
): ...
def run(self): ...
def start(self): ...
def terminate(self): ...
+1 -1
View File
@@ -1,5 +1,5 @@
from typing import Any, Optional
import threading
from typing import Any, Optional
SUBDEBUG: Any
SUBWARNING: Any
+1 -1
View File
@@ -2,7 +2,7 @@
from typing import Any, Callable, Deque, TypeVar
_ArgType = TypeVar('_ArgType')
_ArgType = TypeVar("_ArgType")
class mutex:
locked: bool
+66 -41
View File
@@ -1,12 +1,32 @@
import sys
from builtins import OSError as error
from io import TextIOWrapper as _TextIOWrapper
from posix import listdir as listdir, stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
import sys
from typing import (
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr,
Optional, Generic, Set, Callable, Text, Sequence, IO, NamedTuple, NoReturn, TypeVar
IO,
Any,
AnyStr,
Callable,
Dict,
Generic,
Iterator,
List,
Mapping,
MutableMapping,
NamedTuple,
NoReturn,
Optional,
Sequence,
Set,
Text,
Tuple,
TypeVar,
Union,
overload,
)
from _typeshed import AnyPath
from . import path as path
# We need to use something from path, or flake8 and pytype get unhappy
@@ -39,32 +59,32 @@ O_TRUNC: int
# We don't use sys.platform for O_* flags to denote platform-dependent APIs because some codes,
# including tests for mypy, use a more finer way than sys.platform before using these APIs
# See https://github.com/python/typeshed/pull/2286 for discussions
O_DSYNC: int # Unix only
O_RSYNC: int # Unix only
O_SYNC: int # Unix only
O_NDELAY: int # Unix only
O_DSYNC: int # Unix only
O_RSYNC: int # Unix only
O_SYNC: int # Unix only
O_NDELAY: int # Unix only
O_NONBLOCK: int # Unix only
O_NOCTTY: int # Unix only
O_SHLOCK: int # Unix only
O_EXLOCK: int # Unix only
O_BINARY: int # Windows only
O_NOCTTY: int # Unix only
O_SHLOCK: int # Unix only
O_EXLOCK: int # Unix only
O_BINARY: int # Windows only
O_NOINHERIT: int # Windows only
O_SHORT_LIVED: int # Windows only
O_TEMPORARY: int # Windows only
O_RANDOM: int # Windows only
O_RANDOM: int # Windows only
O_SEQUENTIAL: int # Windows only
O_TEXT: int # Windows only
O_ASYNC: int # Gnu extension if in C library
O_DIRECT: int # Gnu extension if in C library
O_TEXT: int # Windows only
O_ASYNC: int # Gnu extension if in C library
O_DIRECT: int # Gnu extension if in C library
O_DIRECTORY: int # Gnu extension if in C library
O_NOFOLLOW: int # Gnu extension if in C library
O_NOATIME: int # Gnu extension if in C library
O_NOFOLLOW: int # Gnu extension if in C library
O_NOATIME: int # Gnu extension if in C library
O_LARGEFILE: int # Gnu extension if in C library
curdir: str
pardir: str
sep: str
if sys.platform == 'win32':
if sys.platform == "win32":
altsep: str
else:
altsep: Optional[str]
@@ -92,7 +112,7 @@ environ: _Environ[str]
if sys.version_info >= (3, 2):
environb: _Environ[bytes]
if sys.platform != 'win32':
if sys.platform != "win32":
# Unix only
confstr_names: Dict[str, int]
pathconf_names: Dict[str, int]
@@ -119,12 +139,12 @@ if sys.platform != 'win32':
P_NOWAIT: int
P_NOWAITO: int
P_WAIT: int
if sys.platform == 'win32':
if sys.platform == "win32":
P_DETACH: int
P_OVERLAY: int
# wait()/waitpid() options
if sys.platform != 'win32':
if sys.platform != "win32":
WNOHANG: int # Unix only
WCONTINUED: int # some Unix systems
WUNTRACED: int # Unix only
@@ -153,7 +173,7 @@ def getppid() -> int: ...
def strerror(code: int) -> str: ...
def umask(mask: int) -> int: ...
if sys.platform != 'win32':
if sys.platform != "win32":
def ctermid() -> str: ...
def getegid() -> int: ...
def geteuid() -> int: ...
@@ -186,7 +206,6 @@ def getenv(key: Text) -> Optional[str]: ...
def getenv(key: Text, default: _T) -> Union[str, _T]: ...
def putenv(key: Union[bytes, Text], value: Union[bytes, Text]) -> None: ...
def unsetenv(key: Union[bytes, Text]) -> None: ...
def fdopen(fd: int, *args, **kwargs) -> IO[Any]: ...
def close(fd: int) -> None: ...
def closerange(fd_low: int, fd_high: int) -> None: ...
@@ -226,17 +245,19 @@ def stat_float_times() -> bool: ...
def stat_float_times(newvalue: bool) -> None: ...
def symlink(source: AnyPath, link_name: AnyPath) -> None: ...
def unlink(path: AnyPath) -> None: ...
# TODO: add ns, dir_fd, follow_symlinks argument
if sys.version_info >= (3, 0):
def utime(path: AnyPath, times: Optional[Tuple[float, float]] = ...) -> None: ...
else:
def utime(path: AnyPath, times: Optional[Tuple[float, float]]) -> None: ...
if sys.platform != 'win32':
if sys.platform != "win32":
# Unix only
def fchmod(fd: int, mode: int) -> None: ...
def fchown(fd: int, uid: int, gid: int) -> None: ...
if sys.platform != 'darwin':
if sys.platform != "darwin":
def fdatasync(fd: int) -> None: ... # Unix only, not Mac
def fpathconf(fd: int, name: Union[str, int]) -> int: ...
def fstatvfs(fd: int) -> _StatVFS: ...
@@ -257,16 +278,20 @@ if sys.platform != 'win32':
def statvfs(path: AnyPath) -> _StatVFS: ...
if sys.version_info >= (3, 6):
def walk(top: Union[AnyStr, PathLike[AnyStr]], topdown: bool = ...,
onerror: Optional[Callable[[OSError], Any]] = ...,
followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
List[AnyStr]]]: ...
def walk(
top: Union[AnyStr, PathLike[AnyStr]],
topdown: bool = ...,
onerror: Optional[Callable[[OSError], Any]] = ...,
followlinks: bool = ...,
) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ...
else:
def walk(top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ...,
followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
List[AnyStr]]]: ...
def walk(
top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ..., followlinks: bool = ...
) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr]]]: ...
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: ...
@@ -278,15 +303,15 @@ def execlpe(file: AnyPath, __arg0: Union[bytes, Text], *args: Any) -> NoReturn:
# The docs say `args: tuple or list of strings`
# The implementation enforces tuple or list so we can't use Sequence.
_ExecVArgs = Union[Tuple[Union[bytes, Text], ...], List[bytes], List[Text], List[Union[bytes, Text]]]
def execv(path: AnyPath, args: _ExecVArgs) -> NoReturn: ...
def execve(path: AnyPath, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
def execvp(file: AnyPath, args: _ExecVArgs) -> NoReturn: ...
def execvpe(file: AnyPath, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
def _exit(n: int) -> NoReturn: ...
def kill(pid: int, sig: int) -> None: ...
if sys.platform != 'win32':
if sys.platform != "win32":
# Unix only
def fork() -> int: ...
def forkpty() -> Tuple[int, int]: ... # some flavors of Unix
@@ -297,9 +322,9 @@ if sys.platform != 'win32':
if sys.version_info >= (3, 0):
class popen(_TextIOWrapper):
# TODO 'b' modes or bytes command not accepted?
def __init__(self, command: str, mode: str = ...,
bufsize: int = ...) -> None: ...
def __init__(self, command: str, mode: str = ..., bufsize: int = ...) -> None: ...
def close(self) -> Any: ... # may return int
else:
def popen(command: str, *args, **kwargs) -> IO[Any]: ...
def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
@@ -307,18 +332,17 @@ else:
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 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 spawnve(mode: int, path: AnyPath, args: List[Union[bytes, Text]], env: Mapping[str, str]) -> int: ...
def system(command: AnyPath) -> int: ...
def times() -> Tuple[float, float, float, float, float]: ...
def waitpid(pid: int, options: int) -> Tuple[int, int]: ...
def urandom(n: int) -> bytes: ...
if sys.platform == 'win32':
if sys.platform == "win32":
def startfile(path: AnyPath, operation: Optional[str] = ...) -> None: ...
else:
# Unix only
def spawnlp(mode: int, file: AnyPath, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
@@ -342,6 +366,7 @@ else:
if sys.version_info >= (3, 0):
def sched_getaffinity(id: int) -> Set[int]: ...
if sys.version_info >= (3, 3):
class waitresult:
si_pid: int
+12 -10
View File
@@ -1,11 +1,12 @@
# NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent!
import os
import sys
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Text, Callable, Optional
from genericpath import exists as exists
from _typeshed import StrPath, BytesPath, AnyPath
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload
_T = TypeVar('_T')
from _typeshed import AnyPath, BytesPath, StrPath
_T = TypeVar("_T")
if sys.version_info >= (3, 6):
from builtins import _PathLike
@@ -16,7 +17,7 @@ supports_unicode_filenames: bool
curdir: str
pardir: str
sep: str
if sys.platform == 'win32':
if sys.platform == "win32":
altsep: str
else:
altsep: Optional[str]
@@ -56,7 +57,7 @@ if sys.version_info >= (3, 6):
def normpath(path: _PathLike[AnyStr]) -> AnyStr: ...
@overload
def normpath(path: AnyStr) -> AnyStr: ...
if sys.platform == 'win32':
if sys.platform == "win32":
@overload
def realpath(path: _PathLike[AnyStr]) -> AnyStr: ...
@overload
@@ -75,7 +76,7 @@ else:
def expandvars(path: AnyStr) -> AnyStr: ...
def normcase(s: AnyStr) -> AnyStr: ...
def normpath(path: AnyStr) -> AnyStr: ...
if sys.platform == 'win32':
if sys.platform == "win32":
def realpath(path: AnyStr) -> AnyStr: ...
else:
def realpath(filename: AnyStr) -> AnyStr: ...
@@ -84,6 +85,7 @@ if sys.version_info >= (3, 6):
# In reality it returns str for sequences of StrPath and bytes for sequences
# of BytesPath, but mypy does not accept such a signature.
def commonpath(paths: Sequence[AnyPath]) -> Any: ...
elif sys.version_info >= (3, 5):
def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ...
@@ -91,7 +93,6 @@ elif sys.version_info >= (3, 5):
# 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: ...
# These return float if os.stat_float_times() == True,
@@ -99,7 +100,6 @@ def lexists(path: AnyPath) -> bool: ...
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: ...
@@ -122,11 +122,13 @@ if sys.version_info < (3, 0):
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
@overload
def join(__p1: Text, *p: AnyPath) -> Text: ...
elif sys.version_info >= (3, 6):
@overload
def join(a: StrPath, *paths: StrPath) -> Text: ...
@overload
def join(a: BytesPath, *paths: BytesPath) -> bytes: ...
else:
def join(a: AnyStr, *paths: AnyStr) -> AnyStr: ...
@@ -134,7 +136,6 @@ else:
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
@overload
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
@@ -152,12 +153,13 @@ if sys.version_info >= (3, 6):
def splitext(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
@overload
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
else:
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
if sys.version_info < (3, 7) and sys.platform == 'win32':
if sys.version_info < (3, 7) and sys.platform == "win32":
def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3,):
+12 -10
View File
@@ -1,11 +1,12 @@
# NB: path.pyi and stdlib/2 and stdlib/3 must remain consistent!
import os
import sys
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Text, Callable, Optional
from genericpath import exists as exists
from _typeshed import StrPath, BytesPath, AnyPath
from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload
_T = TypeVar('_T')
from _typeshed import AnyPath, BytesPath, StrPath
_T = TypeVar("_T")
if sys.version_info >= (3, 6):
from builtins import _PathLike
@@ -16,7 +17,7 @@ supports_unicode_filenames: bool
curdir: str
pardir: str
sep: str
if sys.platform == 'win32':
if sys.platform == "win32":
altsep: str
else:
altsep: Optional[str]
@@ -56,7 +57,7 @@ if sys.version_info >= (3, 6):
def normpath(path: _PathLike[AnyStr]) -> AnyStr: ...
@overload
def normpath(path: AnyStr) -> AnyStr: ...
if sys.platform == 'win32':
if sys.platform == "win32":
@overload
def realpath(path: _PathLike[AnyStr]) -> AnyStr: ...
@overload
@@ -75,7 +76,7 @@ else:
def expandvars(path: AnyStr) -> AnyStr: ...
def normcase(s: AnyStr) -> AnyStr: ...
def normpath(path: AnyStr) -> AnyStr: ...
if sys.platform == 'win32':
if sys.platform == "win32":
def realpath(path: AnyStr) -> AnyStr: ...
else:
def realpath(filename: AnyStr) -> AnyStr: ...
@@ -84,6 +85,7 @@ if sys.version_info >= (3, 6):
# In reality it returns str for sequences of StrPath and bytes for sequences
# of BytesPath, but mypy does not accept such a signature.
def commonpath(paths: Sequence[AnyPath]) -> Any: ...
elif sys.version_info >= (3, 5):
def commonpath(paths: Sequence[AnyStr]) -> AnyStr: ...
@@ -91,7 +93,6 @@ elif sys.version_info >= (3, 5):
# 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: ...
# These return float if os.stat_float_times() == True,
@@ -99,7 +100,6 @@ def lexists(path: AnyPath) -> bool: ...
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: ...
@@ -122,11 +122,13 @@ if sys.version_info < (3, 0):
def join(__p1: bytes, __p2: Text, *p: AnyPath) -> Text: ...
@overload
def join(__p1: Text, *p: AnyPath) -> Text: ...
elif sys.version_info >= (3, 6):
@overload
def join(a: StrPath, *paths: StrPath) -> Text: ...
@overload
def join(a: BytesPath, *paths: BytesPath) -> bytes: ...
else:
def join(a: AnyStr, *paths: AnyStr) -> AnyStr: ...
@@ -134,7 +136,6 @@ else:
def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ...
@overload
def relpath(path: StrPath, start: Optional[StrPath] = ...) -> Text: ...
def samefile(f1: AnyPath, f2: AnyPath) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
@@ -152,12 +153,13 @@ if sys.version_info >= (3, 6):
def splitext(p: _PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ...
@overload
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
else:
def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
if sys.version_info < (3, 7) and sys.platform == 'win32':
if sys.version_info < (3, 7) and sys.platform == "win32":
def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3,):
+1 -1
View File
@@ -1,4 +1,4 @@
from typing import Any, IO, AnyStr
from typing import IO, Any, AnyStr
class Template:
def __init__(self) -> None: ...
+2 -3
View File
@@ -1,7 +1,6 @@
from typing import Any, Iterable, List, Optional, Union, TextIO, Tuple, TypeVar
_T = TypeVar('_T')
from typing import Any, Iterable, List, Optional, TextIO, Tuple, TypeVar, Union
_T = TypeVar("_T")
class Popen3:
sts: int
+3 -1
View File
@@ -1,4 +1,4 @@
from typing import AnyStr, Dict, IO, List, Mapping, NamedTuple, Optional, Sequence, Tuple, TypeVar, Union
from typing import IO, AnyStr, Dict, List, Mapping, NamedTuple, Optional, Sequence, Tuple, TypeVar, Union
error = OSError
@@ -191,7 +191,9 @@ def unsetenv(varname: str) -> None: ...
def urandom(n: int) -> str: ...
def utime(path: unicode, times: Optional[Tuple[int, int]]) -> None: ...
def wait() -> int: ...
_r = Tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int]
def wait3(options: int) -> Tuple[int, int, _r]: ...
def wait4(pid: int, options: int) -> Tuple[int, int, _r]: ...
def waitpid(pid: int, options: int) -> int: ...
+3 -5
View File
@@ -10,7 +10,7 @@ import _random
from typing import AbstractSet, Any, Callable, Iterator, List, MutableSequence, Protocol, Sequence, TypeVar, Union, overload
_T = TypeVar("_T")
_T_co = TypeVar('_T_co', covariant=True)
_T_co = TypeVar("_T_co", covariant=True)
class _Sampleable(Protocol[_T_co]):
def __iter__(self) -> Iterator[_T_co]: ...
@@ -45,8 +45,7 @@ class Random(_random.Random):
def weibullvariate(self, alpha: float, beta: float) -> float: ...
# SystemRandom is not implemented for all OS's; good on Windows & Linux
class SystemRandom(Random):
...
class SystemRandom(Random): ...
# ----- random function stubs -----
def seed(x: object = ...) -> None: ...
@@ -64,8 +63,7 @@ def shuffle(x: MutableSequence[Any], random: Callable[[], float] = ...) -> None:
def sample(population: _Sampleable[_T], k: int) -> List[_T]: ...
def random() -> float: ...
def uniform(a: float, b: float) -> float: ...
def triangular(low: float = ..., high: float = ...,
mode: float = ...) -> float: ...
def triangular(low: float = ..., high: float = ..., mode: float = ...) -> float: ...
def betavariate(alpha: float, beta: float) -> float: ...
def expovariate(lambd: float) -> float: ...
def gammavariate(alpha: float, beta: float) -> float: ...
+50 -36
View File
@@ -5,8 +5,20 @@
# based on: http: //docs.python.org/2.7/library/re.html
from typing import (
List, Iterator, overload, Callable, Tuple, Sequence, Dict,
Generic, AnyStr, Match, Pattern, Any, Optional, Union
Any,
AnyStr,
Callable,
Dict,
Generic,
Iterator,
List,
Match,
Optional,
Pattern,
Sequence,
Tuple,
Union,
overload,
)
# ----- re variables and constants -----
@@ -32,24 +44,20 @@ class error(Exception): ...
def compile(pattern: AnyStr, flags: int = ...) -> Pattern[AnyStr]: ...
@overload
def compile(pattern: Pattern[AnyStr], flags: int = ...) -> Pattern[AnyStr]: ...
@overload
def search(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
@overload
def search(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
@overload
def match(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
@overload
def match(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Optional[Match[AnyStr]]: ...
@overload
def split(pattern: Union[str, unicode], string: AnyStr,
maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ...
def split(pattern: Union[str, unicode], string: AnyStr, maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ...
@overload
def split(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr,
maxsplit: int = ..., flags: int = ...) -> List[AnyStr]: ...
def split(
pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, maxsplit: int = ..., flags: int = ...
) -> List[AnyStr]: ...
@overload
def findall(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> List[Any]: ...
@overload
@@ -60,41 +68,47 @@ def findall(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flag
# matches are returned in the order found. Empty matches are included in the
# result unless they touch the beginning of another match.
@overload
def finditer(pattern: Union[str, unicode], string: AnyStr,
flags: int = ...) -> Iterator[Match[AnyStr]]: ...
def finditer(pattern: Union[str, unicode], string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ...
@overload
def finditer(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr,
flags: int = ...) -> Iterator[Match[AnyStr]]: ...
def finditer(pattern: Union[Pattern[str], Pattern[unicode]], string: AnyStr, flags: int = ...) -> Iterator[Match[AnyStr]]: ...
@overload
def sub(pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ...,
flags: int = ...) -> AnyStr: ...
def sub(pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ...
@overload
def sub(pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr],
string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ...
def sub(
pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ...
) -> AnyStr: ...
@overload
def sub(pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ...,
flags: int = ...) -> AnyStr: ...
def sub(
pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
) -> AnyStr: ...
@overload
def sub(pattern: Union[Pattern[str], Pattern[unicode]], repl: Callable[[Match[AnyStr]], AnyStr],
string: AnyStr, count: int = ..., flags: int = ...) -> AnyStr: ...
def sub(
pattern: Union[Pattern[str], Pattern[unicode]],
repl: Callable[[Match[AnyStr]], AnyStr],
string: AnyStr,
count: int = ...,
flags: int = ...,
) -> AnyStr: ...
@overload
def subn(pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ...,
flags: int = ...) -> Tuple[AnyStr, int]: ...
def subn(
pattern: Union[str, unicode], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
) -> Tuple[AnyStr, int]: ...
@overload
def subn(pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr],
string: AnyStr, count: int = ...,
flags: int = ...) -> Tuple[AnyStr, int]: ...
def subn(
pattern: Union[str, unicode], repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int = ..., flags: int = ...
) -> Tuple[AnyStr, int]: ...
@overload
def subn(pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ...,
flags: int = ...) -> Tuple[AnyStr, int]: ...
def subn(
pattern: Union[Pattern[str], Pattern[unicode]], repl: AnyStr, string: AnyStr, count: int = ..., flags: int = ...
) -> Tuple[AnyStr, int]: ...
@overload
def subn(pattern: Union[Pattern[str], Pattern[unicode]], repl: Callable[[Match[AnyStr]], AnyStr],
string: AnyStr, count: int = ...,
flags: int = ...) -> Tuple[AnyStr, int]: ...
def subn(
pattern: Union[Pattern[str], Pattern[unicode]],
repl: Callable[[Match[AnyStr]], AnyStr],
string: AnyStr,
count: int = ...,
flags: int = ...,
) -> Tuple[AnyStr, int]: ...
def escape(string: AnyStr) -> AnyStr: ...
def purge() -> None: ...
def template(pattern: Union[AnyStr, Pattern[AnyStr]], flags: int = ...) -> Pattern[AnyStr]: ...
+1
View File
@@ -30,4 +30,5 @@ class Repr:
def _possibly_sorted(x) -> List[Any]: ...
aRepr: Repr
def repr(x) -> str: ...
+2 -1
View File
@@ -1,8 +1,9 @@
from typing import Tuple, NamedTuple
from typing import NamedTuple, Tuple
class error(Exception): ...
RLIM_INFINITY: int
def getrlimit(resource: int) -> Tuple[int, int]: ...
def setrlimit(resource: int, limits: Tuple[int, int]) -> None: ...
+2 -2
View File
@@ -1,9 +1,9 @@
# Stubs for sets (Python 2)
from typing import Any, Callable, Hashable, Iterable, Iterator, MutableMapping, Optional, TypeVar, Union
_T = TypeVar('_T')
_T = TypeVar("_T")
_Setlike = Union[BaseSet[_T], Iterable[_T]]
_SelfT = TypeVar('_SelfT')
_SelfT = TypeVar("_SelfT")
class BaseSet(Iterable[_T]):
def __init__(self) -> None: ...
+1
View File
@@ -7,5 +7,6 @@ class sha(object):
def copy(self) -> sha: ...
def new(string: str = ...) -> sha: ...
blocksize: int
digest_size: int
+7 -4
View File
@@ -1,9 +1,10 @@
from typing import Any, Dict, Iterator, List, Optional, Tuple
import collections
from typing import Any, Dict, Iterator, List, Optional, Tuple
class Shelf(collections.MutableMapping[Any, Any]):
def __init__(self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ...
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]: ...
def __len__(self) -> int: ...
@@ -20,7 +21,9 @@ class Shelf(collections.MutableMapping[Any, Any]):
def sync(self) -> None: ...
class BsdDbShelf(Shelf):
def __init__(self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ...
def __init__(
self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...
) -> None: ...
def set_location(self, key: Any) -> Tuple[str, Any]: ...
def next(self) -> Tuple[str, Any]: ...
def previous(self) -> Tuple[str, Any]: ...
+2 -3
View File
@@ -1,8 +1,8 @@
from typing import Any, IO, List, Optional, TypeVar
from typing import IO, Any, List, Optional, TypeVar
def split(s: Optional[str], comments: bool = ..., posix: bool = ...) -> List[str]: ...
_SLT = TypeVar('_SLT', bound=shlex)
_SLT = TypeVar("_SLT", bound=shlex)
class shlex:
def __init__(self, instream: IO[Any] = ..., infile: IO[Any] = ..., posix: bool = ...) -> None: ...
@@ -15,7 +15,6 @@ class shlex:
def push_source(self, stream: IO[Any], filename: str = ...) -> None: ...
def pop_source(self) -> IO[Any]: ...
def error_leader(self, file: str = ..., line: int = ...) -> str: ...
commenters: str
wordchars: str
whitespace: str
+1 -1
View File
@@ -1,5 +1,5 @@
from typing import Callable, Any, Tuple, Union
from types import FrameType
from typing import Any, Callable, Tuple, Union
SIG_DFL: int = ...
SIG_IGN: int = ...
+2 -1
View File
@@ -72,7 +72,8 @@ CATEGORY_UNI_NOT_WORD: str
CATEGORY_UNI_LINEBREAK: str
CATEGORY_UNI_NOT_LINEBREAK: str
_T = TypeVar('_T')
_T = TypeVar("_T")
def makedict(list: List[_T]) -> Dict[_T, int]: ...
OP_IGNORE: Dict[str, str]
+2 -1
View File
@@ -23,7 +23,6 @@ class Pattern:
def closegroup(self, gid: int) -> None: ...
def checkgroup(self, gid: int) -> bool: ...
_OpSubpatternType = Tuple[Optional[int], int, int, SubPattern]
_OpGroupRefExistsType = Tuple[int, SubPattern, SubPattern]
_OpInType = List[Tuple[str, int]]
@@ -58,6 +57,8 @@ def isident(char: str) -> bool: ...
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[Any]) -> _Template: ...
def expand_template(template: _Template, match: Match[Any]) -> str: ...
-1
View File
@@ -5,7 +5,6 @@ def S_ISREG(mode: int) -> bool: ...
def S_ISFIFO(mode: int) -> bool: ...
def S_ISLNK(mode: int) -> bool: ...
def S_ISSOCK(mode: int) -> bool: ...
def S_IMODE(mode: int) -> int: ...
def S_IFMT(mode: int) -> int: ...
+5 -8
View File
@@ -2,7 +2,7 @@
# Based on http://docs.python.org/3.2/library/string.html
from typing import Any, AnyStr, Iterable, List, Mapping, Optional, overload, Sequence, Text, Tuple, Union
from typing import Any, AnyStr, Iterable, List, Mapping, Optional, Sequence, Text, Tuple, Union, overload
ascii_letters: str
ascii_lowercase: str
@@ -18,6 +18,7 @@ uppercase: str
whitespace: str
def capwords(s: AnyStr, sep: AnyStr = ...) -> AnyStr: ...
# TODO: originally named 'from'
def maketrans(_from: str, to: str) -> str: ...
def atof(s: unicode) -> float: ...
@@ -49,7 +50,6 @@ def replace(s: AnyStr, old: AnyStr, new: AnyStr, maxreplace: int = ...) -> AnySt
class Template:
template: Text
def __init__(self, template: Text) -> None: ...
@overload
def substitute(self, mapping: Union[Mapping[str, str], Mapping[unicode, str]] = ..., **kwds: str) -> str: ...
@@ -63,13 +63,10 @@ class Template:
# TODO(MichalPokorny): This is probably badly and/or loosely typed.
class Formatter(object):
def format(self, format_string: str, *args, **kwargs) -> str: ...
def vformat(self, format_string: str, args: Sequence[Any],
kwargs: Mapping[str, Any]) -> str: ...
def vformat(self, format_string: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> str: ...
def parse(self, format_string: str) -> Iterable[Tuple[str, str, str, str]]: ...
def get_field(self, field_name: str, args: Sequence[Any],
kwargs: Mapping[str, Any]) -> Any: ...
def get_field(self, field_name: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
def get_value(self, key: Union[int, str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any],
kwargs: Mapping[str, Any]) -> None: ...
def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ...
def format_field(self, value: Any, format_spec: str) -> Any: ...
def convert_field(self, value: Any, conversion: str) -> Any: ...
-1
View File
@@ -15,7 +15,6 @@ atoi_error = ValueError
atof_error = ValueError
atol_error = ValueError
def lower(s: AnyStr) -> AnyStr: ...
def upper(s: AnyStr) -> AnyStr: ...
def swapcase(s: AnyStr) -> AnyStr: ...
+67 -68
View File
@@ -2,9 +2,7 @@
# Based on http://docs.python.org/2/library/subprocess.html and Python 3 stub
from typing import (
Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional, List, Text, TypeVar, Generic,
)
from typing import IO, Any, Callable, Generic, List, Mapping, Optional, Sequence, Text, Tuple, TypeVar, Union
_FILE = Union[None, int, IO[Any]]
_TXT = Union[bytes, Text]
@@ -12,50 +10,55 @@ _CMD = Union[_TXT, Sequence[_TXT]]
_ENV = Union[Mapping[bytes, _TXT], Mapping[Text, _TXT]]
# Same args as Popen.__init__
def call(args: _CMD,
bufsize: int = ...,
executable: _TXT = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: _ENV = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...) -> int: ...
def check_call(args: _CMD,
bufsize: int = ...,
executable: _TXT = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: _ENV = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...) -> int: ...
def call(
args: _CMD,
bufsize: int = ...,
executable: _TXT = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: _ENV = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
) -> int: ...
def check_call(
args: _CMD,
bufsize: int = ...,
executable: _TXT = ...,
stdin: _FILE = ...,
stdout: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: _ENV = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
) -> int: ...
# Same args as Popen.__init__ except for stdout
def check_output(args: _CMD,
bufsize: int = ...,
executable: _TXT = ...,
stdin: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: _ENV = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...) -> bytes: ...
def check_output(
args: _CMD,
bufsize: int = ...,
executable: _TXT = ...,
stdin: _FILE = ...,
stderr: _FILE = ...,
preexec_fn: Callable[[], Any] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: _ENV = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
) -> bytes: ...
PIPE: int
STDOUT: int
@@ -66,14 +69,10 @@ class CalledProcessError(Exception):
cmd: Any
# morally: Optional[bytes]
output: bytes
def __init__(self,
returncode: int,
cmd: _CMD,
output: Optional[bytes] = ...) -> None: ...
def __init__(self, returncode: int, cmd: _CMD, output: Optional[bytes] = ...) -> None: ...
# We use a dummy type variable used to make Popen generic like it is in python 3
_T = TypeVar('_T', bound=bytes)
_T = TypeVar("_T", bound=bytes)
class Popen(Generic[_T]):
stdin: Optional[IO[bytes]]
@@ -81,23 +80,23 @@ class Popen(Generic[_T]):
stderr: Optional[IO[bytes]]
pid: int
returncode: int
def __new__(cls,
args: _CMD,
bufsize: int = ...,
executable: Optional[_TXT] = ...,
stdin: Optional[_FILE] = ...,
stdout: Optional[_FILE] = ...,
stderr: Optional[_FILE] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: Optional[_ENV] = ...,
universal_newlines: bool = ...,
startupinfo: Optional[Any] = ...,
creationflags: int = ...) -> Popen[bytes]: ...
def __new__(
cls,
args: _CMD,
bufsize: int = ...,
executable: Optional[_TXT] = ...,
stdin: Optional[_FILE] = ...,
stdout: Optional[_FILE] = ...,
stderr: Optional[_FILE] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: Optional[_ENV] = ...,
universal_newlines: bool = ...,
startupinfo: Optional[Any] = ...,
creationflags: int = ...,
) -> Popen[bytes]: ...
def poll(self) -> Optional[int]: ...
def wait(self) -> int: ...
# morally: -> Tuple[Optional[bytes], Optional[bytes]]
+2 -6
View File
@@ -1,10 +1,7 @@
"""Stubs for the 'sys' module."""
from typing import (
IO, NoReturn, Union, List, Sequence, Any, Dict, Tuple, BinaryIO, Optional,
Callable, overload, Text, Type,
)
from types import FrameType, ModuleType, TracebackType, ClassType
from types import ClassType, FrameType, ModuleType, TracebackType
from typing import IO, Any, BinaryIO, Callable, Dict, List, NoReturn, Optional, Sequence, Text, Tuple, Type, Union, overload
# The following type alias are stub-only and do not exist during runtime
_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
@@ -107,7 +104,6 @@ class _WindowsVersionType:
product_type: Any
def getwindowsversion() -> _WindowsVersionType: ...
def _clear_type_cache() -> None: ...
def _current_frames() -> Dict[int, FrameType]: ...
def _getframe(depth: int = ...) -> FrameType: ...
+12 -21
View File
@@ -1,6 +1,6 @@
from typing import Any, AnyStr, IO, Iterable, Iterator, List, Optional, overload, Text, Tuple, Union
from thread import LockType
from random import Random
from thread import LockType
from typing import IO, Any, AnyStr, Iterable, Iterator, List, Optional, Text, Tuple, Union, overload
TMP_MAX: int
tempdir: str
@@ -48,7 +48,6 @@ class _TemporaryFileWrapper(IO[str]):
def write(self, s: Text) -> int: ...
def writelines(self, lines: Iterable[str]) -> None: ...
# TODO text files
def TemporaryFile(
@@ -56,36 +55,30 @@ def TemporaryFile(
bufsize: int = ...,
suffix: Union[bytes, unicode] = ...,
prefix: Union[bytes, unicode] = ...,
dir: Union[bytes, unicode] = ...
) -> _TemporaryFileWrapper:
...
dir: Union[bytes, unicode] = ...,
) -> _TemporaryFileWrapper: ...
def NamedTemporaryFile(
mode: Union[bytes, unicode] = ...,
bufsize: int = ...,
suffix: Union[bytes, unicode] = ...,
prefix: Union[bytes, unicode] = ...,
dir: Union[bytes, unicode] = ...,
delete: bool = ...
) -> _TemporaryFileWrapper:
...
delete: bool = ...,
) -> _TemporaryFileWrapper: ...
def SpooledTemporaryFile(
max_size: int = ...,
mode: Union[bytes, unicode] = ...,
buffering: int = ...,
suffix: Union[bytes, unicode] = ...,
prefix: Union[bytes, unicode] = ...,
dir: Union[bytes, unicode] = ...
) -> _TemporaryFileWrapper:
...
dir: Union[bytes, unicode] = ...,
) -> _TemporaryFileWrapper: ...
class TemporaryDirectory:
name: Any
def __init__(self,
suffix: Union[bytes, unicode] = ...,
prefix: Union[bytes, unicode] = ...,
dir: Union[bytes, unicode] = ...) -> None: ...
def __init__(
self, suffix: Union[bytes, unicode] = ..., prefix: Union[bytes, unicode] = ..., dir: Union[bytes, unicode] = ...
) -> None: ...
def cleanup(self) -> None: ...
def __enter__(self) -> Any: ... # Can be str or unicode
def __exit__(self, type, value, traceback) -> None: ...
@@ -93,8 +86,7 @@ class TemporaryDirectory:
@overload
def mkstemp() -> Tuple[int, str]: ...
@overload
def mkstemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: Optional[AnyStr] = ...,
text: bool = ...) -> Tuple[int, AnyStr]: ...
def mkstemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: Optional[AnyStr] = ..., text: bool = ...) -> Tuple[int, AnyStr]: ...
@overload
def mkdtemp() -> str: ...
@overload
@@ -105,7 +97,6 @@ def mktemp() -> str: ...
def mktemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: Optional[AnyStr] = ...) -> AnyStr: ...
def gettempdir() -> str: ...
def gettempprefix() -> str: ...
def _candidate_tempdir_list() -> List[str]: ...
def _get_candidate_names() -> Optional[_RandomNameSequence]: ...
def _get_default_tempdir() -> str: ...
+36 -36
View File
@@ -1,4 +1,4 @@
from typing import AnyStr, List, Dict, Pattern
from typing import AnyStr, Dict, List, Pattern
class TextWrapper(object):
width: int = ...
@@ -19,43 +19,43 @@ class TextWrapper(object):
unicode_whitespace_trans: Dict[int, int] = ...
uspace: int = ...
x: int = ...
def __init__(
self,
width: int = ...,
initial_indent: str = ...,
subsequent_indent: str = ...,
expand_tabs: bool = ...,
replace_whitespace: bool = ...,
fix_sentence_endings: bool = ...,
break_long_words: bool = ...,
drop_whitespace: bool = ...,
break_on_hyphens: bool = ...) -> None:
...
self,
width: int = ...,
initial_indent: str = ...,
subsequent_indent: str = ...,
expand_tabs: bool = ...,
replace_whitespace: bool = ...,
fix_sentence_endings: bool = ...,
break_long_words: bool = ...,
drop_whitespace: bool = ...,
break_on_hyphens: bool = ...,
) -> None: ...
def wrap(self, text: AnyStr) -> List[AnyStr]: ...
def fill(self, text: AnyStr) -> AnyStr: ...
def wrap(text: AnyStr,
width: int = ...,
initial_indent: AnyStr = ...,
subsequent_indent: AnyStr = ...,
expand_tabs: bool = ...,
replace_whitespace: bool = ...,
fix_sentence_endings: bool = ...,
break_long_words: bool = ...,
drop_whitespace: bool = ...,
break_on_hyphens: bool = ...) -> List[AnyStr]: ...
def fill(text: AnyStr,
width: int = ...,
initial_indent: AnyStr = ...,
subsequent_indent: AnyStr = ...,
expand_tabs: bool = ...,
replace_whitespace: bool = ...,
fix_sentence_endings: bool = ...,
break_long_words: bool = ...,
drop_whitespace: bool = ...,
break_on_hyphens: bool = ...) -> AnyStr: ...
def wrap(
text: AnyStr,
width: int = ...,
initial_indent: AnyStr = ...,
subsequent_indent: AnyStr = ...,
expand_tabs: bool = ...,
replace_whitespace: bool = ...,
fix_sentence_endings: bool = ...,
break_long_words: bool = ...,
drop_whitespace: bool = ...,
break_on_hyphens: bool = ...,
) -> List[AnyStr]: ...
def fill(
text: AnyStr,
width: int = ...,
initial_indent: AnyStr = ...,
subsequent_indent: AnyStr = ...,
expand_tabs: bool = ...,
replace_whitespace: bool = ...,
fix_sentence_endings: bool = ...,
break_long_words: bool = ...,
drop_whitespace: bool = ...,
break_on_hyphens: bool = ...,
) -> AnyStr: ...
def dedent(text: AnyStr) -> AnyStr: ...
+1 -1
View File
@@ -1,5 +1,5 @@
"""Stubs for the "thread" module."""
from typing import Callable, Any
from typing import Any, Callable
def _count() -> int: ...
+1 -2
View File
@@ -1,6 +1,6 @@
# Automatically generated by pytype, manually fixed up. May still contain errors.
from typing import Any, Callable, Dict, Generator, Iterator, List, Tuple, Union, Iterable
from typing import Any, Callable, Dict, Generator, Iterable, Iterator, List, Tuple, Union
__author__: str
__credits__: str
@@ -123,7 +123,6 @@ def tokenize_loop(readline: Callable[[], str], tokeneater: Callable[[Tuple[int,
def untokenize(iterable: Iterable[_TokenType]) -> str: ...
class StopTokenizing(Exception): ...
class TokenError(Exception): ...
class Untokenizer:
+20 -11
View File
@@ -1,14 +1,12 @@
# Stubs for types
# Note, all classes "defined" here require special handling.
from typing import (
Any, Callable, Dict, Iterable, Iterator, List, Optional,
Tuple, Type, TypeVar, Union, overload,
)
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Type, TypeVar, Union, overload
_T = TypeVar('_T')
_T = TypeVar("_T")
class NoneType: ...
TypeType = type
ObjectType = object
@@ -43,7 +41,14 @@ class FunctionType:
__dict__ = func_dict
__globals__ = func_globals
__name__ = func_name
def __init__(self, code: CodeType, globals: Dict[str, Any], name: Optional[str] = ..., argdefs: Optional[Tuple[object, ...]] = ..., closure: Optional[Tuple[_Cell, ...]] = ...) -> None: ...
def __init__(
self,
code: CodeType,
globals: Dict[str, Any],
name: Optional[str] = ...,
argdefs: Optional[Tuple[object, ...]] = ...,
closure: Optional[Tuple[_Cell, ...]] = ...,
) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def __get__(self, obj: Optional[object], type: Optional[type]) -> UnboundMethodType: ...
@@ -91,13 +96,14 @@ class GeneratorType:
def next(self) -> Any: ...
def send(self, __arg: Any) -> Any: ...
@overload
def throw(self, __typ: Type[BaseException], __val: Union[BaseException, object] = ...,
__tb: Optional[TracebackType] = ...) -> Any: ...
def throw(
self, __typ: Type[BaseException], __val: Union[BaseException, object] = ..., __tb: Optional[TracebackType] = ...
) -> Any: ...
@overload
def throw(self, __typ: BaseException, __val: None = ...,
__tb: Optional[TracebackType] = ...) -> Any: ...
def throw(self, __typ: BaseException, __val: None = ..., __tb: Optional[TracebackType] = ...) -> Any: ...
class ClassType: ...
class UnboundMethodType:
im_class: type = ...
im_func: FunctionType = ...
@@ -115,6 +121,7 @@ MethodType = UnboundMethodType
class BuiltinFunctionType:
__self__: Optional[object]
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
BuiltinMethodType = BuiltinFunctionType
class ModuleType:
@@ -125,6 +132,7 @@ class ModuleType:
__path__: Optional[Iterable[str]]
__dict__: Dict[str, Any]
def __init__(self, name: str, doc: Optional[str] = ...) -> None: ...
FileType = file
XRangeType = xrange
@@ -147,10 +155,10 @@ class FrameType:
f_locals: Dict[str, Any]
f_restricted: bool
f_trace: Callable[[], None]
def clear(self) -> None: ...
SliceType = slice
class EllipsisType: ...
class DictProxyType:
@@ -178,6 +186,7 @@ class GetSetDescriptorType:
def __get__(self, obj: Any, type: type = ...) -> Any: ...
def __set__(self, obj: Any) -> None: ...
def __delete__(self, obj: Any) -> None: ...
# Same type on Jython, different on CPython and PyPy, unknown on IronPython.
class MemberDescriptorType:
__name__: str
+51 -66
View File
@@ -1,8 +1,8 @@
# Stubs for typing (Python 2.7)
from abc import abstractmethod, ABCMeta
from types import CodeType, FrameType, TracebackType
import collections # Needed by aliases like DefaultDict, see mypy issue 2986
from abc import ABCMeta, abstractmethod
from types import CodeType, FrameType, TracebackType
# Definitions of special type checking related constructs. Their definitions
# are not used, so their value does not matter.
@@ -16,7 +16,14 @@ class TypeVar:
__constraints__: Tuple[Type[Any], ...]
__covariant__: bool
__contravariant__: bool
def __init__(self, name: str, *constraints: Type[Any], bound: Optional[Type[Any]] = ..., covariant: bool = ..., contravariant: bool = ...) -> None: ...
def __init__(
self,
name: str,
*constraints: Type[Any],
bound: Optional[Type[Any]] = ...,
covariant: bool = ...,
contravariant: bool = ...,
) -> None: ...
_promote = object()
@@ -32,8 +39,10 @@ Callable: _SpecialForm = ...
Type: _SpecialForm = ...
ClassVar: _SpecialForm = ...
Final: _SpecialForm = ...
_F = TypeVar('_F', bound=Callable[..., Any])
_F = TypeVar("_F", bound=Callable[..., Any])
def final(f: _F) -> _F: ...
Literal: _SpecialForm = ...
# TypedDict is a (non-subscriptable) special form.
TypedDict: object = ...
@@ -46,19 +55,20 @@ class GenericMeta(type): ...
NoReturn = Union[None]
# These type variables are used by the container types.
_T = TypeVar('_T')
_S = TypeVar('_S')
_KT = TypeVar('_KT') # Key type.
_VT = TypeVar('_VT') # Value type.
_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers.
_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
_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])
_T = TypeVar("_T")
_S = TypeVar("_S")
_KT = TypeVar("_KT") # Key type.
_VT = TypeVar("_VT") # Value type.
_T_co = TypeVar("_T_co", covariant=True) # Any type covariant containers.
_V_co = TypeVar("_V_co", covariant=True) # Any type covariant containers.
_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[..., Any])
no_type_check = object()
def no_type_check_decorator(decorator: _C) -> _C: ...
# Type aliases and type constructors
@@ -76,12 +86,11 @@ Counter = _Alias()
Deque = _Alias()
# Predefined type variables.
AnyStr = TypeVar('AnyStr', str, unicode)
AnyStr = TypeVar("AnyStr", str, unicode)
# Abstract base classes.
def runtime_checkable(cls: _TC) -> _TC: ...
@runtime_checkable
class SupportsInt(Protocol, metaclass=ABCMeta):
@abstractmethod
@@ -134,19 +143,16 @@ class Iterator(Iterable[_T_co], Protocol[_T_co]):
class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
@abstractmethod
def next(self) -> _T_co: ...
@abstractmethod
def send(self, __value: _T_contra) -> _T_co: ...
@overload
@abstractmethod
def throw(self, __typ: Type[BaseException], __val: Union[BaseException, object] = ...,
__tb: Optional[TracebackType] = ...) -> _T_co: ...
def throw(
self, __typ: Type[BaseException], __val: Union[BaseException, object] = ..., __tb: Optional[TracebackType] = ...
) -> _T_co: ...
@overload
@abstractmethod
def throw(self, __typ: BaseException, __val: None = ...,
__tb: Optional[TracebackType] = ...) -> _T_co: ...
def throw(self, __typ: BaseException, __val: None = ..., __tb: Optional[TracebackType] = ...) -> _T_co: ...
@abstractmethod
def close(self) -> None: ...
@property
@@ -225,7 +231,6 @@ class AbstractSet(Iterable[_T_co], Container[_T_co], Generic[_T_co]):
@abstractmethod
def __len__(self) -> int: ...
class MutableSet(AbstractSet[_T], Generic[_T]):
@abstractmethod
def add(self, x: _T) -> None: ...
@@ -261,16 +266,18 @@ class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]):
@runtime_checkable
class ContextManager(Protocol[_T_co]):
def __enter__(self) -> _T_co: ...
def __exit__(self, __exc_type: Optional[Type[BaseException]],
__exc_value: Optional[BaseException],
__traceback: Optional[TracebackType]) -> Optional[bool]: ...
def __exit__(
self,
__exc_type: Optional[Type[BaseException]],
__exc_value: Optional[BaseException],
__traceback: Optional[TracebackType],
) -> Optional[bool]: ...
class Mapping(Iterable[_KT], Container[_KT], Generic[_KT, _VT_co]):
# TODO: We wish the key type could also be covariant, but that doesn't work,
# see discussion in https: //github.com/python/typing/pull/273.
@abstractmethod
def __getitem__(self, k: _KT) -> _VT_co:
...
def __getitem__(self, k: _KT) -> _VT_co: ...
# Mixin methods
@overload
def get(self, k: _KT) -> Optional[_VT_co]: ...
@@ -292,7 +299,6 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]):
def __setitem__(self, k: _KT, v: _VT) -> None: ...
@abstractmethod
def __delitem__(self, v: _KT) -> None: ...
def clear(self) -> None: ...
@overload
def pop(self, k: _KT) -> _VT: ...
@@ -352,7 +358,6 @@ class IO(Iterator[AnyStr], Generic[AnyStr]):
def write(self, s: AnyStr) -> int: ...
@abstractmethod
def writelines(self, lines: Iterable[AnyStr]) -> None: ...
@abstractmethod
def next(self) -> AnyStr: ...
@abstractmethod
@@ -360,8 +365,9 @@ class IO(Iterator[AnyStr], Generic[AnyStr]):
@abstractmethod
def __enter__(self) -> IO[AnyStr]: ...
@abstractmethod
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException],
traceback: Optional[TracebackType]) -> Optional[bool]: ...
def __exit__(
self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]
) -> Optional[bool]: ...
class BinaryIO(IO[str]):
# TODO readinto
@@ -403,20 +409,15 @@ class Match(Generic[AnyStr]):
# Can be None if there are no groups or if the last group was unnamed;
# otherwise matches the type of the pattern.
lastgroup: Optional[Any]
def expand(self, template: Union[str, Text]) -> Any: ...
@overload
def group(self, group1: int = ...) -> AnyStr: ...
@overload
def group(self, group1: str) -> AnyStr: ...
@overload
def group(self, group1: int, group2: int,
*groups: int) -> Tuple[AnyStr, ...]: ...
def group(self, group1: int, group2: int, *groups: int) -> Tuple[AnyStr, ...]: ...
@overload
def group(self, group1: str, group2: str,
*groups: str) -> Tuple[AnyStr, ...]: ...
def group(self, group1: str, group2: str, *groups: str) -> Tuple[AnyStr, ...]: ...
def groups(self, default: AnyStr = ...) -> Tuple[AnyStr, ...]: ...
def groupdict(self, default: AnyStr = ...) -> Dict[str, AnyStr]: ...
def start(self, __group: Union[int, str] = ...) -> int: ...
@@ -429,46 +430,34 @@ class Match(Generic[AnyStr]):
# Pattern is generic over AnyStr (determining the type of its .pattern
# attribute), but at the same time its methods take either bytes or
# Text and return the same type, regardless of the type of the pattern.
_AnyStr2 = TypeVar('_AnyStr2', bytes, Text)
_AnyStr2 = TypeVar("_AnyStr2", bytes, Text)
class Pattern(Generic[AnyStr]):
flags: int
groupindex: Dict[AnyStr, int]
groups: int
pattern: AnyStr
def search(self, string: _AnyStr2, pos: int = ...,
endpos: int = ...) -> Optional[Match[_AnyStr2]]: ...
def match(self, string: _AnyStr2, pos: int = ...,
endpos: int = ...) -> Optional[Match[_AnyStr2]]: ...
def search(self, string: _AnyStr2, pos: int = ..., endpos: int = ...) -> Optional[Match[_AnyStr2]]: ...
def match(self, string: _AnyStr2, pos: int = ..., endpos: int = ...) -> Optional[Match[_AnyStr2]]: ...
def split(self, string: _AnyStr2, maxsplit: int = ...) -> List[_AnyStr2]: ...
# Returns either a list of _AnyStr2 or a list of tuples, depending on
# whether there are groups in the pattern.
def findall(self, string: Union[bytes, Text], pos: int = ...,
endpos: int = ...) -> List[Any]: ...
def finditer(self, string: _AnyStr2, pos: int = ...,
endpos: int = ...) -> Iterator[Match[_AnyStr2]]: ...
def findall(self, string: Union[bytes, Text], pos: int = ..., endpos: int = ...) -> List[Any]: ...
def finditer(self, string: _AnyStr2, pos: int = ..., endpos: int = ...) -> Iterator[Match[_AnyStr2]]: ...
@overload
def sub(self, repl: _AnyStr2, string: _AnyStr2,
count: int = ...) -> _AnyStr2: ...
def sub(self, repl: _AnyStr2, string: _AnyStr2, count: int = ...) -> _AnyStr2: ...
@overload
def sub(self, repl: Callable[[Match[_AnyStr2]], _AnyStr2], string: _AnyStr2,
count: int = ...) -> _AnyStr2: ...
def sub(self, repl: Callable[[Match[_AnyStr2]], _AnyStr2], string: _AnyStr2, count: int = ...) -> _AnyStr2: ...
@overload
def subn(self, repl: _AnyStr2, string: _AnyStr2,
count: int = ...) -> Tuple[_AnyStr2, int]: ...
def subn(self, repl: _AnyStr2, string: _AnyStr2, count: int = ...) -> Tuple[_AnyStr2, int]: ...
@overload
def subn(self, repl: Callable[[Match[_AnyStr2]], _AnyStr2], string: _AnyStr2,
count: int = ...) -> Tuple[_AnyStr2, int]: ...
def subn(self, repl: Callable[[Match[_AnyStr2]], _AnyStr2], string: _AnyStr2, count: int = ...) -> Tuple[_AnyStr2, int]: ...
# Functions
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: ...
@overload
@@ -479,13 +468,9 @@ def cast(tp: str, obj: Any) -> Any: ...
# NamedTuple is special-cased in the type checker
class NamedTuple(Tuple[Any, ...]):
_fields: Tuple[str, ...]
def __init__(self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ...,
**kwargs: Any) -> None: ...
def __init__(self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ..., **kwargs: Any) -> None: ...
@classmethod
def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ...
def _asdict(self) -> Dict[str, Any]: ...
def _replace(self: _T, **kwargs: Any) -> _T: ...
+114 -118
View File
@@ -2,22 +2,40 @@
# Based on http://docs.python.org/2.7/library/unittest.html
from typing import (Any, Callable, Dict, FrozenSet, Iterable, Iterator,
List, Mapping, NoReturn, Optional, overload, Pattern,
Sequence, Set, Text, TextIO, Tuple, Type, TypeVar, Union)
from abc import abstractmethod, ABCMeta
import datetime
import types
from abc import ABCMeta, abstractmethod
from typing import (
Any,
Callable,
Dict,
FrozenSet,
Iterable,
Iterator,
List,
Mapping,
NoReturn,
Optional,
Pattern,
Sequence,
Set,
Text,
TextIO,
Tuple,
Type,
TypeVar,
Union,
overload,
)
_T = TypeVar('_T')
_FT = TypeVar('_FT')
_T = TypeVar("_T")
_FT = TypeVar("_FT")
_ExceptionType = Union[Type[BaseException], Tuple[Type[BaseException], ...]]
_Regexp = Union[Text, Pattern[Text]]
_SysExcInfoType = Union[
Tuple[Type[BaseException], BaseException, types.TracebackType],
Tuple[None, None, None],
Tuple[Type[BaseException], BaseException, types.TracebackType], Tuple[None, None, None],
]
class Testable(metaclass=ABCMeta):
@@ -40,7 +58,6 @@ class TestResult:
testsRun: int
buffer: bool
failfast: bool
def wasSuccessful(self) -> bool: ...
def stop(self) -> None: ...
def startTest(self, test: TestCase) -> None: ...
@@ -83,98 +100,76 @@ class TestCase(Testable):
def assert_(self, expr: Any, msg: object = ...) -> None: ...
def failUnless(self, expr: Any, msg: object = ...) -> None: ...
def assertTrue(self, expr: Any, msg: object = ...) -> None: ...
def assertEqual(self, first: Any, second: Any,
msg: object = ...) -> None: ...
def assertEquals(self, first: Any, second: Any,
msg: object = ...) -> None: ...
def failUnlessEqual(self, first: Any, second: Any,
msg: object = ...) -> None: ...
def assertNotEqual(self, first: Any, second: Any,
msg: object = ...) -> None: ...
def assertNotEquals(self, first: Any, second: Any,
msg: object = ...) -> None: ...
def failIfEqual(self, first: Any, second: Any,
msg: object = ...) -> None: ...
def assertEqual(self, first: Any, second: Any, msg: object = ...) -> None: ...
def assertEquals(self, first: Any, second: Any, msg: object = ...) -> None: ...
def failUnlessEqual(self, first: Any, second: Any, msg: object = ...) -> None: ...
def assertNotEqual(self, first: Any, second: Any, msg: object = ...) -> None: ...
def assertNotEquals(self, first: Any, second: Any, msg: object = ...) -> None: ...
def failIfEqual(self, first: Any, second: Any, msg: object = ...) -> None: ...
@overload
def assertAlmostEqual(self, first: float, second: float,
places: int = ..., msg: Any = ...) -> None: ...
def assertAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ...
@overload
def assertAlmostEqual(self, first: float, second: float, *,
msg: Any = ..., delta: float = ...) -> None: ...
def assertAlmostEqual(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ...
@overload
def assertAlmostEqual(self, first: datetime.datetime,
second: datetime.datetime, *,
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
def assertAlmostEqual(
self, first: datetime.datetime, second: datetime.datetime, *, msg: Any = ..., delta: datetime.timedelta = ...
) -> None: ...
@overload
def assertAlmostEquals(self, first: float, second: float,
places: int = ..., msg: Any = ...) -> None: ...
def assertAlmostEquals(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ...
@overload
def assertAlmostEquals(self, first: float, second: float, *,
msg: Any = ..., delta: float = ...) -> None: ...
def assertAlmostEquals(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ...
@overload
def assertAlmostEquals(self, first: datetime.datetime,
second: datetime.datetime, *,
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
def failUnlessAlmostEqual(self, first: float, second: float, places: int = ...,
msg: object = ...) -> None: ...
def assertAlmostEquals(
self, first: datetime.datetime, second: datetime.datetime, *, msg: Any = ..., delta: datetime.timedelta = ...
) -> None: ...
def failUnlessAlmostEqual(self, first: float, second: float, places: int = ..., msg: object = ...) -> None: ...
@overload
def assertNotAlmostEqual(self, first: float, second: float,
places: int = ..., msg: Any = ...) -> None: ...
def assertNotAlmostEqual(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ...
@overload
def assertNotAlmostEqual(self, first: float, second: float, *,
msg: Any = ..., delta: float = ...) -> None: ...
def assertNotAlmostEqual(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ...
@overload
def assertNotAlmostEqual(self, first: datetime.datetime,
second: datetime.datetime, *,
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
def assertNotAlmostEqual(
self, first: datetime.datetime, second: datetime.datetime, *, msg: Any = ..., delta: datetime.timedelta = ...
) -> None: ...
@overload
def assertNotAlmostEquals(self, first: float, second: float,
places: int = ..., msg: Any = ...) -> None: ...
def assertNotAlmostEquals(self, first: float, second: float, places: int = ..., msg: Any = ...) -> None: ...
@overload
def assertNotAlmostEquals(self, first: float, second: float, *,
msg: Any = ..., delta: float = ...) -> None: ...
def assertNotAlmostEquals(self, first: float, second: float, *, msg: Any = ..., delta: float = ...) -> None: ...
@overload
def assertNotAlmostEquals(self, first: datetime.datetime,
second: datetime.datetime, *,
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
def failIfAlmostEqual(self, first: float, second: float, places: int = ...,
msg: object = ...,
delta: float = ...) -> None: ...
def assertGreater(self, first: Any, second: Any,
msg: object = ...) -> None: ...
def assertGreaterEqual(self, first: Any, second: Any,
msg: object = ...) -> None: ...
def assertMultiLineEqual(self, first: str, second: str,
msg: object = ...) -> None: ...
def assertSequenceEqual(self, first: Sequence[Any], second: Sequence[Any],
msg: object = ..., seq_type: type = ...) -> None: ...
def assertListEqual(self, first: List[Any], second: List[Any],
msg: object = ...) -> None: ...
def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...],
msg: object = ...) -> None: ...
def assertSetEqual(self, first: Union[Set[Any], FrozenSet[Any]],
second: Union[Set[Any], FrozenSet[Any]], msg: object = ...) -> None: ...
def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any],
msg: object = ...) -> None: ...
def assertLess(self, first: Any, second: Any,
msg: object = ...) -> None: ...
def assertLessEqual(self, first: Any, second: Any,
msg: object = ...) -> None: ...
def assertNotAlmostEquals(
self, first: datetime.datetime, second: datetime.datetime, *, msg: Any = ..., delta: datetime.timedelta = ...
) -> None: ...
def failIfAlmostEqual(
self, first: float, second: float, places: int = ..., msg: object = ..., delta: float = ...
) -> None: ...
def assertGreater(self, first: Any, second: Any, msg: object = ...) -> None: ...
def assertGreaterEqual(self, first: Any, second: Any, msg: object = ...) -> None: ...
def assertMultiLineEqual(self, first: str, second: str, msg: object = ...) -> None: ...
def assertSequenceEqual(
self, first: Sequence[Any], second: Sequence[Any], msg: object = ..., seq_type: type = ...
) -> None: ...
def assertListEqual(self, first: List[Any], second: List[Any], msg: object = ...) -> None: ...
def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...], msg: object = ...) -> None: ...
def assertSetEqual(
self, first: Union[Set[Any], FrozenSet[Any]], second: Union[Set[Any], FrozenSet[Any]], msg: object = ...
) -> None: ...
def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any], msg: object = ...) -> None: ...
def assertLess(self, first: Any, second: Any, msg: object = ...) -> None: ...
def assertLessEqual(self, first: Any, second: Any, msg: object = ...) -> None: ...
@overload
def assertRaises(self, exception: _ExceptionType, callable: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
@overload
def assertRaises(self, exception: _ExceptionType) -> _AssertRaisesContext: ...
@overload
def assertRaisesRegexp(self, exception: _ExceptionType, regexp: _Regexp, callable: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
def assertRaisesRegexp(
self, exception: _ExceptionType, regexp: _Regexp, callable: Callable[..., Any], *args: Any, **kwargs: Any
) -> None: ...
@overload
def assertRaisesRegexp(self, exception: _ExceptionType, regexp: _Regexp) -> _AssertRaisesContext: ...
def assertRegexpMatches(self, text: Text, regexp: _Regexp, msg: object = ...) -> None: ...
def assertNotRegexpMatches(self, text: Text, regexp: _Regexp, msg: object = ...) -> None: ...
def assertItemsEqual(self, first: Iterable[Any], second: Iterable[Any], msg: object = ...) -> None: ...
def assertDictContainsSubset(self,
expected: Mapping[Any, Any],
actual: Mapping[Any, Any],
msg: object = ...) -> None: ...
def assertDictContainsSubset(self, expected: Mapping[Any, Any], actual: Mapping[Any, Any], msg: object = ...) -> None: ...
def addTypeEqualityFunc(self, typeobj: type, function: Callable[..., None]) -> None: ...
@overload
def failUnlessRaises(self, exception: _ExceptionType, callable: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
@@ -182,20 +177,14 @@ class TestCase(Testable):
def failUnlessRaises(self, exception: _ExceptionType) -> _AssertRaisesContext: ...
def failIf(self, expr: Any, msg: object = ...) -> None: ...
def assertFalse(self, expr: Any, msg: object = ...) -> None: ...
def assertIs(self, first: object, second: object,
msg: object = ...) -> None: ...
def assertIsNot(self, first: object, second: object,
msg: object = ...) -> None: ...
def assertIs(self, first: object, second: object, msg: object = ...) -> None: ...
def assertIsNot(self, first: object, second: object, msg: object = ...) -> None: ...
def assertIsNone(self, expr: Any, msg: object = ...) -> None: ...
def assertIsNotNone(self, expr: Any, msg: object = ...) -> None: ...
def assertIn(self, first: _T, second: Iterable[_T],
msg: object = ...) -> None: ...
def assertNotIn(self, first: _T, second: Iterable[_T],
msg: object = ...) -> None: ...
def assertIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]],
msg: object = ...) -> None: ...
def assertNotIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]],
msg: object = ...) -> None: ...
def assertIn(self, first: _T, second: Iterable[_T], msg: object = ...) -> None: ...
def assertNotIn(self, first: _T, second: Iterable[_T], msg: object = ...) -> None: ...
def assertIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]], msg: object = ...) -> None: ...
def assertNotIsInstance(self, obj: Any, cls: Union[type, Tuple[type, ...]], msg: object = ...) -> None: ...
def fail(self, msg: object = ...) -> NoReturn: ...
def countTestCases(self) -> int: ...
def defaultTestResult(self) -> TestResult: ...
@@ -208,10 +197,13 @@ class TestCase(Testable):
def _getAssertEqualityFunc(self, first: Any, second: Any) -> Callable[..., None]: ... # undocumented
class FunctionTestCase(TestCase):
def __init__(self, testFunc: Callable[[], None],
setUp: Optional[Callable[[], None]] = ...,
tearDown: Optional[Callable[[], None]] = ...,
description: Optional[str] = ...) -> None: ...
def __init__(
self,
testFunc: Callable[[], None],
setUp: Optional[Callable[[], None]] = ...,
tearDown: Optional[Callable[[], None]] = ...,
description: Optional[str] = ...,
) -> None: ...
def debug(self) -> None: ...
def countTestCases(self) -> int: ...
@@ -228,16 +220,11 @@ class TestLoader:
testMethodPrefix: str
sortTestMethodsUsing: Optional[Callable[[str, str], int]]
suiteClass: Callable[[List[TestCase]], TestSuite]
def loadTestsFromTestCase(self,
testCaseClass: Type[TestCase]) -> TestSuite: ...
def loadTestsFromModule(self, module: types.ModuleType = ...,
use_load_tests: bool = ...) -> TestSuite: ...
def loadTestsFromName(self, name: str = ...,
module: Optional[types.ModuleType] = ...) -> TestSuite: ...
def loadTestsFromNames(self, names: List[str] = ...,
module: Optional[types.ModuleType] = ...) -> TestSuite: ...
def discover(self, start_dir: str, pattern: str = ...,
top_level_dir: Optional[str] = ...) -> TestSuite: ...
def loadTestsFromTestCase(self, testCaseClass: Type[TestCase]) -> TestSuite: ...
def loadTestsFromModule(self, module: types.ModuleType = ..., use_load_tests: bool = ...) -> TestSuite: ...
def loadTestsFromName(self, name: str = ..., module: Optional[types.ModuleType] = ...) -> TestSuite: ...
def loadTestsFromNames(self, names: List[str] = ..., module: Optional[types.ModuleType] = ...) -> TestSuite: ...
def discover(self, start_dir: str, pattern: str = ..., top_level_dir: Optional[str] = ...) -> TestSuite: ...
def getTestCaseNames(self, testCaseClass: Type[TestCase] = ...) -> List[str]: ...
defaultTestLoader: TestLoader
@@ -249,14 +236,19 @@ class TextTestResult(TestResult):
def printErrorList(self, flavour: str, errors: List[Tuple[TestCase, str]]) -> None: ... # undocumented
class TextTestRunner:
def __init__(self, stream: Optional[TextIO] = ..., descriptions: bool = ...,
verbosity: int = ..., failfast: bool = ..., buffer: bool = ...,
resultclass: Optional[Type[TestResult]] = ...) -> None: ...
def __init__(
self,
stream: Optional[TextIO] = ...,
descriptions: bool = ...,
verbosity: int = ...,
failfast: bool = ...,
buffer: bool = ...,
resultclass: Optional[Type[TestResult]] = ...,
) -> None: ...
def _makeResult(self) -> TestResult: ...
def run(self, test: Testable) -> TestResult: ... # undocumented
class SkipTest(Exception):
...
class SkipTest(Exception): ...
# TODO precise types
def skipUnless(condition: Any, reason: Union[str, unicode]) -> Any: ...
@@ -269,15 +261,19 @@ class TestProgram:
result: TestResult
def runTests(self) -> None: ... # undocumented
def main(module: Union[None, Text, types.ModuleType] = ..., defaultTest: Optional[str] = ...,
argv: Optional[Sequence[str]] = ...,
testRunner: Union[Type[TextTestRunner], TextTestRunner, None] = ...,
testLoader: TestLoader = ..., exit: bool = ..., verbosity: int = ...,
failfast: Optional[bool] = ..., catchbreak: Optional[bool] = ...,
buffer: Optional[bool] = ...) -> TestProgram: ...
def main(
module: Union[None, Text, types.ModuleType] = ...,
defaultTest: Optional[str] = ...,
argv: Optional[Sequence[str]] = ...,
testRunner: Union[Type[TextTestRunner], TextTestRunner, None] = ...,
testLoader: TestLoader = ...,
exit: bool = ...,
verbosity: int = ...,
failfast: Optional[bool] = ...,
catchbreak: Optional[bool] = ...,
buffer: Optional[bool] = ...,
) -> TestProgram: ...
def load_tests(loader: TestLoader, tests: TestSuite, pattern: Optional[Text]) -> TestSuite: ...
def installHandler() -> None: ...
def registerResult(result: TestResult) -> None: ...
def removeResult(result: TestResult) -> bool: ...
+1 -2
View File
@@ -1,4 +1,4 @@
from typing import Any, AnyStr, IO, List, Mapping, Sequence, Text, Tuple, TypeVar, Union
from typing import IO, Any, AnyStr, List, Mapping, Sequence, Text, Tuple, TypeVar, Union
def url2pathname(pathname: AnyStr) -> AnyStr: ...
def pathname2url(pathname: AnyStr) -> AnyStr: ...
@@ -126,7 +126,6 @@ def unquote_plus(s: AnyStr) -> AnyStr: ...
def quote(s: AnyStr, safe: Text = ...) -> AnyStr: ...
def quote_plus(s: AnyStr, safe: Text = ...) -> AnyStr: ...
def urlencode(query: Union[Sequence[Tuple[Any, Any]], Mapping[Any, Any]], doseq=...) -> str: ...
def getproxies() -> Mapping[str, str]: ...
def proxy_bypass(host: str) -> Any: ... # Undocumented
+24 -20
View File
@@ -1,8 +1,7 @@
import ssl
from typing import Any, AnyStr, Dict, List, Union, Optional, Mapping, Callable, Sequence, Text, Tuple, Type
from urllib import addinfourl
from httplib import HTTPConnectionProtocol, HTTPResponse
from typing import Any, AnyStr, Callable, Dict, List, Mapping, Optional, Sequence, Text, Tuple, Type, Union
from urllib import addinfourl
_string = Union[str, unicode]
@@ -23,9 +22,14 @@ class Request(object):
type: Optional[str]
origin_req_host = ...
unredirected_hdrs: Dict[str, str]
def __init__(self, url: str, data: Optional[str] = ..., headers: Dict[str, str] = ...,
origin_req_host: Optional[str] = ..., unverifiable: bool = ...) -> None: ...
def __init__(
self,
url: str,
data: Optional[str] = ...,
headers: Dict[str, str] = ...,
origin_req_host: Optional[str] = ...,
unverifiable: bool = ...,
) -> None: ...
def __getattr__(self, attr): ...
def get_method(self) -> str: ...
def add_data(self, data) -> None: ...
@@ -47,23 +51,29 @@ class Request(object):
class OpenerDirector(object):
addheaders: List[Tuple[str, str]]
def add_handler(self, handler: BaseHandler) -> None: ...
def open(self, fullurl: Union[Request, _string], data: Optional[_string] = ..., timeout: Optional[float] = ...) -> Optional[addinfourl]: ...
def open(
self, fullurl: Union[Request, _string], data: Optional[_string] = ..., timeout: Optional[float] = ...
) -> Optional[addinfourl]: ...
def error(self, proto: _string, *args: Any): ...
# Note that this type is somewhat a lie. The return *can* be None if
# a custom opener has been installed that fails to handle the request.
def urlopen(url: Union[Request, _string], data: Optional[_string] = ..., timeout: Optional[float] = ...,
cafile: Optional[_string] = ..., capath: Optional[_string] = ..., cadefault: bool = ...,
context: Optional[ssl.SSLContext] = ...) -> addinfourl: ...
def urlopen(
url: Union[Request, _string],
data: Optional[_string] = ...,
timeout: Optional[float] = ...,
cafile: Optional[_string] = ...,
capath: Optional[_string] = ...,
cadefault: bool = ...,
context: Optional[ssl.SSLContext] = ...,
) -> addinfourl: ...
def install_opener(opener: OpenerDirector) -> None: ...
def build_opener(*handlers: Union[BaseHandler, Type[BaseHandler]]) -> OpenerDirector: ...
class BaseHandler:
handler_order: int
parent: OpenerDirector
def add_parent(self, parent: OpenerDirector) -> None: ...
def close(self) -> None: ...
def __lt__(self, other: Any) -> bool: ...
@@ -84,10 +94,8 @@ class HTTPRedirectHandler(BaseHandler):
def http_error_307(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ...
inf_msg: str
class ProxyHandler(BaseHandler):
proxies: Mapping[str, str]
def __init__(self, proxies: Optional[Mapping[str, str]] = ...): ...
def proxy_open(self, req: Request, proxy, type): ...
@@ -118,8 +126,7 @@ class AbstractDigestAuthHandler:
def __init__(self, passwd: Optional[HTTPPasswordMgr] = ...) -> None: ...
def add_password(self, realm: Optional[Text], uri: Union[Text, Sequence[Text]], user: Text, passwd: Text) -> None: ...
def reset_retry_count(self) -> None: ...
def http_error_auth_reqed(self, auth_header: str, host: str, req: Request,
headers: Mapping[str, str]) -> None: ...
def http_error_auth_reqed(self, auth_header: str, host: str, req: Request, headers: Mapping[str, str]) -> None: ...
def retry_http_digest_auth(self, req: Request, auth: str) -> Optional[HTTPResponse]: ...
def get_cnonce(self, nonce: str) -> str: ...
def get_authorization(self, req: Request, chal: Mapping[str, str]) -> str: ...
@@ -140,10 +147,7 @@ class AbstractHTTPHandler(BaseHandler): # undocumented
def __init__(self, debuglevel: int = ...) -> None: ...
def set_http_debuglevel(self, level: int) -> None: ...
def do_request_(self, request: Request) -> Request: ...
def do_open(self,
http_class: HTTPConnectionProtocol,
req: Request,
**http_conn_args: Optional[Any]) -> addinfourl: ...
def do_open(self, http_class: HTTPConnectionProtocol, req: Request, **http_conn_args: Optional[Any]) -> addinfourl: ...
class HTTPHandler(AbstractHTTPHandler):
def http_open(self, req: Request) -> addinfourl: ...

Some files were not shown because too many files have changed in this diff Show More