Skip to content

yggdrasil.pickle.ser.annotations

annotations

dump_function_annotations

dump_function_annotations(
    annotations: Mapping[object, object] | None,
) -> tuple[int, dict[str, tuple[str, object]]]

Encode function annotations with per-entry fallback.

Any annotation entry that cannot be nested-serialized is downgraded to a string representation so function payload construction never fails because of annotation recursion/complexity.

load_function_annotations

load_function_annotations(payload: object) -> dict[str, object]

Decode function annotations payload.

Supports both the current encoded format and legacy raw dict payloads. Any malformed entry is downgraded to a string representation instead of raising, keeping function reconstruction resilient.