Skip to main content

infrahub_sdk.node.parsers

Functions

parse_human_friendly_id

parse_human_friendly_id(hfid: str | list[str]) -> tuple[str | None, list[str]]

Parse a human-friendly ID into a kind and an identifier.

Accepts the HFID either as a separator-joined string ("Kind__part1__part2") or as a list of components. When a string is provided, the first component is treated as the node kind only when more than one component is present.

Args:

  • hfid: The HFID to parse, either as a separator-joined string or as a list of components.

Returns:

  • tuple[str | None, list[str]]: A tuple of (kind, identifier_components). kind is
  • None when no kind prefix is present (single-component string or list input).

Raises:

  • ValueError: If hfid is neither a string nor a list.