retronews

a featureful fork of the luke8086/retronews hn+lobste.rs tui
Log | Files | Refs | README | LICENSE

commit dfeb4dc9606b9e6b7484f31f689645f9efc5889d
parent f989744ca458c3dc9b092e82e7aa8776c1d67467
Author: luke8086 <55237178+luke8086@users.noreply.github.com>
Date:   Tue,  3 Sep 2024 12:35:31 +0000

Fix type alias for _CursesWindow, which stopped working after mypy upgrade

Diffstat:
Mretronews.py | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/retronews.py b/retronews.py @@ -31,6 +31,7 @@ from datetime import datetime from functools import partial, reduce from textwrap import wrap from typing import ( + TYPE_CHECKING, Any, Callable, Generator, @@ -157,9 +158,15 @@ URL_REX = re.compile(r"(https?://[^\s\)\"<,]+[^\s\)\"<,\.])") HN_URL_REX = re.compile(r"^https://news\.ycombinator\.com/item\?id=(\d+)$") # FIXME: Use TypeAlias after migrating to Python 3.10 -Window = NewType("Window", "curses._CursesWindow") DB = NewType("DB", "sqlite3.Connection") +if TYPE_CHECKING: + from _curses import _CursesWindow + + Window = _CursesWindow +else: + Window = Any + T = TypeVar("T")