diff options
author | arcadia-devtools <[email protected]> | 2022-02-12 14:35:15 +0300 |
---|---|---|
committer | arcadia-devtools <[email protected]> | 2022-02-12 14:35:15 +0300 |
commit | 46a8b83899dd321edf511c0483f9c479ce2c1bc4 (patch) | |
tree | e5debc03beecbd10e7d1bf78c889c8d54e8c4523 /contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding | |
parent | b56bbcc9f63bf31991a8aa118555ce0c12875a74 (diff) |
intermediate changes
ref:7c971b97c72bbbcbf889118d39017bd14f99365a
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding')
4 files changed, 9 insertions, 11 deletions
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/completion.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/completion.py index e52edf87ffe..a30b54e632d 100644 --- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/completion.py +++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/completion.py @@ -146,7 +146,7 @@ def _display_completions_like_readline( if len(completions) > completions_per_page: # Ask confirmation if it doesn't fit on the screen. confirm = await create_confirm_session( - "Display all {} possibilities?".format(len(completions)), + f"Display all {len(completions)} possibilities?", ).prompt_async() if confirm: diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/digraphs.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/digraphs.py index 70606086aa3..ad3d288a8a3 100644 --- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/digraphs.py +++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/digraphs.py @@ -1,4 +1,3 @@ -# encoding: utf-8 """ Vi Digraphs. This is a list of special characters that can be inserted in Vi insert mode by diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/key_bindings.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/key_bindings.py index 06ca376b094..03bc79ef01d 100644 --- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/key_bindings.py +++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/key_bindings.py @@ -138,7 +138,7 @@ class Binding: event.app.invalidate() def __repr__(self) -> str: - return "%s(keys=%r, handler=%r)" % ( + return "{}(keys={!r}, handler={!r})".format( self.__class__.__name__, self.keys, self.handler, @@ -359,7 +359,7 @@ class KeyBindings(KeyBindingsBase): self._clear_cache() else: # No key binding found for this function. Raise ValueError. - raise ValueError("Binding not found: %r" % (function,)) + raise ValueError(f"Binding not found: {function!r}") # For backwards-compatibility. add_binding = add @@ -449,7 +449,7 @@ def _parse_key(key: Union[Keys, str]) -> Union[str, Keys]: # Final validation. if len(key) != 1: - raise ValueError("Invalid key: %s" % (key,)) + raise ValueError(f"Invalid key: {key}") return key diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/key_processor.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/key_processor.py index 476393c1eee..6fdd5191791 100644 --- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/key_processor.py +++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/key_processor.py @@ -1,4 +1,3 @@ -# *** encoding: utf-8 *** """ An :class:`~.KeyProcessor` receives callbacks for the keystrokes parsed from the input in the :class:`~prompt_toolkit.inputstream.InputStream` instance. @@ -50,7 +49,7 @@ class KeyPress: self.data = data def __repr__(self) -> str: - return "%s(key=%r, data=%r)" % (self.__class__.__name__, self.key, self.data) + return f"{self.__class__.__name__}(key={self.key!r}, data={self.data!r})" def __eq__(self, other: object) -> bool: if not isinstance(other, KeyPress): @@ -137,9 +136,9 @@ class KeyProcessor: # Note that we transform it into a `set`, because we don't care about # the actual bindings and executing it more than once doesn't make # sense. (Many key bindings share the same filter.) - filters = set( + filters = { b.filter for b in self._bindings.get_bindings_starting_with_keys(keys) - ) + } # When any key binding is active, return True. return any(f() for f in filters) @@ -450,7 +449,7 @@ class KeyPressEvent: self._app = get_app() def __repr__(self) -> str: - return "KeyPressEvent(arg=%r, key_sequence=%r, is_repeat=%r)" % ( + return "KeyPressEvent(arg={!r}, key_sequence={!r}, is_repeat={!r})".format( self.arg, self.key_sequence, self.is_repeat, @@ -519,7 +518,7 @@ class KeyPressEvent: elif current is None: result = data else: - result = "%s%s" % (current, data) + result = f"{current}{data}" self.key_processor.arg = result |