Skip to content

Commit 1822408

Browse files
committed
fix linting errors
1 parent 268c708 commit 1822408

1 file changed

Lines changed: 15 additions & 18 deletions

File tree

pybricksdev/cli/__init__.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,7 @@ def is_pybricks_usb(dev):
235235
response_options = ["Recompile and Run", "Recompile and Download", "Exit"]
236236
while True:
237237
try:
238-
response = await hub.race_disconnect(questionary.select(
239-
"Would you like to re-compile your code?", choices=response_options,
240-
).ask_async())
238+
response = await hub.race_disconnect(questionary.select("Would you like to re-compile your code?", choices=response_options).ask_async())
241239

242240
except RuntimeError:
243241
# Allow terminal to settle before creating a new prompt
@@ -461,6 +459,7 @@ async def run(self, args: argparse.Namespace):
461459
print(read_text(resources, resources.UDEV_RULES))
462460

463461
class Tui(Tool):
462+
464463
def add_parser(self, subparsers: argparse._SubParsersAction):
465464
parser = subparsers.add_parser("tui", help="open a user interface")
466465
parser.tool = self
@@ -470,33 +469,32 @@ async def run(self, args: argparse.Namespace):
470469

471470
match tool_choices.index(await questionary.select("What would you like to do?", tool_choices).ask_async()):
472471
case 0:
473-
connection_type = await questionary.select("How do you want to connect to the hub?", ["bluetooth", "usb"]).ask_async()
474-
file_path = os.path.expanduser(await questionary.path("What file would you like to run?", complete_style=CompleteStyle.COLUMN, file_filter=lambda name: name.endswith(".py")).ask_async())
475-
hub_name = await questionary.text("What is the name of your pybricks hub? (enter for any)").ask_async() if connection_type == "bluetooth" else None
476-
other_options_list = ["Start the program immediately after downloading it.", "Wait for the program to complete before disconnecting. Only applies when starting program right away.", "Add a menu option to resend the code with bluetooth instead of disconnecting from the robot after the program ends."]
477-
other_options = await questionary.checkbox("Select wanted options.", [Choice(other_options_list[0], checked=True), Choice(other_options_list[1], checked=True), Choice(other_options_list[2])]).ask_async()
472+
connection_type=await questionary.select("How do you want to connect to the hub?", ["bluetooth", "usb"]).ask_async()
473+
file_path=os.path.expanduser(await questionary.path("What file would you like to run?", complete_style=CompleteStyle.COLUMN, file_filter=lambda name: name.endswith(".py")).ask_async())
474+
hub_name=await questionary.text("What is the name of your pybricks hub? (enter for any)").ask_async() if connection_type == "bluetooth" else None
475+
other_options_list=["Start the program immediately after downloading it.", "Wait for the program to complete before disconnecting. Only applies when starting program right away.", "Add a menu option to resend the code with bluetooth instead of disconnecting from the robot after the program ends."]
476+
other_options=await questionary.checkbox("Select wanted options.", [Choice(other_options_list[0], checked=True), Choice(other_options_list[1], checked=True), Choice(other_options_list[2])]).ask_async()
478477

479478
args = argparse.Namespace(
480-
conntype = "ble" if connection_type == "bluetooth" else "usb",
479+
conntype="ble" if connection_type == "bluetooth" else "usb",
481480
file=io.open(file_path, "r"),
482-
name = hub_name if hub_name else None,
483-
start = True if other_options_list[0] in other_options else False,
484-
wait = True if other_options_list[1] in other_options else False,
485-
stay_connected = True if other_options_list[2] in other_options else False,
481+
name=hub_name if hub_name else None,
482+
start=True if other_options_list[0] in other_options else False,
483+
wait=True if other_options_list[1] in other_options else False,
484+
stay_connected=True if other_options_list[2] in other_options else False,
486485
)
487486

488487
await Run().run(args)
489488

490-
491489
case 1:
492490
args = argparse.Namespace(
493-
firmware = os.path.expanduser(await questionary.path("What file would you like to flash?", complete_style=CompleteStyle.COLUMN, file_filter=lambda name: name.endswith(".zip")).ask_async()),
494-
name = await questionary.text("What would you like to name your hub?").ask_async(),
491+
firmware=os.path.expanduser(await questionary.path("What file would you like to flash?", complete_style=CompleteStyle.COLUMN, file_filter=lambda name: name.endswith(".zip")).ask_async()),
492+
name=await questionary.text("What would you like to name your hub?").ask_async(),
495493
)
496494
await Flash().run(args)
497495

498496
case 2:
499-
actions = ["backup firmware using DFU", "restore firmware using DFU"]
497+
actions=["backup firmware using DFU", "restore firmware using DFU"]
500498
match actions.index(await questionary.select("What would you like to do?", actions).ask_async()):
501499
case 0:
502500
pass
@@ -508,7 +506,6 @@ async def run(self, args: argparse.Namespace):
508506

509507
def main():
510508
"""Runs ``pybricksdev`` command line interface."""
511-
512509
if sys.platform == "win32":
513510
# Hack around bad side-effects of pythoncom on Windows
514511
try:

0 commit comments

Comments
 (0)