9
9
if t .TYPE_CHECKING :
10
10
from typing_extensions import TypeAlias
11
11
12
- CLIColour : TypeAlias = t .Union [int , t . Tuple [int , int , int ], str ]
12
+ CLIColour : TypeAlias = t .Union [int , tuple [int , int , int ], str ]
13
13
14
14
15
15
logger = logging .getLogger (__name__ )
@@ -56,10 +56,10 @@ def prompt(
56
56
`flask-script <https://github.com/techniq/flask-script>`_. See the
57
57
`flask-script license <https://github.com/techniq/flask-script/blob/master/LICENSE>`_.
58
58
"""
59
- _prompt = name + ((default and f" [{ default } ]" ) or "" )
60
- _prompt += (name .endswith ("?" ) and " " ) or ": "
59
+ prompt_ = name + ((default and f" [{ default } ]" ) or "" )
60
+ prompt_ += (name .endswith ("?" ) and " " ) or ": "
61
61
while True :
62
- rv = input (_prompt ) or default
62
+ rv = input (prompt_ ) or default
63
63
try :
64
64
if value_proc is not None and callable (value_proc ):
65
65
assert isinstance (rv , str )
@@ -106,11 +106,11 @@ def prompt_bool(
106
106
else :
107
107
prompt_choice = "y/N"
108
108
109
- _prompt = name + f" [{ prompt_choice } ]"
110
- _prompt += (name .endswith ("?" ) and " " ) or ": "
109
+ prompt_ = name + f" [{ prompt_choice } ]"
110
+ prompt_ += (name .endswith ("?" ) and " " ) or ": "
111
111
112
112
while True :
113
- rv = input (_prompt )
113
+ rv = input (prompt_ )
114
114
if not rv :
115
115
return default
116
116
if rv .lower () in yes_choices :
@@ -126,7 +126,7 @@ def prompt_yes_no(name: str, default: bool = True) -> bool:
126
126
127
127
def prompt_choices (
128
128
name : str ,
129
- choices : t .Union [t . List [str ], t . Tuple [str , str ]],
129
+ choices : t .Union [list [str ], tuple [str , str ]],
130
130
default : t .Optional [str ] = None ,
131
131
no_choice : t .Sequence [str ] = ("none" ,),
132
132
) -> t .Optional [str ]:
@@ -148,16 +148,16 @@ def prompt_choices(
148
148
-------
149
149
str
150
150
"""
151
- _choices : t . List [str ] = []
152
- options : t . List [str ] = []
151
+ choices_ : list [str ] = []
152
+ options : list [str ] = []
153
153
154
154
for choice in choices :
155
155
if isinstance (choice , str ):
156
156
options .append (choice )
157
157
elif isinstance (choice , tuple ):
158
158
options .append (f"{ choice } [{ choice [0 ]} ]" )
159
159
choice = choice [0 ]
160
- _choices .append (choice )
160
+ choices_ .append (choice )
161
161
162
162
while True :
163
163
rv = prompt (name + " - ({})" .format (", " .join (options )), default = default )
@@ -166,7 +166,7 @@ def prompt_choices(
166
166
rv = rv .lower ()
167
167
if rv in no_choice :
168
168
return None
169
- if rv in _choices :
169
+ if rv in choices_ :
170
170
return rv
171
171
172
172
@@ -201,7 +201,7 @@ def strip_ansi(value: str) -> str:
201
201
202
202
203
203
def _interpret_color (
204
- color : t .Union [int , t . Tuple [int , int , int ], str ],
204
+ color : t .Union [int , tuple [int , int , int ], str ],
205
205
offset : int = 0 ,
206
206
) -> str :
207
207
if isinstance (color , int ):
0 commit comments