From 5ea82ac0af1cb855c9333796004c6a97da6b5ad4 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 15 Aug 2018 14:21:59 +0200 Subject: Fix mypy errors, add type annotations --- poezio/tabs/conversationtab.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'poezio/tabs/conversationtab.py') diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py index 0d68b9b8..7e7a7488 100644 --- a/poezio/tabs/conversationtab.py +++ b/poezio/tabs/conversationtab.py @@ -11,10 +11,9 @@ There are two different instances of a ConversationTab: the time. """ -import logging -log = logging.getLogger(__name__) - import curses +import logging +from typing import Dict, Callable from poezio.tabs.basetabs import OneToOneTab, Tab @@ -23,21 +22,24 @@ from poezio import windows from poezio import xhtml from poezio.common import safeJID from poezio.config import config +from poezio.core.structs import Command from poezio.decorators import refresh_wrapper from poezio.roster import roster from poezio.text_buffer import CorrectionError from poezio.theming import get_theme, dump_tuple from poezio.decorators import command_args_parser +log = logging.getLogger(__name__) + class ConversationTab(OneToOneTab): """ The tab containg a normal conversation (not from a MUC) Must not be instantiated, use Static or Dynamic version only. """ - plugin_commands = {} - plugin_keys = {} - additional_information = {} + plugin_commands = {} # type: Dict[str, Command] + plugin_keys = {} # type: Dict[str, Callable] + additional_information = {} # type: Dict[str, Callable[[str], str]] message_type = 'chat' def __init__(self, core, jid): @@ -409,8 +411,8 @@ class DynamicConversationTab(ConversationTab): bad idea so it has been removed. Only one DynamicConversationTab can be opened for a given jid. """ - plugin_commands = {} - plugin_keys = {} + plugin_commands = {} # type: Dict[str, Command] + plugin_keys = {} # type: Dict[str, Callable] def __init__(self, core, jid, resource=None): self.locked_resource = None @@ -479,8 +481,8 @@ class StaticConversationTab(ConversationTab): A conversation tab associated with one Full JID. It cannot be locked to an different resource or unlocked. """ - plugin_commands = {} - plugin_keys = {} + plugin_commands = {} # type: Dict[str, Command] + plugin_keys = {} # type: Dict[str, Callable] def __init__(self, core, jid): assert (safeJID(jid).resource) -- cgit v1.2.3