summaryrefslogtreecommitdiff
path: root/poezio/core
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/core
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/core')
-rw-r--r--poezio/core/commands.py2
-rw-r--r--poezio/core/completions.py2
-rw-r--r--poezio/core/core.py2
-rw-r--r--poezio/core/tabs.py19
4 files changed, 12 insertions, 13 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index e926dba5..cd957002 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -335,7 +335,7 @@ class CommandCore:
except InvalidJID:
return (None, None)
- set_nick = '' # type: Optional[str]
+ set_nick: Optional[str] = ''
if len(jid_string) > 1 and jid_string.startswith('/'):
set_nick = jid_string[1:]
elif info.resource:
diff --git a/poezio/core/completions.py b/poezio/core/completions.py
index ada8d2b9..98ca9ba0 100644
--- a/poezio/core/completions.py
+++ b/poezio/core/completions.py
@@ -490,7 +490,7 @@ class CompletionCore:
tabs.StaticConversationTab,
tabs.DynamicConversationTab,
)
- tabjid = [] # type: List[JID]
+ tabjid: List[JID] = []
if isinstance(current_tab, chattabs):
tabjid = [current_tab.jid.bare]
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 3a13d4c3..2151600f 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -1171,7 +1171,7 @@ class Core:
"""
# shortcut
priority = tabs.STATE_PRIORITY
- tab_refs = {} # type: Dict[str, List[tabs.Tab]]
+ tab_refs: Dict[str, List[tabs.Tab]] = {}
# put all the active tabs in a dict of lists by state
for tab in self.tabs.get_tabs():
if not tab:
diff --git a/poezio/core/tabs.py b/poezio/core/tabs.py
index 61bad6f2..a789100d 100644
--- a/poezio/core/tabs.py
+++ b/poezio/core/tabs.py
@@ -54,16 +54,15 @@ class Tabs:
once. Otherwise, mayhem is expected.
"""
# cursor
- self._current_index = 0 # type: int
- self._current_tab = None # type: Optional[tabs.Tab]
-
- self._previous_tab = None # type: Optional[tabs.Tab]
- self._tabs = [] # type: List[tabs.Tab]
- self._tab_jids = dict() # type: Dict[JID, tabs.Tab]
- self._tab_types = defaultdict(
- list) # type: Dict[Type[tabs.Tab], List[tabs.Tab]]
- self._tab_names = dict() # type: Dict[str, tabs.Tab]
- self._events = events # type: EventHandler
+ self._current_index: int = 0
+ self._current_tab: Optional[tabs.Tab] = None
+
+ self._previous_tab: Optional[tabs.Tab] = None
+ self._tabs: List[tabs.Tab] = []
+ self._tab_jids: Dict[JID, tabs.Tab] = dict()
+ self._tab_types: Dict[Type[tabs.Tab], List[tabs.Tab]] = defaultdict(list)
+ self._tab_names: Dict[str, tabs.Tab] = dict()
+ self._events: EventHandler = events
def __len__(self):
return len(self._tabs)