MCPcopy Index your code
hub / github.com/ipython/ipython / bindings_from_prompt_toolkit

Function bindings_from_prompt_toolkit

docs/autogen_shortcuts.py:119–138  ·  view source on GitHub ↗

Collect bindings to a simple format that does not depend on prompt-toolkit internals

(prompt_bindings: KeyBindingsBase)

Source from the content-addressed store, hash-verified

117
118
119def 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
141INDISTINGUISHABLE_KEYS = {**KEY_ALIASES, **{v: k for k, v in KEY_ALIASES.items()}}

Callers 1

Calls 5

create_identifierFunction · 0.90
HandlerClass · 0.85
ShortcutClass · 0.85
format_filterFunction · 0.85
BindingClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…