Browse Source

scripts: west_commands: runners: Sort and format imports (I001)

Apply sorting and formatting rules on imports.

See
https://docs.astral.sh/ruff/rules/unsorted-imports/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
pull/81768/head
Pieter De Gendt 8 months ago committed by Benjamin Cabé
parent
commit
bf7f41d880
  1. 2
      scripts/west_commands/runners/blackmagicprobe.py
  2. 2
      scripts/west_commands/runners/bossac.py
  3. 2
      scripts/west_commands/runners/canopen_program.py
  4. 2
      scripts/west_commands/runners/core.py
  5. 2
      scripts/west_commands/runners/dediprog.py
  6. 6
      scripts/west_commands/runners/dfu.py
  7. 6
      scripts/west_commands/runners/esp32.py
  8. 2
      scripts/west_commands/runners/ezflashcli.py
  9. 2
      scripts/west_commands/runners/gd32isp.py
  10. 2
      scripts/west_commands/runners/hifive1.py
  11. 10
      scripts/west_commands/runners/intel_adsp.py
  12. 7
      scripts/west_commands/runners/intel_cyclonev.py
  13. 8
      scripts/west_commands/runners/jlink.py
  14. 3
      scripts/west_commands/runners/linkserver.py
  15. 4
      scripts/west_commands/runners/mdb.py
  16. 4
      scripts/west_commands/runners/misc.py
  17. 3
      scripts/west_commands/runners/native.py
  18. 2
      scripts/west_commands/runners/nios2.py
  19. 8
      scripts/west_commands/runners/nrf_common.py
  20. 3
      scripts/west_commands/runners/nrfjprog.py
  21. 5
      scripts/west_commands/runners/nrfutil.py
  22. 2
      scripts/west_commands/runners/nsim.py
  23. 3
      scripts/west_commands/runners/nxp_s32dbg.py
  24. 4
      scripts/west_commands/runners/openocd.py
  25. 2
      scripts/west_commands/runners/probe_rs.py
  26. 2
      scripts/west_commands/runners/pyocd.py
  27. 2
      scripts/west_commands/runners/qemu.py
  28. 3
      scripts/west_commands/runners/renode-robot.py
  29. 3
      scripts/west_commands/runners/renode.py
  30. 2
      scripts/west_commands/runners/silabs_commander.py
  31. 7
      scripts/west_commands/runners/spi_burn.py
  32. 6
      scripts/west_commands/runners/stm32cubeprogrammer.py
  33. 4
      scripts/west_commands/runners/stm32flash.py
  34. 1
      scripts/west_commands/runners/teensy.py
  35. 2
      scripts/west_commands/runners/uf2.py
  36. 4
      scripts/west_commands/runners/xsdb.py
  37. 2
      scripts/west_commands/runners/xtensa.py

2
scripts/west_commands/runners/blackmagicprobe.py

@ -11,7 +11,7 @@ import signal
import sys import sys
from pathlib import Path from pathlib import Path
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
try: try:
import serial.tools.list_ports import serial.tools.list_ports

2
scripts/west_commands/runners/bossac.py

@ -13,7 +13,7 @@ import subprocess
import sys import sys
import time import time
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
DEFAULT_BOSSAC_PORT = None DEFAULT_BOSSAC_PORT = None

2
scripts/west_commands/runners/canopen_program.py

@ -8,7 +8,7 @@ import argparse
import os import os
import time import time
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
try: try:
import canopen import canopen

2
scripts/west_commands/runners/core.py

@ -26,8 +26,8 @@ import socket
import subprocess import subprocess
import sys import sys
from dataclasses import dataclass, field from dataclasses import dataclass, field
from functools import partial
from enum import Enum from enum import Enum
from functools import partial
from inspect import isabstract from inspect import isabstract
from typing import NamedTuple, NoReturn from typing import NamedTuple, NoReturn

2
scripts/west_commands/runners/dediprog.py

@ -8,7 +8,7 @@
import platform import platform
import subprocess import subprocess
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
DPCMD_EXE = 'dpcmd.exe' if platform.system() == 'Windows' else 'dpcmd' DPCMD_EXE = 'dpcmd.exe' if platform.system() == 'Windows' else 'dpcmd'
DEFAULT_MAX_RETRIES = 3 DEFAULT_MAX_RETRIES = 3

6
scripts/west_commands/runners/dfu.py

@ -4,13 +4,11 @@
'''Runner for flashing with dfu-util.''' '''Runner for flashing with dfu-util.'''
from collections import namedtuple
import sys import sys
import time import time
from collections import namedtuple
from runners.core import ZephyrBinaryRunner, RunnerCaps, \ from runners.core import BuildConfiguration, RunnerCaps, ZephyrBinaryRunner
BuildConfiguration
DfuSeConfig = namedtuple('DfuSeConfig', ['address', 'options']) DfuSeConfig = namedtuple('DfuSeConfig', ['address', 'options'])

6
scripts/west_commands/runners/esp32.py

@ -5,12 +5,12 @@
'''Runner for flashing ESP32 devices with esptool/espidf.''' '''Runner for flashing ESP32 devices with esptool/espidf.'''
import os
import sys
from os import path from os import path
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
import os
import sys
class Esp32BinaryRunner(ZephyrBinaryRunner): class Esp32BinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for espidf.''' '''Runner front-end for espidf.'''

2
scripts/west_commands/runners/ezflashcli.py

@ -5,7 +5,7 @@
'''Runner for flashing with ezFlashCLI.''' '''Runner for flashing with ezFlashCLI.'''
import shlex import shlex
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
DEFAULT_EZFLASHCLI = "ezFlashCLI" DEFAULT_EZFLASHCLI = "ezFlashCLI"

2
scripts/west_commands/runners/gd32isp.py

@ -3,7 +3,7 @@
'''GigaDevice ISP tool (gd32isp) runner for serial boot ROM''' '''GigaDevice ISP tool (gd32isp) runner for serial boot ROM'''
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
DEFAULT_GD32ISP_CLI = 'GD32_ISP_Console' DEFAULT_GD32ISP_CLI = 'GD32_ISP_Console'
DEFAULT_GD32ISP_PORT = '/dev/ttyUSB0' DEFAULT_GD32ISP_PORT = '/dev/ttyUSB0'

2
scripts/west_commands/runners/hifive1.py

@ -6,7 +6,7 @@
from os import path from os import path
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
class HiFive1BinaryRunner(ZephyrBinaryRunner): class HiFive1BinaryRunner(ZephyrBinaryRunner):

10
scripts/west_commands/runners/intel_adsp.py

@ -5,15 +5,17 @@
'''Runner for flashing with the Intel ADSP boards.''' '''Runner for flashing with the Intel ADSP boards.'''
import argparse import argparse
import os
import sys
import re
import hashlib import hashlib
import os
import random import random
import re
import shutil import shutil
from runners.core import ZephyrBinaryRunner, RunnerCaps import sys
from zephyr_ext_common import ZEPHYR_BASE from zephyr_ext_common import ZEPHYR_BASE
from runners.core import RunnerCaps, ZephyrBinaryRunner
DEFAULT_CAVSTOOL='soc/intel/intel_adsp/tools/cavstool_client.py' DEFAULT_CAVSTOOL='soc/intel/intel_adsp/tools/cavstool_client.py'
class SignParamError(argparse.Action): class SignParamError(argparse.Action):

7
scripts/west_commands/runners/intel_cyclonev.py

@ -4,14 +4,13 @@
'''Modified openocd and gdb runner for Cyclone V SoC DevKit.''' '''Modified openocd and gdb runner for Cyclone V SoC DevKit.'''
import subprocess
import re
import os import os
import re
import subprocess
from os import path from os import path
from pathlib import Path from pathlib import Path
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
DEFAULT_OPENOCD_TCL_PORT = 6333 DEFAULT_OPENOCD_TCL_PORT = 6333
DEFAULT_OPENOCD_TELNET_PORT = 4444 DEFAULT_OPENOCD_TELNET_PORT = 4444

8
scripts/west_commands/runners/jlink.py

@ -8,15 +8,15 @@ import argparse
import ipaddress import ipaddress
import logging import logging
import os import os
from pathlib import Path
import shlex import shlex
import socket
import subprocess import subprocess
import sys import sys
import socket
import time
import tempfile import tempfile
import time
from pathlib import Path
from runners.core import ZephyrBinaryRunner, RunnerCaps, FileType from runners.core import FileType, RunnerCaps, ZephyrBinaryRunner
try: try:
import pylink import pylink

3
scripts/west_commands/runners/linkserver.py

@ -13,8 +13,7 @@ import shlex
import subprocess import subprocess
import sys import sys
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
DEFAULT_LINKSERVER_EXE = 'Linkserver.exe' if sys.platform == 'win32' else 'LinkServer' DEFAULT_LINKSERVER_EXE = 'Linkserver.exe' if sys.platform == 'win32' else 'LinkServer'
DEFAULT_LINKSERVER_GDB_PORT = 3333 DEFAULT_LINKSERVER_GDB_PORT = 3333

4
scripts/west_commands/runners/mdb.py

@ -5,11 +5,11 @@
'''Runners for Synopsys Metaware Debugger(mdb).''' '''Runners for Synopsys Metaware Debugger(mdb).'''
import shutil
import os import os
import shutil
from os import path from os import path
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
# normally we should create class with common functionality inherited from # normally we should create class with common functionality inherited from

4
scripts/west_commands/runners/misc.py

@ -10,9 +10,11 @@ you're willing to handle requests for help. E.g. if your "board" is a
core on a special-purpose SoC which requires a complicated script to core on a special-purpose SoC which requires a complicated script to
network boot.''' network boot.'''
from runners.core import ZephyrBinaryRunner, RunnerCaps
import argparse import argparse
from runners.core import RunnerCaps, ZephyrBinaryRunner
class MiscFlasher(ZephyrBinaryRunner): class MiscFlasher(ZephyrBinaryRunner):
'''Runner for handling special purpose flashing commands.''' '''Runner for handling special purpose flashing commands.'''

3
scripts/west_commands/runners/native.py

@ -5,7 +5,8 @@
flashing (running) a native application.""" flashing (running) a native application."""
import argparse import argparse
from runners.core import ZephyrBinaryRunner, RunnerCaps, RunnerConfig
from runners.core import RunnerCaps, RunnerConfig, ZephyrBinaryRunner
DEFAULT_GDB_PORT = 3333 DEFAULT_GDB_PORT = 3333

2
scripts/west_commands/runners/nios2.py

@ -4,7 +4,7 @@
'''Runner for NIOS II, based on quartus-flash.py and GDB.''' '''Runner for NIOS II, based on quartus-flash.py and GDB.'''
from runners.core import ZephyrBinaryRunner, NetworkPortHelper, RunnerCaps from runners.core import NetworkPortHelper, RunnerCaps, ZephyrBinaryRunner
class Nios2BinaryRunner(ZephyrBinaryRunner): class Nios2BinaryRunner(ZephyrBinaryRunner):

8
scripts/west_commands/runners/nrf_common.py

@ -6,22 +6,22 @@
'''Runner base class for flashing with nrf tools.''' '''Runner base class for flashing with nrf tools.'''
import abc import abc
from collections import deque
import contextlib import contextlib
import functools import functools
import os import os
from pathlib import Path
import shlex import shlex
import subprocess import subprocess
import sys import sys
from re import fullmatch, escape from collections import deque
from pathlib import Path
from re import escape, fullmatch
from zephyr_ext_common import ZEPHYR_BASE from zephyr_ext_common import ZEPHYR_BASE
sys.path.append(os.fspath(Path(__file__).parent.parent.parent)) sys.path.append(os.fspath(Path(__file__).parent.parent.parent))
import zephyr_module import zephyr_module
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
try: try:
from intelhex import IntelHex from intelhex import IntelHex

3
scripts/west_commands/runners/nrfjprog.py

@ -8,8 +8,7 @@
import subprocess import subprocess
import sys import sys
from runners.nrf_common import ErrNotAvailableBecauseProtection, ErrVerify, \ from runners.nrf_common import ErrNotAvailableBecauseProtection, ErrVerify, NrfBinaryRunner
NrfBinaryRunner
# https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf_cltools%2FUG%2Fcltools%2Fnrf_nrfjprogexe_return_codes.html&cp=9_1_3_1 # https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf_cltools%2FUG%2Fcltools%2Fnrf_nrfjprogexe_return_codes.html&cp=9_1_3_1
UnavailableOperationBecauseProtectionError = 16 UnavailableOperationBecauseProtectionError = 16

5
scripts/west_commands/runners/nrfutil.py

@ -6,13 +6,14 @@
import json import json
import os import os
from pathlib import Path
import sys
import subprocess import subprocess
import sys
from pathlib import Path
from runners.core import _DRY_RUN from runners.core import _DRY_RUN
from runners.nrf_common import NrfBinaryRunner from runners.nrf_common import NrfBinaryRunner
class NrfUtilBinaryRunner(NrfBinaryRunner): class NrfUtilBinaryRunner(NrfBinaryRunner):
'''Runner front-end for nrfutil.''' '''Runner front-end for nrfutil.'''

2
scripts/west_commands/runners/nsim.py

@ -7,7 +7,7 @@
from os import path from os import path
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
DEFAULT_ARC_GDB_PORT = 3333 DEFAULT_ARC_GDB_PORT = 3333
DEFAULT_PROPS_FILE = 'nsim_em.props' DEFAULT_PROPS_FILE = 'nsim_em.props'

3
scripts/west_commands/runners/nxp_s32dbg.py

@ -15,8 +15,7 @@ import tempfile
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
from runners.core import (BuildConfiguration, RunnerCaps, RunnerConfig, from runners.core import BuildConfiguration, RunnerCaps, RunnerConfig, ZephyrBinaryRunner
ZephyrBinaryRunner)
NXP_S32DBG_USB_CLASS = 'NXP Probes' NXP_S32DBG_USB_CLASS = 'NXP Probes'
NXP_S32DBG_USB_VID = 0x15a2 NXP_S32DBG_USB_VID = 0x15a2

4
scripts/west_commands/runners/openocd.py

@ -9,9 +9,9 @@
import re import re
import subprocess import subprocess
from os import path from os import path
from pathlib import Path from pathlib import Path
from zephyr_ext_common import ZEPHYR_BASE from zephyr_ext_common import ZEPHYR_BASE
try: # noqa SIM105 try: # noqa SIM105
@ -19,7 +19,7 @@ try: # noqa SIM105
except ImportError: except ImportError:
pass pass
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
DEFAULT_OPENOCD_TCL_PORT = 6333 DEFAULT_OPENOCD_TCL_PORT = 6333
DEFAULT_OPENOCD_TELNET_PORT = 4444 DEFAULT_OPENOCD_TELNET_PORT = 4444

2
scripts/west_commands/runners/probe_rs.py

@ -3,7 +3,7 @@
'''Runner for probe-rs.''' '''Runner for probe-rs.'''
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
class ProbeRsBinaryRunner(ZephyrBinaryRunner): class ProbeRsBinaryRunner(ZephyrBinaryRunner):

2
scripts/west_commands/runners/pyocd.py

@ -7,7 +7,7 @@
import os import os
from os import path from os import path
from runners.core import ZephyrBinaryRunner, RunnerCaps, BuildConfiguration from runners.core import BuildConfiguration, RunnerCaps, ZephyrBinaryRunner
DEFAULT_PYOCD_GDB_PORT = 3333 DEFAULT_PYOCD_GDB_PORT = 3333
DEFAULT_PYOCD_TELNET_PORT = 4444 DEFAULT_PYOCD_TELNET_PORT = 4444

2
scripts/west_commands/runners/qemu.py

@ -4,7 +4,7 @@
'''Runner stub for QEMU.''' '''Runner stub for QEMU.'''
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
class QemuBinaryRunner(ZephyrBinaryRunner): class QemuBinaryRunner(ZephyrBinaryRunner):

3
scripts/west_commands/runners/renode-robot.py

@ -5,7 +5,8 @@
'''Runner stub for renode-test.''' '''Runner stub for renode-test.'''
import subprocess import subprocess
from runners.core import ZephyrBinaryRunner, RunnerCaps
from runners.core import RunnerCaps, ZephyrBinaryRunner
class RenodeRobotRunner(ZephyrBinaryRunner): class RenodeRobotRunner(ZephyrBinaryRunner):

3
scripts/west_commands/runners/renode.py

@ -5,7 +5,8 @@
'''Runner stub for Renode.''' '''Runner stub for Renode.'''
import subprocess import subprocess
from runners.core import ZephyrBinaryRunner, RunnerCaps
from runners.core import RunnerCaps, ZephyrBinaryRunner
class RenodeRunner(ZephyrBinaryRunner): class RenodeRunner(ZephyrBinaryRunner):

2
scripts/west_commands/runners/silabs_commander.py

@ -11,8 +11,8 @@ See SiLabs UG162: "Simplicity Commander Reference Guide" for more info.
import os import os
import shlex import shlex
from runners.core import ZephyrBinaryRunner, RunnerCaps, FileType
from runners.core import FileType, RunnerCaps, ZephyrBinaryRunner
DEFAULT_APP = 'commander' DEFAULT_APP = 'commander'

7
scripts/west_commands/runners/spi_burn.py

@ -2,12 +2,13 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
import re
import os import os
import time import re
import subprocess import subprocess
import time
from runners.core import BuildConfiguration, RunnerCaps, ZephyrBinaryRunner
from runners.core import ZephyrBinaryRunner, RunnerCaps, BuildConfiguration
class SpiBurnBinaryRunner(ZephyrBinaryRunner): class SpiBurnBinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for SPI_burn.''' '''Runner front-end for SPI_burn.'''

6
scripts/west_commands/runners/stm32cubeprogrammer.py

@ -7,14 +7,14 @@
""" """
import argparse import argparse
from pathlib import Path
import platform
import os import os
import platform
import shlex import shlex
import shutil import shutil
from pathlib import Path
from typing import ClassVar from typing import ClassVar
from runners.core import ZephyrBinaryRunner, RunnerCaps, RunnerConfig from runners.core import RunnerCaps, RunnerConfig, ZephyrBinaryRunner
class STM32CubeProgrammerBinaryRunner(ZephyrBinaryRunner): class STM32CubeProgrammerBinaryRunner(ZephyrBinaryRunner):

4
scripts/west_commands/runners/stm32flash.py

@ -4,10 +4,10 @@
'''Runner for flashing with stm32flash.''' '''Runner for flashing with stm32flash.'''
from os import path
import platform import platform
from os import path
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
DEFAULT_DEVICE = '/dev/ttyUSB0' DEFAULT_DEVICE = '/dev/ttyUSB0'
if platform.system() == 'Darwin': if platform.system() == 'Darwin':

1
scripts/west_commands/runners/teensy.py

@ -9,6 +9,7 @@ import subprocess
from runners.core import ZephyrBinaryRunner from runners.core import ZephyrBinaryRunner
class TeensyBinaryRunner(ZephyrBinaryRunner): class TeensyBinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for teensy.''' '''Runner front-end for teensy.'''

2
scripts/west_commands/runners/uf2.py

@ -7,7 +7,7 @@
from pathlib import Path from pathlib import Path
from shutil import copy from shutil import copy
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
try: try:
import psutil import psutil

4
scripts/west_commands/runners/xsdb.py

@ -7,7 +7,9 @@
""" """
import argparse import argparse
import os import os
from runners.core import ZephyrBinaryRunner, RunnerCaps, RunnerConfig
from runners.core import RunnerCaps, RunnerConfig, ZephyrBinaryRunner
class XSDBBinaryRunner(ZephyrBinaryRunner): class XSDBBinaryRunner(ZephyrBinaryRunner):
def __init__(self, cfg: RunnerConfig, config=None, bitstream=None, def __init__(self, cfg: RunnerConfig, config=None, bitstream=None,

2
scripts/west_commands/runners/xtensa.py

@ -6,7 +6,7 @@
from os import path from os import path
from runners.core import ZephyrBinaryRunner, RunnerCaps from runners.core import RunnerCaps, ZephyrBinaryRunner
class XtensaBinaryRunner(ZephyrBinaryRunner): class XtensaBinaryRunner(ZephyrBinaryRunner):

Loading…
Cancel
Save