Flatten an exception and any ExceptionGroup members it wraps.
(exc: BaseException)
| 31 | |
| 32 | |
| 33 | def _causes(exc: BaseException) -> list[BaseException]: |
| 34 | """Flatten an exception and any ExceptionGroup members it wraps.""" |
| 35 | inner = getattr(exc, "exceptions", None) |
| 36 | if inner is None: |
| 37 | return [exc] |
| 38 | return [exc, *(c for e in inner for c in _causes(e))] |
| 39 | |
| 40 | |
| 41 | def fake_session( |
nothing calls this directly
no outgoing calls
no test coverage detected