Replace Mapping with types.MappingProxyType (#6013)

Mark `Signature.parameters` and `.return_annotation` as read-only properties
This commit is contained in:
Bas van Beek
2021-09-09 09:58:53 +02:00
committed by GitHub
parent 6188a3eec7
commit b9e1d7d522
5 changed files with 16 additions and 26 deletions

View File

@@ -1,21 +1,7 @@
import sys
import types
from _typeshed import SupportsItems, SupportsLessThan
from typing import (
Any,
Callable,
Generic,
Hashable,
Iterable,
Mapping,
NamedTuple,
Sequence,
Set,
Sized,
Tuple,
Type,
TypeVar,
overload,
)
from typing import Any, Callable, Generic, Hashable, Iterable, NamedTuple, Sequence, Set, Sized, Tuple, Type, TypeVar, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -86,7 +72,7 @@ class partialmethod(Generic[_T]):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
class _SingleDispatchCallable(Generic[_T]):
registry: Mapping[Any, Callable[..., _T]]
registry: types.MappingProxyType[Any, Callable[..., _T]]
def dispatch(self, cls: Any) -> Callable[..., _T]: ...
# @fun.register(complex)
# def _(arg, verbose=False): ...