Skip to content

Commit

Permalink
chore: improve mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
PrettyWood committed Dec 23, 2020
1 parent 0f5cb59 commit d472bf0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pydantic/validators.py
Expand Up @@ -50,6 +50,11 @@
Number = Union[int, float, Decimal]
StrBytes = Union[str, bytes]

class TypedDict(Dict[str, Any]):
__annotations__: Dict[str, Type[Any]]
__required_keys__: FrozenSet[str]
__optional_keys__: FrozenSet[str]


def str_validator(v: Any) -> Union[str]:
if isinstance(v, str):
Expand Down Expand Up @@ -549,7 +554,7 @@ def named_tuple_validator(values: Tuple[Any, ...]) -> NamedTupleT:
return named_tuple_validator


def make_typed_dict_validator(type_: Type[Dict[str, Any]]) -> Callable[[Any], Dict[str, Any]]:
def make_typed_dict_validator(type_: Type['TypedDict']) -> Callable[[Any], Dict[str, Any]]:
from .main import create_model

field_definitions: Dict[str, Any] = {
Expand Down

0 comments on commit d472bf0

Please sign in to comment.