From 6faa91ad3809d1aa386c0d21aff56082f456172b Mon Sep 17 00:00:00 2001 From: eight04 Date: Wed, 28 Feb 2024 17:13:14 +0800 Subject: [PATCH] Fix: typehint --- pyte/screens.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyte/screens.py b/pyte/screens.py index 80a67c5..5ae2d47 100644 --- a/pyte/screens.py +++ b/pyte/screens.py @@ -1337,7 +1337,7 @@ def __getattribute__(self, attr: str) -> Callable[..., None]: else: return lambda *args, **kwargs: None -def byte_screen_wcwidth(text: str): +def byte_screen_wcwidth(text: str) -> int: # FIXME: should we always return 1? n = _DEFAULT_WCWIDTH(text) if n <= 0 and text <= "\xff": @@ -1346,7 +1346,7 @@ def byte_screen_wcwidth(text: str): class ByteScreen(Screen): """A screen that draws bytes and stores byte-string in the buffer, including un-printable/zero-length chars.""" - def __init__(self, *args, encoding: str | None=None, **kwargs): + def __init__(self, *args: Any, encoding: str|None = None, **kwargs: Any): """ :param encoding: The encoding of the screen. If set, the byte-string will be decoded when calling :meth:`ByteScreen.display`. """ @@ -1354,7 +1354,7 @@ def __init__(self, *args, encoding: str | None=None, **kwargs): self.encoding = encoding self.wcwidth = byte_screen_wcwidth - def draw(self, data: str | bytes): + def draw(self, data: str|bytes) -> None: if isinstance(data, bytes): data = data.decode("latin-1") return super().draw(data)