INNER CODE UNIT · Python

_mapping_value

christopherkarani/Wax · Resources/hermes/wax-memory-plugin/cli.py:105

def _mapping_value(mapping: str, key: str) -> Optional[str]:
    stripped = mapping.strip()
    if stripped.startswith("{"):
        for item in _split_flow(stripped):
            pair = _mapping_pair(item)
            if pair and pair[0] == key:
                return pair[1]
        return None

    lines = mapping.splitlines()
    indents = [len(line) - len(line.lstrip()) for line in lines if line.strip()]
    if not indents:
        return None
    entry_indent = min(indents)
    for index, line in enumerate(lines):
        if not line.strip() or len(line) - len(line.lstrip()) != entry_indent:
            continue
        pair = _mapping_pair(line.strip())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…