Attempt to remove one if-else

I got: circup/__init__.py:1177:0: R0912: Too many branches (13/12) (too-many-branches)
This commit is contained in:
Vladimír Smitka 2023-10-22 21:52:20 +02:00
parent aa829a5804
commit 49737096ff

View file

@ -1212,10 +1212,11 @@ def main(ctx, verbose, path, board_id, cpy_version): # pragma: no cover
click.secho("Could not find a connected CircuitPython device.", fg="red")
sys.exit(1)
else:
if board_id is not None and cpy_version is not None:
CPY_VERSION = cpy_version
else:
CPY_VERSION, board_id = get_circuitpython_version(device_path)
CPY_VERSION, board_id = (
get_circuitpython_version(device_path)
if board_id is None or cpy_version is None
else (cpy_version, board_id)
)
click.echo(
"Found device at {}, running CircuitPython {}.".format(
device_path, CPY_VERSION