Skip to content

Commit

Permalink
Use MutableMapping instead of Dict for mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Nov 8, 2022
1 parent 4d7d18e commit d741490
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions fastapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
import warnings
from dataclasses import is_dataclass
from enum import Enum
from typing import TYPE_CHECKING, Any, Dict, Optional, Set, Type, Union, cast
from typing import (
TYPE_CHECKING,
Any,
Dict,
MutableMapping,
Optional,
Set,
Type,
Union,
cast,
)
from weakref import WeakKeyDictionary

import fastapi
Expand Down Expand Up @@ -97,7 +107,7 @@ def create_cloned_field(
field: ModelField,
*,
cloned_types: Optional[
Dict[Type[BaseModel], Type[BaseModel]]
MutableMapping[Type[BaseModel], Type[BaseModel]]
] = WeakKeyDictionary(),
) -> ModelField:
# cloned_types caches already cloned types to support recursive models and improve
Expand Down

0 comments on commit d741490

Please sign in to comment.