Collect bindings to a simple format that does not depend on prompt-toolkit internals
(prompt_bindings: KeyBindingsBase)
| 117 | |
| 118 | |
| 119 | def bindings_from_prompt_toolkit(prompt_bindings: KeyBindingsBase) -> List[Binding]: |
| 120 | """Collect bindings to a simple format that does not depend on prompt-toolkit internals""" |
| 121 | bindings: List[Binding] = [] |
| 122 | |
| 123 | for kb in prompt_bindings.bindings: |
| 124 | bindings.append( |
| 125 | Binding( |
| 126 | handler=Handler( |
| 127 | description=kb.handler.__doc__ or "", |
| 128 | identifier=create_identifier(kb.handler), |
| 129 | ), |
| 130 | shortcut=Shortcut( |
| 131 | keys_sequence=[ |
| 132 | str(k.value) if hasattr(k, "value") else k for k in kb.keys |
| 133 | ], |
| 134 | filter=format_filter(kb.filter, skip={"has_focus_filter"}), |
| 135 | ), |
| 136 | ) |
| 137 | ) |
| 138 | return bindings |
| 139 | |
| 140 | |
| 141 | INDISTINGUISHABLE_KEYS = {**KEY_ALIASES, **{v: k for k, v in KEY_ALIASES.items()}} |
no test coverage detected
searching dependent graphs…