technically it has to be a mapping, not specifically a dict

This commit is contained in:
Khaleel Al-Adhami 2024-11-11 13:06:25 -08:00
parent 3cbebec9e7
commit c6c56f3169

View File

@ -18,6 +18,7 @@ from typing import (
Iterable, Iterable,
List, List,
Literal, Literal,
Mapping,
Optional, Optional,
Sequence, Sequence,
Tuple, Tuple,
@ -523,7 +524,7 @@ def does_obj_satisfy_typed_dict(obj: Any, cls: GenericType) -> bool:
Returns: Returns:
Whether the object satisfies the typed dict. Whether the object satisfies the typed dict.
""" """
if not isinstance(obj, dict): if not isinstance(obj, Mapping):
return False return False
key_names_to_values = get_type_hints(cls) key_names_to_values = get_type_hints(cls)