MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / is_origin_of

Function is_origin_of

lib/sqlalchemy/util/typing.py:598–610  ·  view source on GitHub ↗

return True if the given type has an __origin__ with the given name and optional module.

(
    type_: Any, *names: str, module: Optional[str] = None
)

Source from the content-addressed store, hash-verified

596
597
598def is_origin_of(
599 type_: Any, *names: str, module: Optional[str] = None
600) -> bool:
601 """return True if the given type has an __origin__ with the given name
602 and optional module."""
603
604 origin = get_origin(type_)
605 if origin is None:
606 return False
607
608 return origin.__name__ in names and (
609 module is None or origin.__module__.startswith(module)
610 )
611
612
613class DescriptorProto(Protocol):

Callers 1

is_unionFunction · 0.85

Calls 1

startswithMethod · 0.45

Tested by

no test coverage detected