From 37a8ecc7daa3efeedfc7d64a0c62dfd36aeb2815 Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 5 Nov 2018 20:24:30 +0100 Subject: [PATCH] ui: fix mypy warnings --- pqcli/ui/__init__.py | 2 +- pqcli/ui/custom_list_box.py | 2 +- pqcli/ui/custom_progress_bar.py | 2 +- pqcli/ui/game_view.py | 6 +++--- pqcli/ui/read_only_check_box.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pqcli/ui/__init__.py b/pqcli/ui/__init__.py index 32eca41..b345bda 100644 --- a/pqcli/ui/__init__.py +++ b/pqcli/ui/__init__.py @@ -12,7 +12,7 @@ from pqcli.ui.new_game_view import NewGameView from pqcli.ui.roster_view import RosterView -PALETTE: T.List[T.Tuple[str, str, str]] = [ +PALETTE: T.List[T.Tuple[str, ...]] = [ ("button", "", ""), ("button-focus", "light red", "black"), ("linebox", "", ""), diff --git a/pqcli/ui/custom_list_box.py b/pqcli/ui/custom_list_box.py index 3d36fc5..4e3b105 100644 --- a/pqcli/ui/custom_list_box.py +++ b/pqcli/ui/custom_list_box.py @@ -4,7 +4,7 @@ import urwid class CustomListWalker(urwid.SimpleFocusListWalker): - def append(self, item) -> None: + def append(self, item: T.Any) -> None: super().append(item) self.set_focus(len(self) - 1) diff --git a/pqcli/ui/custom_progress_bar.py b/pqcli/ui/custom_progress_bar.py index 1cb901a..416db0b 100644 --- a/pqcli/ui/custom_progress_bar.py +++ b/pqcli/ui/custom_progress_bar.py @@ -32,7 +32,7 @@ class CustomProgressBar(urwid.Widget): percent = min(100, max(0, int(self.position * 100 / self.max_))) return str(percent) + " %" - def render(self, size: T.Tuple[int, int], focus: bool = False) -> None: + def render(self, size: T.Tuple[int, int], focus: bool = False) -> T.Any: (maxcol,) = size txt = urwid.Text(self.get_text(), self.text_align, "clip") c = txt.render((maxcol,)) diff --git a/pqcli/ui/game_view.py b/pqcli/ui/game_view.py index f11b021..a3aca44 100644 --- a/pqcli/ui/game_view.py +++ b/pqcli/ui/game_view.py @@ -137,7 +137,7 @@ class EquipmentView(CustomLineBox): ) def sync_equipment_change( - self, equipment_type: EquipmentType, item_name: str + self, equipment_type: EquipmentType, item_name: T.Optional[str] ) -> None: self.value_texts[equipment_type].set_text(item_name or "") @@ -253,7 +253,7 @@ class PlotView(DoubleLineBox): ReadOnlyCheckBox(act_name(self.player.quest_book.act), state=False) ) - def sync_act_add(self): + def sync_act_add(self) -> None: del self.list_box.body[: -self.cutoff] if self.list_box.body: self.list_box.body[-1].set_state(True) @@ -296,7 +296,7 @@ class QuestBookView(DoubleLineBox): if self.list_box.body: self.list_box.body[-1].set_state(False) - def sync_quest_add(self): + def sync_quest_add(self) -> None: del self.list_box.body[: -self.cutoff] if self.list_box.body: self.list_box.body[-1].set_state(True) diff --git a/pqcli/ui/read_only_check_box.py b/pqcli/ui/read_only_check_box.py index d6b4d89..94c9a55 100644 --- a/pqcli/ui/read_only_check_box.py +++ b/pqcli/ui/read_only_check_box.py @@ -2,7 +2,7 @@ import urwid class ReadOnlyCheckBox(urwid.Text): - def __init__(self, text, state: bool = False) -> None: + def __init__(self, text: str, state: bool = False) -> None: self.icons = { key: widget.text for key, widget in urwid.CheckBox.states.items() }