MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / is_origin_of_cls

Function is_origin_of_cls

lib/sqlalchemy/util/typing.py:585–595  ·  view source on GitHub ↗

return True if the given type has an __origin__ that shares a base with the given class

(
    type_: Any, class_obj: Union[Tuple[Type[Any], ...], Type[Any]]
)

Source from the content-addressed store, hash-verified

583
584
585def is_origin_of_cls(
586 type_: Any, class_obj: Union[Tuple[Type[Any], ...], Type[Any]]
587) -> bool:
588 """return True if the given type has an __origin__ that shares a base
589 with the given class"""
590
591 origin = get_origin(type_)
592 if origin is None:
593 return False
594
595 return isinstance(origin, type) and issubclass(origin, class_obj)
596
597
598def is_origin_of(

Callers 2

_is_mapped_annotationFunction · 0.85
_extract_mapped_subtypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected