flat_path_dict

Contents

flat_path_dict#

seli.flat_path_dict(obj: None | bool | int | float | str | type | Array | ShapeDtypeStruct | list | dict | Module | Any)[source]#

Convert a nested object structure into a flat dictionary representation.

This function transforms a potentially nested object into a flat dictionary where:

  • Each entry is keyed by a PathKey representing its location in the original structure

  • Leaf values and PathKey references are preserved directly

  • For non-leaf nodes, their class name is stored under a __class__ attribute key

The resulting dictionary provides a serializable, deterministic representation of the objects structure that preserves paths and type information.

Parameters:

obj (NodeType) – The object to convert to a flat path dictionary

Returns:

A dictionary mapping PathKey objects to values, sorted by path for deterministic output

Return type:

dict[PathKey, NodeType]