vibe.path_utils

Path parsing utilities for NestedValue access.

Provides cached path parsing for dot-notation paths with bracket indexing.

parse_path

parse_path(path_str: str) -> ParsedPath

Parse a path string with dots and brackets into a tuple of parts.

Examples:

"items[0]" -> ("items", 0) "nested_list[1].name" -> ("nested_list", 1, "name") "simple.path" -> ("simple", "path") "a.b.c" -> ("a", "b", "c") "items[0][1]" -> ("items", 0, 1)

Parameters:
  • path_str (str) –

    Dot-separated path with optional bracket notation

Returns:
  • ParsedPath

    Tuple of path parts (strings for keys, ints for indices)

path_to_string

path_to_string(parts: ParsedPath) -> str

Convert a parsed path back to string representation.

Examples:

("items", 0) -> "items[0]" ("nested_list", 1, "name") -> "nested_list[1].name" ("a", "b", "c") -> "a.b.c"

Parameters:
  • parts (ParsedPath) –

    Tuple of path parts

Returns:
  • str

    String representation of the path