Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`
(type_: type)
| 392 | |
| 393 | |
| 394 | def is_basemodel(type_: type) -> bool: |
| 395 | """Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`""" |
| 396 | if is_union(type_): |
| 397 | for variant in get_args(type_): |
| 398 | if is_basemodel(variant): |
| 399 | return True |
| 400 | |
| 401 | return False |
| 402 | |
| 403 | return is_basemodel_type(type_) |
| 404 | |
| 405 | |
| 406 | def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericModel]]: |
no test coverage detected