in chz/tiepin.py [0:0]
def _simplistic_type_of_value(value: object) -> TypeForm:
# TODO: maybe remove this? Its current use is in diagnostics (for providing the actual type),
# but is_subtype_instance is in a position to provide better diagnostics
if hasattr(type(value), "__class_getitem__"):
if isinstance(value, collections.abc.Mapping) and typing.Generic not in type(value).__mro__:
return type(value)[
simplified_union([_simplistic_type_of_value(k) for k in value.keys()]),
simplified_union([_simplistic_type_of_value(v) for v in value.values()]),
]
if isinstance(value, tuple):
if len(value) <= 10:
return type(value)[tuple(_simplistic_type_of_value(v) for v in value)]
return type(value)[simplified_union([_simplistic_type_of_value(v) for v in value]), ...]
if (
isinstance(value, collections.abc.Iterable)
and typing.Generic not in type(value).__mro__
):
return type(value)[simplified_union([_simplistic_type_of_value(v) for v in value])]
if isinstance(value, type):
return type[value]
return type(value)