Skip to content

Commit 943c845

Browse files
committed
Fix in type hinting.
1 parent f82257d commit 943c845

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

visualdialog/box.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __init__(
131131
self.panic_keys: List[CursesKey] = []
132132

133133
@property
134-
def position(self) -> Tuple[int]:
134+
def position(self) -> Tuple[int, int]:
135135
"""Return a tuple contains x;y position of ``TextBox``.
136136
137137
The position represents the x;y coordinates of the top left
@@ -142,7 +142,7 @@ def position(self) -> Tuple[int]:
142142
return self.pos_x, self.pos_y
143143

144144
@property
145-
def dimensions(self) -> Tuple[int]:
145+
def dimensions(self) -> Tuple[int, int]:
146146
"""Return a tuple contains dimensions of ``TextBox``.
147147
148148
:returns: Height and width of ``TextBox``.

visualdialog/dialog.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,13 @@ def char_by_char(self,
8080
CursesTextAttributes] = (),
8181
words_attr: Mapping[Sequence[str],
8282
Union[CursesTextAttribute,
83-
CursesTextAttributes]] = {},
83+
CursesTextAttributes]] = {},
8484
word_delimiter: str = " ",
8585
flash_screen: bool = False,
8686
delay: int = 40,
8787
random_delay: Sequence[int] = (0, 0),
88-
callbacks: Iterable[Callable] = ()):
88+
callbacks: Iterable[Callable[["DialogBox", str],
89+
Optional[Any]]] = ()):
8990
"""Write the given text character by character.
9091
9192
:param win: ``curses`` window object on which the method will
@@ -188,7 +189,8 @@ def word_by_word(self,
188189
flash_screen: bool = False,
189190
delay: int = 150,
190191
random_delay: Sequence[int] = (0, 0),
191-
callbacks: Iterable[Callable] = ()):
192+
callbacks: Iterable[Callable[["DialogBox", str],
193+
Optional[Any]]] = ()):
192194
"""Write the given text word by word.
193195
194196
:param win: ``curses`` window object on which the method will
@@ -331,7 +333,8 @@ def _write_word(self,
331333
word: str,
332334
delay: int,
333335
random_delay: Sequence[int],
334-
callbacks: Iterable[Callable[[BaseTextBox, str], Optional[Any]]]):
336+
callbacks: Iterable[Callable[["DialogBox", str],
337+
Optional[Any]]]):
335338
"""Write word at given position."""
336339
win.addstr(pos_y,
337340
pos_x,
@@ -359,7 +362,8 @@ def _one_by_one(self,
359362
flash_screen: bool,
360363
delay: int,
361364
random_delay: Sequence[int],
362-
callbacks: Iterable[Callable]):
365+
callbacks: Iterable[Callable[["DialogBox", str],
366+
Optional[Any]]]]):
363367
"""This method offers a general purpose API to display text
364368
regardless of whether it is written word by word or character by
365369
character.

visualdialog/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __enter__(self) -> NoReturn:
5656
for attr in self.attributes:
5757
self.win.attron(attr)
5858

59-
def __exit__(self, type, value, traceback) -> NoReturn:
59+
def __exit__(self, *_) -> NoReturn:
6060
"""Disable one by one attributes contained in self.attributes
6161
on ``self.win``.
6262
"""

0 commit comments

Comments
 (0)