Enable --disallow-any-generics for stubs (#3288)

This commit is contained in:
Sebastian Rittau
2019-10-01 14:31:34 +02:00
committed by Jelle Zijlstra
parent 23b353303b
commit c32e1e2280
77 changed files with 386 additions and 329 deletions

View File

@@ -12,7 +12,7 @@ from gzip import GzipFile
_Unmarshaller = Any
_timeTuple = Tuple[int, int, int, int, int, int, int, int, int]
# Represents types that can be compared against a DateTime object
_dateTimeComp = Union[AnyStr, DateTime, datetime, _timeTuple]
_dateTimeComp = Union[unicode, DateTime, datetime]
# A "host description" used by Transport factories
_hostDesc = Union[str, Tuple[str, Mapping[Any, Any]]]
@@ -55,26 +55,26 @@ Boolean: Type[bool]
class DateTime:
value: str
def __init__(self, value: Union[str, unicode, datetime, float, int, _timeTuple, struct_time] = ...) -> None: ...
def make_comparable(self, other: _dateTimeComp) -> Tuple[_dateTimeComp, _dateTimeComp]: ...
def make_comparable(self, other: _dateTimeComp) -> Tuple[unicode, unicode]: ...
def __lt__(self, other: _dateTimeComp) -> bool: ...
def __le__(self, other: _dateTimeComp) -> bool: ...
def __gt__(self, other: _dateTimeComp) -> bool: ...
def __ge__(self, other: _dateTimeComp) -> bool: ...
def __eq__(self, other: _dateTimeComp) -> bool: ...
def __ne__(self, other: _dateTimeComp) -> bool: ...
def __eq__(self, other: _dateTimeComp) -> bool: ... # type: ignore
def __ne__(self, other: _dateTimeComp) -> bool: ... # type: ignore
def timetuple(self) -> struct_time: ...
def __cmp__(self, other: _dateTimeComp) -> int: ...
def decode(self, data: Any) -> None: ...
def encode(self, out: IO) -> None: ...
def encode(self, out: IO[str]) -> None: ...
class Binary:
data: str
def __init__(self, data: Optional[str] = ...) -> None: ...
def __cmp__(self, other: Any) -> int: ...
def decode(self, data: str) -> None: ...
def encode(self, out: IO) -> None: ...
def encode(self, out: IO[str]) -> None: ...
WRAPPERS: tuple
WRAPPERS: Tuple[Type[Any], ...]
# Still part of the public API, but see http://bugs.python.org/issue1773632
FastParser: None
@@ -104,7 +104,28 @@ class Marshaller:
allow_none: bool
def __init__(self, encoding: Optional[str] = ..., allow_none: bool = ...) -> None: ...
dispatch: Mapping[type, Callable[[Marshaller, str, Callable[[str], None]], None]]
def dumps(self, values: Union[Iterable[Union[None, int, bool, long, float, str, unicode, List, Tuple, Mapping, datetime, InstanceType]], Fault]) -> str: ...
def dumps(
self,
values: Union[
Iterable[
Union[
None,
int,
bool,
long,
float,
str,
unicode,
List[Any],
Tuple[Any, ...],
Mapping[Any, Any],
datetime,
InstanceType,
],
],
Fault,
],
) -> str: ...
def dump_nil(self, value: None, write: Callable[[str], None]) -> None: ...
def dump_int(self, value: int, write: Callable[[str], None]) -> None: ...
def dump_bool(self, value: bool, write: Callable[[str], None]) -> None: ...
@@ -112,15 +133,20 @@ class Marshaller:
def dump_double(self, value: float, write: Callable[[str], None]) -> None: ...
def dump_string(self, value: str, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
def dump_unicode(self, value: unicode, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
def dump_array(self, value: Union[List, Tuple], write: Callable[[str], None]) -> None: ...
def dump_struct(self, value: Mapping, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
def dump_array(self, value: Iterable[Any], write: Callable[[str], None]) -> None: ...
def dump_struct(
self,
value: Mapping[unicode, Any],
write: Callable[[str], None],
escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...,
) -> None: ...
def dump_datetime(self, value: datetime, write: Callable[[str], None]) -> None: ...
def dump_instance(self, value: InstanceType, write: Callable[[str], None]) -> None: ...
class Unmarshaller:
def append(self, object: Any) -> None: ...
def __init__(self, use_datetime: bool = ...) -> None: ...
def close(self) -> tuple: ...
def close(self) -> Tuple[Any, ...]: ...
def getmethodname(self) -> Optional[str]: ...
def xml(self, encoding: str, standalone: bool) -> None: ...
def start(self, tag: str, attrs: Any) -> None: ...
@@ -143,9 +169,9 @@ class Unmarshaller:
def end_methodName(self, data: str) -> None: ...
class _MultiCallMethod:
def __init__(self, call_list: List[Tuple[str, tuple]], name: str) -> None: ...
def __init__(self, call_list: List[Tuple[str, Tuple[Any, ...]]], name: str) -> None: ...
class MultiCallIterator:
def __init__(self, results: List) -> None: ...
def __init__(self, results: List[Any]) -> None: ...
class MultiCall:
def __init__(self, server: ServerProxy) -> None: ...
@@ -153,19 +179,25 @@ class MultiCall:
def __call__(self) -> MultiCallIterator: ...
def getparser(use_datetime: bool = ...) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
def dumps(params: Union[tuple, Fault], methodname: Optional[str] = ..., methodresponse: Optional[bool] = ..., encoding: Optional[str] = ..., allow_none: bool = ...) -> str: ...
def loads(data: str, use_datetime: bool = ...) -> Tuple[tuple, Optional[str]]: ...
def dumps(
params: Union[Tuple[Any, ...], Fault],
methodname: Optional[str] = ...,
methodresponse: Optional[bool] = ...,
encoding: Optional[str] = ...,
allow_none: bool = ...,
) -> str: ...
def loads(data: str, use_datetime: bool = ...) -> Tuple[Tuple[Any, ...], Optional[str]]: ...
def gzip_encode(data: str) -> str: ...
def gzip_decode(data: str, max_decode: int = ...) -> str: ...
class GzipDecodedResponse(GzipFile):
stringio: StringIO
stringio: StringIO[Any]
def __init__(self, response: HTTPResponse) -> None: ...
def close(self): ...
class _Method:
def __init__(self, send: Callable[[str, tuple], Any], name: str) -> None: ...
def __init__(self, send: Callable[[str, Tuple[Any, ...]], Any], name: str) -> None: ...
def __getattr__(self, name: str) -> _Method: ...
def __call__(self, *args: Any) -> Any: ...
@@ -174,9 +206,9 @@ class Transport:
accept_gzip_encoding: bool
encode_threshold: Optional[int]
def __init__(self, use_datetime: bool = ...) -> None: ...
def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ...
verbose: bool
def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ...
def getparser(self) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
def get_host_info(self, host: _hostDesc) -> Tuple[str, Optional[List[Tuple[str, str]]], Optional[Mapping[Any, Any]]]: ...
def make_connection(self, host: _hostDesc) -> HTTPConnection: ...
@@ -185,7 +217,7 @@ class Transport:
def send_host(self, connection: HTTPConnection, host: str) -> None: ...
def send_user_agent(self, connection: HTTPConnection) -> None: ...
def send_content(self, connection: HTTPConnection, request_body: str) -> None: ...
def parse_response(self, response: HTTPResponse) -> tuple: ...
def parse_response(self, response: HTTPResponse) -> Tuple[Any, ...]: ...
class SafeTransport(Transport):
def __init__(self, use_datetime: bool = ..., context: Optional[SSLContext] = ...) -> None: ...