Skip to content

Commit bdd23ed

Browse files
committed
Replace Dict type hint to typing.Mapping in methods arguments.
1 parent ea20068 commit bdd23ed

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

examples/text_attributes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Definition of keys to pass a dialog.
1010
PASS_KEYS = (" ", "\n")
1111

12-
# A key/value dictionary containing the text and the attributes
12+
# A key/value mapping containing the text and the attributes
1313
# with which it will be displayed.
1414
# You can pass one or more curses text attributes arguments as a tuple.
1515
sentences = {

visualdialog/choices.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# 2020 Timéo Arnouts <[email protected]>
33

44
import curses
5-
from typing import Any, Dict, Tuple, Union
5+
from typing import Any, Mapping, Tuple, Union
66

77
from .dialog import DialogBox
88
from .utils import CursesTextAttrConstants, TextAttr, chunked
@@ -17,7 +17,7 @@ def __init__(self,
1717
def chain(
1818
self,
1919
win,
20-
*propositions: Dict[str, Any]) -> Any:
20+
*propositions: Mapping[str, Any]) -> Any:
2121
""""""
2222
super().framing_box(win)
2323

visualdialog/dialog.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import curses
77
import random
88
import textwrap
9-
from typing import Any, Callable, Dict, List, Sequence, Tuple, Union
9+
from typing import Any, Callable, List, Mapping, Sequence, Tuple, Union
1010

1111
from .box import BaseTextBox
1212
from .utils import (CursesTextAttrConstant, CursesTextAttrConstants,
@@ -147,9 +147,9 @@ def _one_by_one(self,
147147
colors_pair_nb: int,
148148
text_attr: Union[CursesTextAttrConstant,
149149
CursesTextAttrConstants],
150-
words_attr: Dict[Sequence[str],
151-
Union[CursesTextAttrConstant,
152-
CursesTextAttrConstants]],
150+
words_attr: Mapping[Sequence[str],
151+
Union[CursesTextAttrConstant,
152+
CursesTextAttrConstants]],
153153
word_delimiter: str,
154154
flash_screen: bool,
155155
delay: int,
@@ -209,9 +209,9 @@ def char_by_char(
209209
colors_pair_nb: int = 0,
210210
text_attr: Union[CursesTextAttrConstant,
211211
CursesTextAttrConstants] = (),
212-
words_attr: Dict[Sequence[str],
213-
Union[CursesTextAttrConstant,
214-
CursesTextAttrConstants]] = {},
212+
words_attr: Mapping[Sequence[str],
213+
Union[CursesTextAttrConstant,
214+
CursesTextAttrConstants]] = {},
215215
word_delimiter: str = " ",
216216
flash_screen: bool = False,
217217
delay: int = 40,
@@ -237,7 +237,7 @@ def char_by_char(
237237
be a single curses text attribute or a tuple of curses text
238238
attribute. This defaults an empty tuple.
239239
240-
:param words_attr: Dictionary composed of string as a key and a
240+
:param words_attr: Mapping composed of string as a key and a
241241
single curses text attribute or tuple as a value. Each key
242242
is colored with its associated values This defaults to an
243243
empty dictionary.
@@ -311,9 +311,9 @@ def word_by_word(
311311
colors_pair_nb: int = 0,
312312
text_attr: Union[CursesTextAttrConstant,
313313
CursesTextAttrConstants] = (),
314-
words_attr: Dict[Sequence[str],
315-
Union[CursesTextAttrConstant,
316-
CursesTextAttrConstants]] = {},
314+
words_attr: Mapping[Sequence[str],
315+
Union[CursesTextAttrConstant,
316+
CursesTextAttrConstants]] = {},
317317
word_delimiter: str = " ",
318318
flash_screen: bool = False,
319319
delay: int = 150,
@@ -339,7 +339,7 @@ def word_by_word(
339339
be a single curses text attribute or a tuple of curses text
340340
attribute. This defaults an empty tuple.
341341
342-
:param words_attr: Dictionary composed of string as a key and a
342+
:param words_attr: Mapping composed of string as a key and a
343343
single curses text attribute or tuple as a value. Each key
344344
is colored with its associated values This defaults to an
345345
empty dictionary.

0 commit comments

Comments
 (0)