def raise_flattened_exception_group()

in context.py [0:0]


def raise_flattened_exception_group(exception: Exception):
  e = exception
  while isinstance(e, ExceptionGroup):
    e = e.exceptions[0]
  if e is exception:
    raise exception
  else:
    raise e from exception