diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2020-12-12 18:44:37 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2020-12-12 19:36:18 +0100 |
commit | 65b8046fe08a19df937068e5fe5ad15f9b0a785a (patch) | |
tree | 827e17a99d39c5db453d0fc0e9b46249292aa4e3 /poezio/tabs/basetabs.py | |
parent | 34ec9e3ee1384506b2e803bdfe94201a7b7ff4c3 (diff) | |
download | poezio-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/tabs/basetabs.py')
-rw-r--r-- | poezio/tabs/basetabs.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index e4cdc3af..3907d7bc 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -13,6 +13,8 @@ This module also defines ChatTabs, the parent class for all tabs revolving around chats. """ +from __future__ import annotations + import copy import logging import string @@ -111,13 +113,13 @@ SHOW_NAME = { class Tab: - plugin_commands = {} # type: Dict[str, Command] - plugin_keys = {} # type: Dict[str, Callable] + plugin_commands: Dict[str, Command] = {} + plugin_keys: Dict[str, Callable] = {} # Placeholder values, set on resize height = 1 width = 1 - def __init__(self, core: 'Core'): + def __init__(self, core: Core): self.core = core self.nb = 0 if not hasattr(self, 'name'): @@ -133,7 +135,7 @@ class Tab: self.commands = {} # and their own commands @property - def size(self) -> 'SizeManager': + def size(self) -> SizeManager: return self.core.size @staticmethod @@ -196,7 +198,7 @@ class Tab: self._state = 'normal' @staticmethod - def initial_resize(scr: '_CursesWindow'): + def initial_resize(scr: _CursesWindow): Tab.height, Tab.width = scr.getmaxyx() windows.base_wins.TAB_WIN = scr @@ -479,8 +481,8 @@ class ChatTab(Tab): Also, ^M is already bound to on_enter And also, add the /say command """ - plugin_commands = {} # type: Dict[str, Command] - plugin_keys = {} # type: Dict[str, Callable] + plugin_commands: Dict[str, Command] = {} + plugin_keys: Dict[str, Callable] = {} message_type = 'chat' def __init__(self, core, jid: Union[JID, str]): @@ -492,7 +494,7 @@ class ChatTab(Tab): self._jid = jid #: Is the tab currently requesting MAM data? self.query_status = False - self._name = jid.full # type: Optional[str] + self._name: Optional[str] = jid.full self.text_win = windows.TextWin() self.directed_presence = None self._text_buffer = TextBuffer() @@ -532,7 +534,7 @@ class ChatTab(Tab): desc='Fix the last message with whatever you want.', shortdesc='Correct the last message.', completion=self.completion_correct) - self.chat_state = None # type: Optional[str] + self.chat_state: Optional[str] = None self.update_commands() self.update_keys() |