scripts: west_commands: runners: Fix mutable-argument-default (B006)
Do not use mutable default arguments. See https://docs.astral.sh/ruff/rules/mutable-argument-default/ Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
parent
8055145ad3
commit
1e1c7f7c16
6 changed files with 20 additions and 16 deletions
|
|
@ -12,7 +12,7 @@ DEFAULT_EZFLASHCLI = "ezFlashCLI"
|
||||||
class EzFlashCliBinaryRunner(ZephyrBinaryRunner):
|
class EzFlashCliBinaryRunner(ZephyrBinaryRunner):
|
||||||
'''Runner front-end for ezFlashCLI'''
|
'''Runner front-end for ezFlashCLI'''
|
||||||
|
|
||||||
def __init__(self, cfg, tool, dev_id=None, tool_opt=[], erase=False, reset=True):
|
def __init__(self, cfg, tool, dev_id=None, tool_opt=None, erase=False, reset=True):
|
||||||
super().__init__(cfg)
|
super().__init__(cfg)
|
||||||
self.bin_ = cfg.bin_file
|
self.bin_ = cfg.bin_file
|
||||||
|
|
||||||
|
|
@ -22,8 +22,9 @@ class EzFlashCliBinaryRunner(ZephyrBinaryRunner):
|
||||||
self.reset = bool(reset)
|
self.reset = bool(reset)
|
||||||
|
|
||||||
self.tool_opt = []
|
self.tool_opt = []
|
||||||
for opts in [shlex.split(opt) for opt in tool_opt]:
|
if tool_opt is not None:
|
||||||
self.tool_opt += opts
|
for opts in [shlex.split(opt) for opt in tool_opt]:
|
||||||
|
self.tool_opt += opts
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def name(cls):
|
def name(cls):
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class JLinkBinaryRunner(ZephyrBinaryRunner):
|
||||||
gdb_host='',
|
gdb_host='',
|
||||||
gdb_port=DEFAULT_JLINK_GDB_PORT,
|
gdb_port=DEFAULT_JLINK_GDB_PORT,
|
||||||
rtt_port=DEFAULT_JLINK_RTT_PORT,
|
rtt_port=DEFAULT_JLINK_RTT_PORT,
|
||||||
tui=False, tool_opt=[]):
|
tui=False, tool_opt=None):
|
||||||
super().__init__(cfg)
|
super().__init__(cfg)
|
||||||
self.file = cfg.file
|
self.file = cfg.file
|
||||||
self.file_type = cfg.file_type
|
self.file_type = cfg.file_type
|
||||||
|
|
@ -82,8 +82,9 @@ class JLinkBinaryRunner(ZephyrBinaryRunner):
|
||||||
self.rtt_port = rtt_port
|
self.rtt_port = rtt_port
|
||||||
|
|
||||||
self.tool_opt = []
|
self.tool_opt = []
|
||||||
for opts in [shlex.split(opt) for opt in tool_opt]:
|
if tool_opt is not None:
|
||||||
self.tool_opt += opts
|
for opts in [shlex.split(opt) for opt in tool_opt]:
|
||||||
|
self.tool_opt += opts
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def name(cls):
|
def name(cls):
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ class LinkServerBinaryRunner(ZephyrBinaryRunner):
|
||||||
gdb_host='',
|
gdb_host='',
|
||||||
gdb_port=DEFAULT_LINKSERVER_GDB_PORT,
|
gdb_port=DEFAULT_LINKSERVER_GDB_PORT,
|
||||||
semihost_port=DEFAULT_LINKSERVER_SEMIHOST_PORT,
|
semihost_port=DEFAULT_LINKSERVER_SEMIHOST_PORT,
|
||||||
override=[],
|
override=None,
|
||||||
tui=False, tool_opt=[]):
|
tui=False, tool_opt=None):
|
||||||
super().__init__(cfg)
|
super().__init__(cfg)
|
||||||
self.file = cfg.file
|
self.file = cfg.file
|
||||||
self.file_type = cfg.file_type
|
self.file_type = cfg.file_type
|
||||||
|
|
@ -48,12 +48,13 @@ class LinkServerBinaryRunner(ZephyrBinaryRunner):
|
||||||
self.gdb_port = gdb_port
|
self.gdb_port = gdb_port
|
||||||
self.semihost_port = semihost_port
|
self.semihost_port = semihost_port
|
||||||
self.tui_arg = ['-tui'] if tui else []
|
self.tui_arg = ['-tui'] if tui else []
|
||||||
self.override = override
|
self.override = override if override else []
|
||||||
self.override_cli = self._build_override_cli()
|
self.override_cli = self._build_override_cli()
|
||||||
|
|
||||||
self.tool_opt = []
|
self.tool_opt = []
|
||||||
for opts in [shlex.split(opt) for opt in tool_opt]:
|
if tool_opt is not None:
|
||||||
self.tool_opt += opts
|
for opts in [shlex.split(opt) for opt in tool_opt]:
|
||||||
|
self.tool_opt += opts
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def name(cls):
|
def name(cls):
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class NrfBinaryRunner(ZephyrBinaryRunner):
|
||||||
'''Runner front-end base class for nrf tools.'''
|
'''Runner front-end base class for nrf tools.'''
|
||||||
|
|
||||||
def __init__(self, cfg, family, softreset, dev_id, erase=False,
|
def __init__(self, cfg, family, softreset, dev_id, erase=False,
|
||||||
reset=True, tool_opt=[], force=False, recover=False):
|
reset=True, tool_opt=None, force=False, recover=False):
|
||||||
super().__init__(cfg)
|
super().__init__(cfg)
|
||||||
self.hex_ = cfg.hex_file
|
self.hex_ = cfg.hex_file
|
||||||
if family and not family.endswith('_FAMILY'):
|
if family and not family.endswith('_FAMILY'):
|
||||||
|
|
@ -93,8 +93,9 @@ class NrfBinaryRunner(ZephyrBinaryRunner):
|
||||||
self.suit_starter = False
|
self.suit_starter = False
|
||||||
|
|
||||||
self.tool_opt = []
|
self.tool_opt = []
|
||||||
for opts in [shlex.split(opt) for opt in tool_opt]:
|
if tool_opt is not None:
|
||||||
self.tool_opt += opts
|
for opts in [shlex.split(opt) for opt in tool_opt]:
|
||||||
|
self.tool_opt += opts
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def capabilities(cls):
|
def capabilities(cls):
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class NrfJprogBinaryRunner(NrfBinaryRunner):
|
||||||
'''Runner front-end for nrfjprog.'''
|
'''Runner front-end for nrfjprog.'''
|
||||||
|
|
||||||
def __init__(self, cfg, family, softreset, dev_id, erase=False,
|
def __init__(self, cfg, family, softreset, dev_id, erase=False,
|
||||||
reset=True, tool_opt=[], force=False, recover=False,
|
reset=True, tool_opt=None, force=False, recover=False,
|
||||||
qspi_ini=None):
|
qspi_ini=None):
|
||||||
|
|
||||||
super().__init__(cfg, family, softreset, dev_id, erase, reset,
|
super().__init__(cfg, family, softreset, dev_id, erase, reset,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class NrfUtilBinaryRunner(NrfBinaryRunner):
|
||||||
'''Runner front-end for nrfutil.'''
|
'''Runner front-end for nrfutil.'''
|
||||||
|
|
||||||
def __init__(self, cfg, family, softreset, dev_id, erase=False,
|
def __init__(self, cfg, family, softreset, dev_id, erase=False,
|
||||||
reset=True, tool_opt=[], force=False, recover=False,
|
reset=True, tool_opt=None, force=False, recover=False,
|
||||||
suit_starter=False):
|
suit_starter=False):
|
||||||
|
|
||||||
super().__init__(cfg, family, softreset, dev_id, erase, reset,
|
super().__init__(cfg, family, softreset, dev_id, erase, reset,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue