mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Fix _DispatchProtocol in xmlrpc.server (#4165)
This commit is contained in:
@@ -7,9 +7,23 @@ from xmlrpc.client import Fault
|
||||
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Pattern, Protocol, Tuple, Type, Union
|
||||
from datetime import datetime
|
||||
|
||||
_Marshallable = Union[None, bool, int, float, str, bytes, tuple, list, dict, datetime]
|
||||
class _DispatchProtocol(Protocol):
|
||||
_Marshallable = Union[None, bool, int, float, str, bytes, tuple, list, dict, datetime] # TODO: Recursive type on tuple, list, dict
|
||||
|
||||
# The dispatch accepts anywhere from 0 to N arguments, no easy way to allow this in mypy
|
||||
class _DispatchArity0(Protocol):
|
||||
def __call__(self) -> _Marshallable: ...
|
||||
class _DispatchArity1(Protocol):
|
||||
def __call__(self, __arg1: _Marshallable) -> _Marshallable: ...
|
||||
class _DispatchArity2(Protocol):
|
||||
def __call__(self, __arg1: _Marshallable, __arg2: _Marshallable) -> _Marshallable: ...
|
||||
class _DispatchArity3(Protocol):
|
||||
def __call__(self, __arg1: _Marshallable, __arg2: _Marshallable, __arg3: _Marshallable) -> _Marshallable: ...
|
||||
class _DispatchArity4(Protocol):
|
||||
def __call__(self, __arg1: _Marshallable, __arg2: _Marshallable, __arg3: _Marshallable, __arg4: _Marshallable) -> _Marshallable: ...
|
||||
class _DispatchArityN(Protocol):
|
||||
def __call__(self, *args: _Marshallable) -> _Marshallable: ...
|
||||
_DispatchProtocol = Union[_DispatchArity0, _DispatchArity1, _DispatchArity2, _DispatchArity3, _DispatchArity4, _DispatchArityN]
|
||||
|
||||
|
||||
def resolve_dotted_attribute(obj: Any, attr: str, allow_dotted_names: bool = ...) -> Any: ... # undocumented
|
||||
def list_public_methods(obj: Any) -> List[str]: ... # undocumented
|
||||
|
||||
Reference in New Issue
Block a user