repr_util⚓︎
YAML-based repr mixin for structured objects.
Compared to bare yaml.dump(), this module adds:
- numpy support: 1-D arrays serialise as inline lists; N-D arrays use
block literal style (
|) so they render likestr(arr)without truncating to a single line. - numpy scalar support:
np.int64etc. are unwrapped to Python scalars instead of emitting a!!python/object/applytag. YamlReprmixin: gives any class a__repr__driven by_repr_fields()— override that method to control which fields appear and under what names.- nested
YamlReprobjects: registered viaadd_multi_representerso they inline naturally when nested inside another. - unknown-type fallback: anything without a representer falls back to
repr(obj)as a plain string, rather than raisingRepresenterError.