Skip to content

Commit 68b5628

Browse files
committed
refactor(mypy): Add typings for cli/utils
1 parent df84c46 commit 68b5628

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

src/tmuxp/cli/utils.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def tmuxp_echo(
3434

3535
def prompt(
3636
name: str,
37-
default: t.Any = None,
37+
default: t.Optional[str] = None,
3838
value_proc: t.Optional[t.Callable[[str], str]] = None,
39-
) -> t.Any:
39+
) -> str:
4040
"""Return user input from command line.
4141
:meth:`~prompt`, :meth:`~prompt_bool` and :meth:`prompt_choices` are from
4242
`flask-script`_. See the `flask-script license`_.
@@ -107,15 +107,12 @@ def prompt_yes_no(name: str, default: bool = True) -> bool:
107107
return prompt_bool(name, default=default)
108108

109109

110-
_C = t.TypeVar("_C")
111-
112-
113110
def prompt_choices(
114111
name: str,
115-
choices: t.Union[t.List[_C], t.Tuple[str, _C]],
116-
default: t.Optional[_C] = None,
112+
choices: t.Union[t.List[str], t.Tuple[str, str]],
113+
default: t.Optional[str] = None,
117114
no_choice: t.Sequence[str] = ("none",),
118-
) -> t.Optional[_C]:
115+
) -> t.Optional[str]:
119116
"""Return user input from command line from set of provided choices.
120117
:param name: prompt text
121118
:param choices: list or tuple of available choices. Choices may be
@@ -125,8 +122,8 @@ def prompt_choices(
125122
:rtype: str
126123
"""
127124

128-
_choices = []
129-
options = []
125+
_choices: t.List[str] = []
126+
options: t.List[str] = []
130127

131128
for choice in choices:
132129
if isinstance(choice, str):

0 commit comments

Comments
 (0)