Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`
(type_: type)
| 535 | |
| 536 | |
| 537 | def is_basemodel(type_: type) -> bool: |
| 538 | """Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`""" |
| 539 | if is_union(type_): |
| 540 | for variant in get_args(type_): |
| 541 | if is_basemodel(variant): |
| 542 | return True |
| 543 | |
| 544 | return False |
| 545 | |
| 546 | return is_basemodel_type(type_) |
| 547 | |
| 548 | |
| 549 | def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericModel]]: |
no test coverage detected