INNER CODE UNIT · Python

resolve_keymap

Kohei-Wada/taskdog · packages/taskdog-ui/src/taskdog/tui/app.py:63

def resolve_keymap(
    config_keybindings: dict[str, str], valid_ids: set[str]
) -> tuple[dict[str, str], list[str]]:
    """Split user keybindings into a Textual keymap and unknown binding ids.

    Entries whose id matches a real binding become a keymap (binding id -> key)
    passed to ``App.set_keymap``; unrecognised ids are returned separately so the
    caller can warn and fall back to the default keys.
    """
    keymap: dict[str, str] = {}
    unknown: list[str] = []
    for binding_id, key in config_keybindings.items():
        if binding_id in valid_ids:
            keymap[binding_id] = key
        else:
            unknown.append(binding_id)
    return keymap, unknown

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…