summaryrefslogtreecommitdiff
path: root/poezio/windows/inputs.py
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2020-12-12 18:44:37 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2020-12-12 19:36:18 +0100
commit65b8046fe08a19df937068e5fe5ad15f9b0a785a (patch)
tree827e17a99d39c5db453d0fc0e9b46249292aa4e3 /poezio/windows/inputs.py
parent34ec9e3ee1384506b2e803bdfe94201a7b7ff4c3 (diff)
downloadpoezio-65b8046fe08a19df937068e5fe5ad15f9b0a785a.tar.gz
poezio-65b8046fe08a19df937068e5fe5ad15f9b0a785a.tar.bz2
poezio-65b8046fe08a19df937068e5fe5ad15f9b0a785a.tar.xz
poezio-65b8046fe08a19df937068e5fe5ad15f9b0a785a.zip
from __future__ import annotations
Now that our baseline is Python 3.7, we can rely on type annotations to be lazily evaluated.
Diffstat (limited to 'poezio/windows/inputs.py')
-rw-r--r--poezio/windows/inputs.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/poezio/windows/inputs.py b/poezio/windows/inputs.py
index 5cca8803..b3601913 100644
--- a/poezio/windows/inputs.py
+++ b/poezio/windows/inputs.py
@@ -41,7 +41,7 @@ class Input(Win):
# it easy cut and paste text between various input
def __init__(self) -> None:
- self.key_func = {
+ self.key_func: Dict[str, Callable] = {
"KEY_LEFT": self.key_left,
"KEY_RIGHT": self.key_right,
"KEY_END": self.key_end,
@@ -66,7 +66,7 @@ class Input(Win):
'^?': self.key_backspace,
"M-^?": self.delete_word,
# '^J': self.add_line_break,
- } # type: Dict[str, Callable]
+ }
Win.__init__(self)
self.text = ''
self.pos = 0 # The position of the “cursor” in the text
@@ -76,8 +76,8 @@ class Input(Win):
# screen
self.on_input = DEFAULT_ON_INPUT # callback called on any key pressed
self.color = None # use this color on addstr
- self.last_completion = None # type: Optional[str]
- self.hit_list = [] # type: List[str]
+ self.last_completion: Optional[str] = None
+ self.hit_list: List[str] = []
def on_delete(self) -> None:
"""
@@ -592,7 +592,7 @@ class HistoryInput(Input):
"""
__slots__ = ('help_message', 'histo_pos', 'current_completed', 'search')
- history = [] # type: List[str]
+ history: List[str] = []
def __init__(self) -> None:
Input.__init__(self)
@@ -603,7 +603,7 @@ class HistoryInput(Input):
self.search = False
if config.get('separate_history'):
# pylint: disable=assigning-non-slot
- self.history = [] # type: List[str]
+ self.history: List[str] = []
def toggle_search(self) -> None:
if self.help_message:
@@ -680,7 +680,7 @@ class MessageInput(HistoryInput):
Also letting the user enter colors or other text markups
"""
# The history is common to all MessageInput
- history = [] # type: List[str]
+ history: List[str] = []
def __init__(self) -> None:
HistoryInput.__init__(self)
@@ -726,7 +726,7 @@ class CommandInput(HistoryInput):
HelpMessage when a command is started
The on_input callback
"""
- history = [] # type: List[str]
+ history: List[str] = []
def __init__(self, help_message: str, on_abort, on_success, on_input=None) -> None:
HistoryInput.__init__(self)