Skip to content

Commit

Permalink
Fix: typehint
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Feb 28, 2024
1 parent b81be31 commit 6faa91a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyte/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -1346,15 +1346,15 @@ 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`.
"""
super().__init__(*args, **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)
Expand Down

0 comments on commit 6faa91a

Please sign in to comment.