bundles / papyri latest / papyri / node_base / _coerce_field
function
papyri.node_base:_coerce_field
source: /papyri/node_base.py :25
Signature
def _coerce_field ( ann : Any , val : Any ) → Any Summary
Coerce val to the mutable→immutable type the annotation requires.
Extended Summary
Node fields annotated as tuple[T, ...] must be tuples at runtime so that cbor2 ≥ 6 (which decodes CBOR arrays inside tagged values as tuples) and code that passes plain Python lists both produce the same stored type.
Also handles Optional[tuple[T, ...]] (i.e. tuple[T, ...] | None).
Aliases
-
papyri.node_base._coerce_field