return True if the given type has an __origin__ with the given name and optional module.
(
type_: Any, *names: str, module: Optional[str] = None
)
| 596 | |
| 597 | |
| 598 | def 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 | |
| 613 | class DescriptorProto(Protocol): |