From 2dddfa43c8137d73d062851bb0cf0c00c313e244 Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Thu, 19 May 2022 10:52:57 +0100 Subject: [PATCH] make #4083 compatible with py3.6 --- pydantic/generics.py | 4 ++-- pydantic/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pydantic/generics.py b/pydantic/generics.py index 2467bb77111..1ec9a7da081 100644 --- a/pydantic/generics.py +++ b/pydantic/generics.py @@ -31,13 +31,13 @@ Parametrization = Mapping[TypeVarType, Type[Any]] -_generic_types_cache: LimitedDict[Tuple[Type[Any], Union[Any, Tuple[Any, ...]]], Type[BaseModel]] = LimitedDict() +_generic_types_cache: 'LimitedDict[Tuple[Type[Any], Union[Any, Tuple[Any, ...]]], Type[BaseModel]]' = LimitedDict() # _assigned_parameters is a Mapping from parametrized version of generic models to assigned types of parametrizations # as captured during construction of the class (not instances). # E.g., for generic model `Model[A, B]`, when parametrized model `Model[int, str]` is created, # `Model[int, str]`: {A: int, B: str}` will be stored in `_assigned_parameters`. # (This information is only otherwise available after creation from the class name string). -_assigned_parameters: LimitedDict[Type[Any], Parametrization] = LimitedDict() +_assigned_parameters: 'LimitedDict[Type[Any], Parametrization]' = LimitedDict() class GenericModel(BaseModel): diff --git a/pydantic/utils.py b/pydantic/utils.py index f9c4ec16022..b06bfdc1590 100644 --- a/pydantic/utils.py +++ b/pydantic/utils.py @@ -784,6 +784,6 @@ def __setitem__(self, __key: Any, __value: Any) -> None: for key in to_remove: del self[key] - def __class_getitem__(cls, *args: Any) -> Any: - # to avoid errors with 3.7 + def __class_getitem__(cls, *args: Any) -> Any: # pragma: no cover + # just in case LimitedDict is used in type annotations pass