def _load_result()

in project/nanoeval/nanoeval/monitor.py [0:0]


def _load_result(data: bytes | None) -> Any:
    from nanoeval._executor_worker import ExecutorExceptionWrapper

    if data is None:
        return None

    try:
        deserialized = dill.loads(data)
    except ArrowInvalid:
        logger.warning("Failed to deserialize result, returning None", exc_info=True)
        return None
    if isinstance(deserialized, ExecutorExceptionWrapper):
        return deserialized.traceback

    return deserialized