

@property
def add_key_binding(self):
    '\n        Shortcut for adding new key bindings.\n        (Mostly useful for a .ptpython/config.py file, that receives\n        a PythonInput/Repl instance as input.)\n\n        ::\n\n            @python_input.add_key_binding(Keys.ControlX, filter=...)\n            def handler(event):\n                ...\n        '
    sidebar_visible = Condition((lambda cli: self.show_sidebar))

    def add_binding_decorator(*keys, **kw):
        filter = kw.pop('filter', Always())
        assert (not kw)
        return self.key_bindings_registry.add_binding(*keys, filter=(filter & (~ sidebar_visible)))
    return add_binding_decorator

dataset/ETHPy150Open jonathanslenders/ptpython/ptpython/python_input.py PythonInput.add_key_binding/original