Skip to content

kiara.data.types.type_mgmt

TypeMgmt

get_type_lineage(self, value_type)

Returns the shortest path between the specified type and the 'any' type, in reverse direction starting from the specified type.

Source code in kiara/data/types/type_mgmt.py
def get_type_lineage(self, value_type: str) -> typing.Iterable[str]:
    """Returns the shortest path between the specified type and the 'any' type, in reverse direction starting from the specified type."""

    if value_type not in self.value_types.keys():
        raise Exception(f"No value type '{value_type}' registered.")

    import networkx as nx

    path = nx.shortest_path(self.value_type_hierarchy, "any", value_type)
    return reversed(path)