diff options
Diffstat (limited to 'src/prompt_toolkit/key_binding/key_bindings.py')
-rw-r--r-- | src/prompt_toolkit/key_binding/key_bindings.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/prompt_toolkit/key_binding/key_bindings.py b/src/prompt_toolkit/key_binding/key_bindings.py index 62530f2..854da80 100644 --- a/src/prompt_toolkit/key_binding/key_bindings.py +++ b/src/prompt_toolkit/key_binding/key_bindings.py @@ -34,6 +34,7 @@ been assigned, through the `key_binding` decorator.:: # Later, add it to the key bindings. kb.add(Keys.A, my_key_binding) """ + from __future__ import annotations from abc import ABCMeta, abstractmethod, abstractproperty @@ -140,10 +141,8 @@ class Binding: event.app.invalidate() def __repr__(self) -> str: - return "{}(keys={!r}, handler={!r})".format( - self.__class__.__name__, - self.keys, - self.handler, + return ( + f"{self.__class__.__name__}(keys={self.keys!r}, handler={self.handler!r})" ) @@ -226,9 +225,9 @@ class KeyBindings(KeyBindingsBase): def __init__(self) -> None: self._bindings: list[Binding] = [] - self._get_bindings_for_keys_cache: SimpleCache[ - KeysTuple, list[Binding] - ] = SimpleCache(maxsize=10000) + self._get_bindings_for_keys_cache: SimpleCache[KeysTuple, list[Binding]] = ( + SimpleCache(maxsize=10000) + ) self._get_bindings_starting_with_keys_cache: SimpleCache[ KeysTuple, list[Binding] ] = SimpleCache(maxsize=1000) |