Skip to content

Commit f701c27

Browse files
committed
Fix various version-specific differences, make request_type conservative (only bytes, guaranteed to have same len as number of bytes)
1 parent d637d13 commit f701c27

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

stdlib/3/xmlrpc/client.pyi

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ class Unmarshaller:
151151
def end_boolean(self, data: str) -> None: ...
152152
def end_int(self, data: str) -> None: ...
153153
def end_double(self, data: str) -> None: ...
154-
def end_bigdecimal(self, data: str) -> None: ...
154+
if sys.version_info >= (3, 6):
155+
def end_bigdecimal(self, data: str) -> None: ...
155156
def end_string(self, data: str) -> None: ...
156157
def end_array(self, data: str) -> None: ...
157158
def end_struct(self, data: str) -> None: ...
@@ -231,15 +232,15 @@ class Transport:
231232
def __init__(self, use_datetime: bool = ..., use_builtin_types: bool = ..., *, headers: Iterable[Tuple[str, str]] = ...) -> None: ...
232233
else:
233234
def __init__(self, use_datetime: bool = ..., use_builtin_types: bool = ...) -> None: ...
234-
def request(self, host: _HostType, handler: str, request_body: Union[bytes, Iterable[bytes], str], verbose: bool = ...) -> Tuple[_Marshallable, ...]: ...
235-
def single_request(self, host: _HostType, handler: str, request_body: Union[bytes, Iterable[bytes], str], verbose: bool = ...) -> Tuple[_Marshallable, ...]: ...
235+
def request(self, host: _HostType, handler: str, request_body: bytes, verbose: bool = ...) -> Tuple[_Marshallable, ...]: ...
236+
def single_request(self, host: _HostType, handler: str, request_body: bytes, verbose: bool = ...) -> Tuple[_Marshallable, ...]: ...
236237
def getparser(self) -> Tuple[ExpatParser, Unmarshaller]: ...
237238
def get_host_info(self, host: _HostType) -> Tuple[str, List[Tuple[str, str]], Dict[str, str]]: ...
238239
def make_connection(self, host: _HostType) -> http.client.HTTPConnection: ...
239240
def close(self) -> None: ...
240-
def send_request(self, host: _HostType, handler: str, request_body: Union[bytes, Iterable[bytes], str], debug: bool) -> http.client.HTTPConnection: ...
241+
def send_request(self, host: _HostType, handler: str, request_body: bytes, debug: bool) -> http.client.HTTPConnection: ...
241242
def send_headers(self, connection: http.client.HTTPConnection, headers: List[Tuple[str, str]]) -> None: ...
242-
def send_content(self, connection: http.client.HTTPConnection, request_body: Union[bytes, Iterable[bytes], str]) -> None: ...
243+
def send_content(self, connection: http.client.HTTPConnection, request_body: bytes) -> None: ...
243244
def parse_response(self, response: http.client.HTTPResponse) -> Tuple[_Marshallable, ...]: ...
244245

245246
class SafeTransport(Transport):
@@ -259,7 +260,10 @@ class ServerProxy:
259260
__verbose: bool
260261
__allow_none: bool
261262

262-
def __init__(self, uri, transport: Optional[Transport] = ..., encoding: Optional[str] = ..., verbose: bool = ..., allow_none: bool = ..., use_datetime: bool = ..., use_builtin_types: bool = ..., *, headers: Iterable[Tuple[str, str]] = ..., context: Optional[Any] = ...) -> None: ...
263+
if sys.version_info >= (3, 8):
264+
def __init__(self, uri, transport: Optional[Transport] = ..., encoding: Optional[str] = ..., verbose: bool = ..., allow_none: bool = ..., use_datetime: bool = ..., use_builtin_types: bool = ..., *, headers: Iterable[Tuple[str, str]] = ..., context: Optional[Any] = ...) -> None: ...
265+
else:
266+
def __init__(self, uri, transport: Optional[Transport] = ..., encoding: Optional[str] = ..., verbose: bool = ..., allow_none: bool = ..., use_datetime: bool = ..., use_builtin_types: bool = ..., *, context: Optional[Any] = ...) -> None: ...
263267
def __getattr__(self, name: str) -> _Method: ...
264268
@overload
265269
def __call__(self, attr: Literal["close"]) -> Callable[[], None]: ...

stdlib/3/xmlrpc/server.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import http.server
22
import socketserver
33
import pydoc
4+
import sys
45

56
from xmlrpc.client import Fault
67
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Pattern, Protocol, Tuple, Type, Union
@@ -23,7 +24,10 @@ class SimpleXMLRPCDispatcher: # undocumented
2324

2425
def __init__(self, allow_none: bool = ..., encoding: Optional[str] = ..., use_builtin_types: bool = ...) -> None: ...
2526
def register_instance(self, instance: Any, allow_dotted_names: bool = ...) -> None: ...
26-
def register_function(self, function: Optional[_DispatchProtocol] = ..., name: Optional[str] = ...) -> Callable[..., Any]: ...
27+
if sys.version_info >= (3, 7):
28+
def register_function(self, function: Optional[_DispatchProtocol] = ..., name: Optional[str] = ...) -> Callable[..., Any]: ...
29+
else:
30+
def register_function(self, funciton: _DispatchProtocol, name: Optional[str] = ...) -> Callable[..., Any]: ...
2731
def register_introspection_functions(self) -> None: ...
2832
def register_multicall_functions(self) -> None: ...
2933
def _marshaled_dispatch(self, data: str, dispatch_method: Optional[Callable[[Optional[str], Tuple[_Marshallable, ...]], Union[Fault, Tuple[_Marshallable, ...]]]] = ..., path: Optional[Any] = ...) -> str: ... # undocumented

0 commit comments

Comments
 (0)