def read_key_bindings()

in src/pathpicker/key_bindings.py [0:0]


def read_key_bindings(key_bindings_file: str = KEY_BINDINGS_FILE) -> KeyBindings:
    """Returns configured key bindings, in the format [(key, command), ...].
    The ordering of the entries is not guaranteed, although it's irrelevant
    to the purpose.
    """
    config_file_path = os.path.expanduser(key_bindings_file)
    parser = configparser.ConfigParser()
    parser.read(config_file_path)

    bindings = KeyBindings([])
    if parser.has_section("bindings"):
        bindings = KeyBindings(parser.items("bindings"))
    return bindings