From 80a7babc0c6e850f2de7572ebc94729ee24fcde3 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 27 Oct 2019 14:48:27 +0100 Subject: Type curses windows --- poezio/windows/base_wins.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'poezio/windows') diff --git a/poezio/windows/base_wins.py b/poezio/windows/base_wins.py index 6dabd7b8..361ae338 100644 --- a/poezio/windows/base_wins.py +++ b/poezio/windows/base_wins.py @@ -7,7 +7,7 @@ the text window, the roster window, etc. A Tab (see the poezio.tabs module) is composed of multiple Windows """ -TAB_WIN = None +TAB_WIN = None # type: _CursesWindow import logging log = logging.getLogger(__name__) @@ -15,7 +15,8 @@ log = logging.getLogger(__name__) import curses import string -from typing import Optional, Tuple +from contextlib import contextmanager +from typing import Optional, Tuple, TYPE_CHECKING from poezio.theming import to_curses_attr, read_tuple @@ -24,6 +25,9 @@ FORMAT_CHAR = '\x19' # I guess. But maybe we can find better chars that are even less risky. format_chars = '\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x1A' +if TYPE_CHECKING: + from _curses import _CursesWindow + class DummyWin: def __getattribute__(self, name: str): @@ -40,7 +44,7 @@ class Win: __slots__ = ('_win', 'height', 'width', 'y', 'x') def __init__(self) -> None: - self._win = None + self._win = None # type: _CursesWindow self.height, self.width = 0, 0 def _resize(self, height: int, width: int, y: int, x: int) -> None: -- cgit v1.2.3