mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-24 20:12:08 +08:00
Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949)
This commit is contained in:
@@ -5,14 +5,14 @@ from ssl import SSLContext
|
||||
from StringIO import StringIO
|
||||
from time import struct_time
|
||||
from types import InstanceType
|
||||
from typing import IO, Any, AnyStr, Callable, Iterable, List, Mapping, MutableMapping, Tuple, Type, Union
|
||||
from typing import IO, Any, AnyStr, Callable, Iterable, Mapping, MutableMapping, Union
|
||||
|
||||
_Unmarshaller = Any
|
||||
_timeTuple = Tuple[int, int, int, int, int, int, int, int, int]
|
||||
_timeTuple = tuple[int, int, int, int, int, int, int, int, int]
|
||||
# Represents types that can be compared against a DateTime object
|
||||
_dateTimeComp = Union[unicode, DateTime, datetime]
|
||||
# A "host description" used by Transport factories
|
||||
_hostDesc = Union[str, Tuple[str, Mapping[Any, Any]]]
|
||||
_hostDesc = Union[str, tuple[str, Mapping[Any, Any]]]
|
||||
|
||||
def escape(s: AnyStr, replace: Callable[[AnyStr, AnyStr, AnyStr], AnyStr] = ...) -> AnyStr: ...
|
||||
|
||||
@@ -47,13 +47,13 @@ class Fault(Error):
|
||||
faultString: str
|
||||
def __init__(self, faultCode: Any, faultString: str, **extra: Any) -> None: ...
|
||||
|
||||
boolean: Type[bool]
|
||||
Boolean: Type[bool]
|
||||
boolean: type[bool]
|
||||
Boolean: type[bool]
|
||||
|
||||
class DateTime:
|
||||
value: str
|
||||
def __init__(self, value: str | unicode | datetime | float | int | _timeTuple | struct_time = ...) -> None: ...
|
||||
def make_comparable(self, other: _dateTimeComp) -> Tuple[unicode, unicode]: ...
|
||||
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: ...
|
||||
@@ -72,7 +72,7 @@ class Binary:
|
||||
def decode(self, data: str) -> None: ...
|
||||
def encode(self, out: IO[str]) -> None: ...
|
||||
|
||||
WRAPPERS: Tuple[Type[Any], ...]
|
||||
WRAPPERS: tuple[type[Any], ...]
|
||||
|
||||
# Still part of the public API, but see http://bugs.python.org/issue1773632
|
||||
FastParser: None
|
||||
@@ -112,8 +112,8 @@ class Marshaller:
|
||||
| float
|
||||
| str
|
||||
| unicode
|
||||
| List[Any]
|
||||
| Tuple[Any, ...]
|
||||
| list[Any]
|
||||
| tuple[Any, ...]
|
||||
| Mapping[Any, Any]
|
||||
| datetime
|
||||
| InstanceType
|
||||
@@ -150,7 +150,7 @@ class Marshaller:
|
||||
class Unmarshaller:
|
||||
def append(self, object: Any) -> None: ...
|
||||
def __init__(self, use_datetime: bool = ...) -> None: ...
|
||||
def close(self) -> Tuple[Any, ...]: ...
|
||||
def close(self) -> tuple[Any, ...]: ...
|
||||
def getmethodname(self) -> str | None: ...
|
||||
def xml(self, encoding: str, standalone: bool) -> None: ...
|
||||
def start(self, tag: str, attrs: Any) -> None: ...
|
||||
@@ -173,25 +173,25 @@ class Unmarshaller:
|
||||
def end_methodName(self, data: str) -> None: ...
|
||||
|
||||
class _MultiCallMethod:
|
||||
def __init__(self, call_list: List[Tuple[str, Tuple[Any, ...]]], name: str) -> None: ...
|
||||
def __init__(self, call_list: list[tuple[str, tuple[Any, ...]]], name: str) -> None: ...
|
||||
|
||||
class MultiCallIterator:
|
||||
def __init__(self, results: List[Any]) -> None: ...
|
||||
def __init__(self, results: list[Any]) -> None: ...
|
||||
|
||||
class MultiCall:
|
||||
def __init__(self, server: ServerProxy) -> None: ...
|
||||
def __getattr__(self, name: str) -> _MultiCallMethod: ...
|
||||
def __call__(self) -> MultiCallIterator: ...
|
||||
|
||||
def getparser(use_datetime: bool = ...) -> Tuple[ExpatParser | SlowParser, Unmarshaller]: ...
|
||||
def getparser(use_datetime: bool = ...) -> tuple[ExpatParser | SlowParser, Unmarshaller]: ...
|
||||
def dumps(
|
||||
params: Tuple[Any, ...] | Fault,
|
||||
params: tuple[Any, ...] | Fault,
|
||||
methodname: str | None = ...,
|
||||
methodresponse: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
allow_none: bool = ...,
|
||||
) -> str: ...
|
||||
def loads(data: str, use_datetime: bool = ...) -> Tuple[Tuple[Any, ...], str | None]: ...
|
||||
def loads(data: str, use_datetime: bool = ...) -> tuple[tuple[Any, ...], str | None]: ...
|
||||
def gzip_encode(data: str) -> str: ...
|
||||
def gzip_decode(data: str, max_decode: int = ...) -> str: ...
|
||||
|
||||
@@ -201,7 +201,7 @@ class GzipDecodedResponse(GzipFile):
|
||||
def close(self): ...
|
||||
|
||||
class _Method:
|
||||
def __init__(self, send: Callable[[str, Tuple[Any, ...]], 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: ...
|
||||
|
||||
@@ -210,18 +210,18 @@ class Transport:
|
||||
accept_gzip_encoding: bool
|
||||
encode_threshold: int | None
|
||||
def __init__(self, use_datetime: bool = ...) -> None: ...
|
||||
def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ...
|
||||
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[Any, ...]: ...
|
||||
def getparser(self) -> Tuple[ExpatParser | SlowParser, Unmarshaller]: ...
|
||||
def get_host_info(self, host: _hostDesc) -> Tuple[str, List[Tuple[str, str]] | None, Mapping[Any, Any] | None]: ...
|
||||
def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple[Any, ...]: ...
|
||||
def getparser(self) -> tuple[ExpatParser | SlowParser, Unmarshaller]: ...
|
||||
def get_host_info(self, host: _hostDesc) -> tuple[str, list[tuple[str, str]] | None, Mapping[Any, Any] | None]: ...
|
||||
def make_connection(self, host: _hostDesc) -> HTTPConnection: ...
|
||||
def close(self) -> None: ...
|
||||
def send_request(self, connection: HTTPConnection, handler: str, request_body: str) -> None: ...
|
||||
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[Any, ...]: ...
|
||||
def parse_response(self, response: HTTPResponse) -> tuple[Any, ...]: ...
|
||||
|
||||
class SafeTransport(Transport):
|
||||
def __init__(self, use_datetime: bool = ..., context: SSLContext | None = ...) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user