class_docstr: Key binding registry.
docstr: Decorator for annotating key bindings.
  
  :param filter: :class:`~prompt_toolkit.filters.CLIFilter` to determine
      when this key binding is active.
  :param eager: :class:`~prompt_toolkit.filters.CLIFilter` or `bool`.
      When True, ignore potential longer matches when this key binding is
      hit. E.g. when there is an active eager key binding for Ctrl-X,
      execute the handler immediately and ignore the key binding for
      Ctrl-X Ctrl-E of which it is a prefix.
  :param save_before: Callable that takes an `Event` and returns True if
      we should save the current buffer, before handling the event.
      (That's the default.)
docstr_tok: ["Decorator","for","annotating","key","bindings",".",":","param","filter",":",":","class",":","`","~prompt_toolkit.filters.CLIFilter","`","to","determine","when","this","key","binding","is","active",".",":","param","eager",":",":","class",":","`","~prompt_toolkit.filters.CLIFilter","`","or","`","bool","`",".","When","True",",","ignore","potential","longer","matches","when","this","key","binding","is","hit",".","E.g",".","when","there","is","an","active","eager","key","binding","for","Ctrl-X",",","execute","the","handler","immediately","and","ignore","the","key","binding","for","Ctrl-X","Ctrl-E","of","which","it","is","a","prefix",".",":","param","save_before",":","Callable","that","takes","an","`","Event","`","and","returns","True","if","we","should","save","the","current","buffer",",","before","handling","the","event",".","(","That","'s","the","default",".",")"]
code: def add_binding(self, *keys, **kwargs):
      """
      Decorator for annotating key bindings.
  
      :param filter: :class:`~prompt_toolkit.filters.CLIFilter` to determine
          when this key binding is active.
      :param eager: :class:`~prompt_toolkit.filters.CLIFilter` or `bool`.
          When True, ignore potential longer matches when this key binding is
          hit. E.g. when there is an active eager key binding for Ctrl-X,
          execute the handler immediately and ignore the key binding for
          Ctrl-X Ctrl-E of which it is a prefix.
      :param save_before: Callable that takes an `Event` and returns True if
          we should save the current buffer, before handling the event.
          (That's the default.)
      """
      filter = to_cli_filter(kwargs.pop("filter", True))
      eager = to_cli_filter(kwargs.pop("eager", False))
      save_before = kwargs.pop("save_before", lambda e: True)
      to_cli_filter(
          kwargs.pop("invalidate_ui", True)
      )  # Deprecated! (ignored.)
  
      assert not kwargs
      assert keys
      assert all(
          isinstance(k, (Key, text_type)) for k in keys
      ), "Key bindings should consist of Key and string (unicode) instances."
      assert callable(save_before)
  
      if isinstance(filter, Never):
          # When a filter is Never, it will always stay disabled, so in that case
          # don't bother putting it in the registry. It will slow down every key
          # press otherwise.
          def decorator(func):
              return func
  
      else:
  
          def decorator(func):
              self.key_bindings.append(
                  _Binding(
                      keys,
                      func,
                      filter=filter,
                      eager=eager,
                      save_before=save_before,
                  )
              )
              self._clear_cache()
  
              return func
  
      return decorator
  
imports: from __future__ import unicode_literals
  from abc import ABCMeta, abstractmethod
  from prompt_toolkit.cache import SimpleCache
  from prompt_toolkit.filters import CLIFilter, to_cli_filter, Never
  from prompt_toolkit.keys import Key, Keys
  from six import text_type, with_metaclass
label_desc: Use image node_id 3 for calling the Registry obj's underlying member method code with example usage: obj.add_binding() and returns: decorator, func, func