Use PEP 585 syntax wherever possible (#6717)

This commit is contained in:
Alex Waygood
2021-12-28 10:31:43 +00:00
committed by GitHub
parent e6cb341d94
commit 8d5d2520ac
237 changed files with 966 additions and 1069 deletions

View File

@@ -3,11 +3,11 @@ import pydoc
import socketserver
import sys
from datetime import datetime
from typing import Any, Callable, Dict, Iterable, List, Mapping, Pattern, Protocol, Tuple, Type, Union
from typing import Any, Callable, Iterable, Mapping, Pattern, Protocol, Type, Union
from xmlrpc.client import Fault
# TODO: Recursive type on tuple, list, dict
_Marshallable = Union[None, bool, int, float, str, bytes, Tuple[Any, ...], List[Any], Dict[Any, Any], datetime]
_Marshallable = Union[None, bool, int, float, str, bytes, tuple[Any, ...], list[Any], dict[Any, Any], datetime]
# The dispatch accepts anywhere from 0 to N arguments, no easy way to allow this in mypy
class _DispatchArity0(Protocol):
@@ -53,7 +53,7 @@ class SimpleXMLRPCDispatcher: # undocumented
def _marshaled_dispatch(
self,
data: str,
dispatch_method: Callable[[str | None, Tuple[_Marshallable, ...]], Fault | Tuple[_Marshallable, ...]] | None = ...,
dispatch_method: Callable[[str | None, tuple[_Marshallable, ...]], Fault | tuple[_Marshallable, ...]] | None = ...,
path: Any | None = ...,
) -> str: ... # undocumented
def system_listMethods(self) -> list[str]: ... # undocumented
@@ -109,7 +109,7 @@ class MultiPathXMLRPCServer(SimpleXMLRPCServer): # undocumented
def _marshaled_dispatch(
self,
data: str,
dispatch_method: Callable[[str | None, Tuple[_Marshallable, ...]], Fault | Tuple[_Marshallable, ...]] | None = ...,
dispatch_method: Callable[[str | None, tuple[_Marshallable, ...]], Fault | tuple[_Marshallable, ...]] | None = ...,
path: Any | None = ...,
) -> str: ...