Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Commit faca6a2

Browse files
committed
Paint it black
1 parent 6682251 commit faca6a2

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

cli_ui/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ def ask_choice(
539539

540540
return res
541541

542+
542543
def select_choices(
543544
*prompt: Token,
544545
choices: List[Any],
@@ -581,8 +582,8 @@ def select_choices(
581582
try:
582583
import re
583584

584-
index = [int(item) for item in re.split(r'; |, |\s |;|,|\s',answer)]
585-
index = [x-1 for x in index] # convert to true index
585+
index = [int(item) for item in re.split(r"; |, |\s |;|,|\s", answer)]
586+
index = [x - 1 for x in index] # convert to true index
586587
# index = int(answer)
587588
except ValueError:
588589
info("Please enter a valid number")

cli_ui/tests/test_cli_ui.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def func_desc(fruit: Fruit) -> str:
301301
fruits = [Fruit("apple", 42), Fruit("banana", 10), Fruit("orange", 12)]
302302
with mock.patch("builtins.input") as m:
303303
m.side_effect = ["nan", "5", "2"]
304-
304+
305305
actual = cli_ui.ask_choice(
306306
"Select a fruit", choices=fruits, func_desc=operator.attrgetter("name")
307307
)
@@ -322,8 +322,8 @@ def test_ask_choice_ctrl_c() -> None:
322322
with mock.patch("builtins.input") as m:
323323
m.side_effect = KeyboardInterrupt
324324
cli_ui.ask_choice("Select a animal", choices=["cat", "dog", "cow"])
325-
326-
325+
326+
327327
def test_select_choices() -> None:
328328
class Fruit:
329329
def __init__(self, name: str, price: int):
@@ -344,8 +344,8 @@ def func_desc(fruit: Fruit) -> str:
344344
assert actual[1].name == "banana"
345345
assert actual[1].price == 10
346346
assert m.call_count == 3
347-
348-
347+
348+
349349
def test_select_choices_empty_input() -> None:
350350
with mock.patch("builtins.input") as m:
351351
m.side_effect = [""]
@@ -357,7 +357,7 @@ def test_select_choices_ctrl_c() -> None:
357357
with pytest.raises(KeyboardInterrupt):
358358
with mock.patch("builtins.input") as m:
359359
m.side_effect = KeyboardInterrupt
360-
cli_ui.select_choices("Select a animal", choices=["cat", "dog", "cow"])
360+
cli_ui.select_choices("Select a animal", choices=["cat", "dog", "cow"])
361361

362362

363363
def test_quiet(message_recorder: MessageRecorder) -> None:

0 commit comments

Comments
 (0)