INNER CODE UNIT · Python

_tokenize_path

llm-d/llm-d · scripts/guide.py:255

def _tokenize_path(path: str) -> list[str | int]:
    tokens: list[str | int] = []
    last = 0
    for m in _PATH_TOKEN.finditer(path):
        if m.start() > last:
            tokens.append(path[last : m.start()])
        if m.group(1) is not None:
            tokens.append(int(m.group(1)))
        last = m.end()
    if last < len(path):
        tokens.append(path[last:])
    return [t for t in tokens if t != ""]


def resolve_path(guide: Any, path: str) -> tuple[bool, Any, str]:
    """Resolve a dotted/indexed marker path against the parsed YAML.

    Returns ``(found, value, error_message)``. A single resolver replaces the

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…