Skip to content

Commit 6ac2fcd

Browse files
committed
make #4083 compatible with py3.6
1 parent 91a2ffc commit 6ac2fcd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pydantic/generics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131

3232
Parametrization = Mapping[TypeVarType, Type[Any]]
3333

34-
_generic_types_cache: LimitedDict[Tuple[Type[Any], Union[Any, Tuple[Any, ...]]], Type[BaseModel]] = LimitedDict()
34+
_generic_types_cache: 'LimitedDict[Tuple[Type[Any], Union[Any, Tuple[Any, ...]]], Type[BaseModel]]' = LimitedDict()
3535
# _assigned_parameters is a Mapping from parametrized version of generic models to assigned types of parametrizations
3636
# as captured during construction of the class (not instances).
3737
# E.g., for generic model `Model[A, B]`, when parametrized model `Model[int, str]` is created,
3838
# `Model[int, str]`: {A: int, B: str}` will be stored in `_assigned_parameters`.
3939
# (This information is only otherwise available after creation from the class name string).
40-
_assigned_parameters: LimitedDict[Type[Any], Parametrization] = LimitedDict()
40+
_assigned_parameters: 'LimitedDict[Type[Any], Parametrization]' = LimitedDict()
4141

4242

4343
class GenericModel(BaseModel):

pydantic/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,6 @@ def __setitem__(self, __key: Any, __value: Any) -> None:
784784
for key in to_remove:
785785
del self[key]
786786

787-
def __class_getitem__(cls, *args: Any) -> Any:
788-
# to avoid errors with 3.7
787+
def __class_getitem__(cls, *args: Any) -> Any: # pragma: no cover
788+
# just in case LimitedDict is used in type annotations
789789
pass

0 commit comments

Comments
 (0)