mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -5,7 +5,7 @@ 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, Optional, Tuple, Type, Union
|
||||
from typing import IO, Any, AnyStr, Callable, Iterable, List, Mapping, MutableMapping, Tuple, Type, Union
|
||||
|
||||
_Unmarshaller = Any
|
||||
_timeTuple = Tuple[int, int, int, int, int, int, int, int, int]
|
||||
@@ -52,7 +52,7 @@ Boolean: Type[bool]
|
||||
|
||||
class DateTime:
|
||||
value: str
|
||||
def __init__(self, value: Union[str, unicode, datetime, float, int, _timeTuple, struct_time] = ...) -> None: ...
|
||||
def __init__(self, value: str | unicode | datetime | float | int | _timeTuple | struct_time = ...) -> None: ...
|
||||
def make_comparable(self, other: _dateTimeComp) -> Tuple[unicode, unicode]: ...
|
||||
def __lt__(self, other: _dateTimeComp) -> bool: ...
|
||||
def __le__(self, other: _dateTimeComp) -> bool: ...
|
||||
@@ -67,7 +67,7 @@ class DateTime:
|
||||
|
||||
class Binary:
|
||||
data: str
|
||||
def __init__(self, data: Optional[str] = ...) -> None: ...
|
||||
def __init__(self, data: str | None = ...) -> None: ...
|
||||
def __cmp__(self, other: Any) -> int: ...
|
||||
def decode(self, data: str) -> None: ...
|
||||
def encode(self, out: IO[str]) -> None: ...
|
||||
@@ -97,32 +97,28 @@ class SlowParser:
|
||||
|
||||
class Marshaller:
|
||||
memo: MutableMapping[int, Any]
|
||||
data: Optional[str]
|
||||
encoding: Optional[str]
|
||||
data: str | None
|
||||
encoding: str | None
|
||||
allow_none: bool
|
||||
def __init__(self, encoding: Optional[str] = ..., allow_none: bool = ...) -> None: ...
|
||||
def __init__(self, encoding: str | None = ..., 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[Any],
|
||||
Tuple[Any, ...],
|
||||
Mapping[Any, Any],
|
||||
datetime,
|
||||
InstanceType,
|
||||
]
|
||||
],
|
||||
Fault,
|
||||
],
|
||||
values: Iterable[
|
||||
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: ...
|
||||
@@ -155,7 +151,7 @@ class Unmarshaller:
|
||||
def append(self, object: Any) -> None: ...
|
||||
def __init__(self, use_datetime: bool = ...) -> None: ...
|
||||
def close(self) -> Tuple[Any, ...]: ...
|
||||
def getmethodname(self) -> Optional[str]: ...
|
||||
def getmethodname(self) -> str | None: ...
|
||||
def xml(self, encoding: str, standalone: bool) -> None: ...
|
||||
def start(self, tag: str, attrs: Any) -> None: ...
|
||||
def data(self, text: str) -> None: ...
|
||||
@@ -187,15 +183,15 @@ class MultiCall:
|
||||
def __getattr__(self, name: str) -> _MultiCallMethod: ...
|
||||
def __call__(self) -> MultiCallIterator: ...
|
||||
|
||||
def getparser(use_datetime: bool = ...) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
|
||||
def getparser(use_datetime: bool = ...) -> Tuple[ExpatParser | SlowParser, Unmarshaller]: ...
|
||||
def dumps(
|
||||
params: Union[Tuple[Any, ...], Fault],
|
||||
methodname: Optional[str] = ...,
|
||||
methodresponse: Optional[bool] = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
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, ...], Optional[str]]: ...
|
||||
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: ...
|
||||
|
||||
@@ -212,13 +208,13 @@ class _Method:
|
||||
class Transport:
|
||||
user_agent: str
|
||||
accept_gzip_encoding: bool
|
||||
encode_threshold: Optional[int]
|
||||
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, ...]: ...
|
||||
verbose: bool
|
||||
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 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: ...
|
||||
@@ -228,21 +224,21 @@ class Transport:
|
||||
def parse_response(self, response: HTTPResponse) -> Tuple[Any, ...]: ...
|
||||
|
||||
class SafeTransport(Transport):
|
||||
def __init__(self, use_datetime: bool = ..., context: Optional[SSLContext] = ...) -> None: ...
|
||||
def __init__(self, use_datetime: bool = ..., context: SSLContext | None = ...) -> None: ...
|
||||
def make_connection(self, host: _hostDesc) -> HTTPSConnection: ...
|
||||
|
||||
class ServerProxy:
|
||||
def __init__(
|
||||
self,
|
||||
uri: str,
|
||||
transport: Optional[Transport] = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
transport: Transport | None = ...,
|
||||
encoding: str | None = ...,
|
||||
verbose: bool = ...,
|
||||
allow_none: bool = ...,
|
||||
use_datetime: bool = ...,
|
||||
context: Optional[SSLContext] = ...,
|
||||
context: SSLContext | None = ...,
|
||||
) -> None: ...
|
||||
def __getattr__(self, name: str) -> _Method: ...
|
||||
def __call__(self, attr: str) -> Optional[Transport]: ...
|
||||
def __call__(self, attr: str) -> Transport | None: ...
|
||||
|
||||
Server = ServerProxy
|
||||
|
||||
Reference in New Issue
Block a user