isinstance can fail in rare cases, for example types with no __class__
(
obj: object, class_or_tuple: Union[type, Tuple[type, ...]]
)
| 159 | |
| 160 | |
| 161 | def _safe_isinstance( |
| 162 | obj: object, class_or_tuple: Union[type, Tuple[type, ...]] |
| 163 | ) -> bool: |
| 164 | """isinstance can fail in rare cases, for example types with no __class__""" |
| 165 | try: |
| 166 | return isinstance(obj, class_or_tuple) |
| 167 | except Exception: |
| 168 | return False |
| 169 | |
| 170 | |
| 171 | def install( |
no outgoing calls
no test coverage detected