From 9cc861eeff9116d297712737ae42475203820ac6 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 29 Jan 2022 23:36:21 +0100 Subject: [PATCH] ci: fix mypy analysis --- poezio/logger.py | 2 +- poezio/windows/inputs.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/poezio/logger.py b/poezio/logger.py index 4b7856da..21667924 100644 --- a/poezio/logger.py +++ b/poezio/logger.py @@ -255,7 +255,7 @@ class Logger: if jidstr in self._fds.keys(): fd = self._fds[jidstr] else: - option_fd = self._check_and_create_log_dir(jid) + option_fd = self._check_and_create_log_dir(jidstr) if option_fd is None: return True fd = option_fd diff --git a/poezio/windows/inputs.py b/poezio/windows/inputs.py index 7ee8aa45..89da054e 100644 --- a/poezio/windows/inputs.py +++ b/poezio/windows/inputs.py @@ -5,7 +5,7 @@ Text inputs. import curses import logging import string -from typing import List, Dict, Callable, Optional +from typing import List, Dict, Callable, Optional, ClassVar, Union from poezio import keyboard from poezio import common @@ -592,9 +592,10 @@ class HistoryInput(Input): An input with colors and stuff, plus an history ^R allows to search inside the history (as in a shell) """ - __slots__ = ('help_message', 'histo_pos', 'current_completed', 'search') + __slots__ = ('help_message', 'histo_pos', 'current_completed', 'search', + 'history') - history: List[str] = [] + global_history: ClassVar[List[str]] = [] def __init__(self) -> None: Input.__init__(self) @@ -604,8 +605,9 @@ class HistoryInput(Input): self.key_func['^R'] = self.toggle_search self.search = False if config.getbool('separate_history'): - # pylint: disable=assigning-non-slot self.history: List[str] = [] + else: + self.history = self.__class__.global_history def toggle_search(self) -> None: if self.help_message: @@ -682,7 +684,7 @@ class MessageInput(HistoryInput): Also letting the user enter colors or other text markups """ # The history is common to all MessageInput - history: List[str] = [] + global_history: ClassVar[List[str]] = [] def __init__(self) -> None: HistoryInput.__init__(self) @@ -728,7 +730,7 @@ class CommandInput(HistoryInput): HelpMessage when a command is started The on_input callback """ - history: List[str] = [] + global_history: ClassVar[List[str]] = [] def __init__(self, help_message: str, on_abort, on_success, on_input=None) -> None: HistoryInput.__init__(self)