summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2023-02-03 13:33:43 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-03 22:37:08 +0000
commitbb1bf345d928a602916bed6eefef4a317a577849 (patch)
tree35fc57378a9472c84a9450284090d7cb3d37f970
parent989f9d24a097a8da7de10c5f765f3718597ac73c (diff)
downloadchrome-ec-bb1bf345d928a602916bed6eefef4a317a577849.tar.gz
ec: Use chromite isort config
Remove the .isort.cfg from platform/ec and use the one from chromite instead. This should be compatible with cros format. BRANCH=None BUG=b:267757300 TEST=Ran firmware_builder.py Change-Id: Ice4955b6995bd1f9380e97f58e89efb7c1e8aeb1 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4221928 Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--.isort.cfg2
-rwxr-xr-xchip/ish/util/pack_ec.py1
-rwxr-xr-xchip/mchp/util/pack_ec.py1
-rwxr-xr-xchip/mchp/util/pack_ec_mec152x.py1
-rwxr-xr-xchip/mchp/util/pack_ec_mec172x.py1
-rw-r--r--cts/common/board.py3
-rwxr-xr-xcts/cts.py1
-rwxr-xr-xextra/cr50_rma_open/cr50_rma_open.py1
-rwxr-xr-xextra/stack_analyzer/stack_analyzer.py1
-rw-r--r--extra/tigertool/ecusb/pty_driver.py1
-rw-r--r--extra/tigertool/ecusb/tiny_servo_common.py3
-rw-r--r--extra/tigertool/ecusb/tiny_servod.py3
-rwxr-xr-xextra/tigertool/tigertest.py1
-rwxr-xr-xextra/tigertool/tigertool.py1
-rwxr-xr-xextra/usb_power/powerlog.py5
-rw-r--r--extra/usb_power/stats_manager.py1
-rwxr-xr-xextra/usb_serial/console.py1
-rwxr-xr-xextra/usb_updater/fw_update.py5
-rwxr-xr-xextra/usb_updater/servo_updater.py2
-rwxr-xr-xfirmware_builder.py10
-rw-r--r--setup.py1
-rwxr-xr-xtest/run_device_tests.py12
-rw-r--r--test/timer_jump.py1
-rwxr-xr-xutil/build_with_clang.py3
-rwxr-xr-xutil/check_zephyr_project_config.py2
-rwxr-xr-xutil/check_zephyr_project_config_unittest.py1
-rwxr-xr-xutil/clangd_config.py2
-rwxr-xr-xutil/crash_analyzer.py1
-rwxr-xr-xutil/ec3po/console.py6
-rwxr-xr-xutil/ec3po/console_unittest.py5
-rw-r--r--util/ec3po/interpreter.py1
-rwxr-xr-xutil/ec3po/interpreter_unittest.py3
-rw-r--r--util/ec3po/threadproc_shim.py1
-rwxr-xr-xutil/ec_openocd.py1
-rwxr-xr-xutil/flash_jlink.py1
-rwxr-xr-xutil/inject-keys.py1
-rwxr-xr-xutil/kconfig_check.py1
-rwxr-xr-xutil/lcov_stencil.py3
-rw-r--r--util/run_ects.py1
-rw-r--r--util/test_kconfig_check.py1
-rwxr-xr-xutil/twister_launcher.py4
-rwxr-xr-xutil/twister_tags.py1
-rwxr-xr-xutil/uart_stress_tester.py5
-rwxr-xr-xutil/update_release_branch.py1
-rwxr-xr-xzephyr/firmware_builder.py4
-rw-r--r--zephyr/zmake/setup.py1
-rw-r--r--zephyr/zmake/tests/conftest.py1
-rw-r--r--zephyr/zmake/tests/test_build_config.py3
-rw-r--r--zephyr/zmake/tests/test_jobserver.py2
-rw-r--r--zephyr/zmake/tests/test_modules.py1
-rw-r--r--zephyr/zmake/tests/test_packers.py1
-rw-r--r--zephyr/zmake/tests/test_project.py1
-rw-r--r--zephyr/zmake/tests/test_toolchains.py1
-rw-r--r--zephyr/zmake/tests/test_util.py1
-rw-r--r--zephyr/zmake/tests/test_version.py1
-rw-r--r--zephyr/zmake/tests/test_zmake.py3
-rw-r--r--zephyr/zmake/zmake/multiproc.py1
-rw-r--r--zephyr/zmake/zmake/output_packers.py2
-rw-r--r--zephyr/zmake/zmake/zmake.py1
59 files changed, 94 insertions, 34 deletions
diff --git a/.isort.cfg b/.isort.cfg
deleted file mode 100644
index b9fb3f3e8c..0000000000
--- a/.isort.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[settings]
-profile=black
diff --git a/chip/ish/util/pack_ec.py b/chip/ish/util/pack_ec.py
index 7f381005f0..13a2afafd9 100755
--- a/chip/ish/util/pack_ec.py
+++ b/chip/ish/util/pack_ec.py
@@ -20,6 +20,7 @@ each binaries into right memory location.
import argparse
import struct
+
MANIFEST_ENTRY_SIZE = 0x80
HEADER_SIZE = 0x1000
PAGE_SIZE = 0x1000
diff --git a/chip/mchp/util/pack_ec.py b/chip/mchp/util/pack_ec.py
index 1b0a2e9959..8991718cf9 100755
--- a/chip/mchp/util/pack_ec.py
+++ b/chip/mchp/util/pack_ec.py
@@ -14,6 +14,7 @@ import subprocess
import tempfile
import zlib # CRC32
+
# MEC1701 has 256KB SRAM from 0xE0000 - 0x120000
# SRAM is divided into contiguous CODE & DATA
# CODE at [0xE0000, 0x117FFF] DATA at [0x118000, 0x11FFFF]
diff --git a/chip/mchp/util/pack_ec_mec152x.py b/chip/mchp/util/pack_ec_mec152x.py
index a463a43b6c..43721b3336 100755
--- a/chip/mchp/util/pack_ec_mec152x.py
+++ b/chip/mchp/util/pack_ec_mec152x.py
@@ -14,6 +14,7 @@ import subprocess
import tempfile
import zlib # CRC32
+
# MEC152xH has 256KB SRAM from 0xE0000 - 0x120000
# SRAM is divided into contiguous CODE & DATA
# CODE at [0xE0000, 0x117FFF] DATA at [0x118000, 0x11FFFF]
diff --git a/chip/mchp/util/pack_ec_mec172x.py b/chip/mchp/util/pack_ec_mec172x.py
index 6bd2db984b..a8e867888c 100755
--- a/chip/mchp/util/pack_ec_mec172x.py
+++ b/chip/mchp/util/pack_ec_mec172x.py
@@ -14,6 +14,7 @@ import subprocess
import tempfile
import zlib # CRC32
+
# MEC172x has 416KB SRAM from 0xC0000 - 0x127FFF
# SRAM is divided into contiguous CODE & DATA
# CODE at [0xC0000, 0x117FFF] DATA at [0x118000, 0x127FFF]
diff --git a/cts/common/board.py b/cts/common/board.py
index 3f92ff50ad..d04f73fe5f 100644
--- a/cts/common/board.py
+++ b/cts/common/board.py
@@ -6,14 +6,15 @@
from __future__ import print_function
+from abc import ABCMeta, abstractmethod
import os
import shutil
import subprocess as sp
-from abc import ABCMeta, abstractmethod
import serial # pylint:disable=import-error
import six
+
OCD_SCRIPT_DIR = "/usr/share/openocd/scripts"
OPENOCD_CONFIGS = {
"stm32l476g-eval": "board/stm32l4discovery.cfg",
diff --git a/cts/cts.py b/cts/cts.py
index f61de47398..619c8858c2 100755
--- a/cts/cts.py
+++ b/cts/cts.py
@@ -27,6 +27,7 @@ import time
import common.board as board
+
CTS_RC_PREFIX = "CTS_RC_"
DEFAULT_TH = "stm32l476g-eval"
DEFAULT_DUT = "nucleo-f072rb"
diff --git a/extra/cr50_rma_open/cr50_rma_open.py b/extra/cr50_rma_open/cr50_rma_open.py
index dc9c144158..14cd26134f 100755
--- a/extra/cr50_rma_open/cr50_rma_open.py
+++ b/extra/cr50_rma_open/cr50_rma_open.py
@@ -52,6 +52,7 @@ import time
import serial # pylint:disable=import-error
+
SCRIPT_VERSION = 5
CCD_IS_UNRESTRICTED = 1 << 0
WP_IS_DISABLED = 1 << 1
diff --git a/extra/stack_analyzer/stack_analyzer.py b/extra/stack_analyzer/stack_analyzer.py
index 2431545c6a..72db999cd4 100755
--- a/extra/stack_analyzer/stack_analyzer.py
+++ b/extra/stack_analyzer/stack_analyzer.py
@@ -24,6 +24,7 @@ import subprocess
import yaml # pylint:disable=import-error
+
SECTION_RO = "RO"
SECTION_RW = "RW"
# Default size of extra stack frame needed by exception context switch.
diff --git a/extra/tigertool/ecusb/pty_driver.py b/extra/tigertool/ecusb/pty_driver.py
index 723bf41b57..da9ed4ab25 100644
--- a/extra/tigertool/ecusb/pty_driver.py
+++ b/extra/tigertool/ecusb/pty_driver.py
@@ -18,6 +18,7 @@ import time
import pexpect # pylint:disable=import-error
from pexpect import fdpexpect # pylint:disable=import-error
+
# Expecting a result in 3 seconds is plenty even for slow platforms.
DEFAULT_UART_TIMEOUT = 3
FLUSH_UART_TIMEOUT = 1
diff --git a/extra/tigertool/ecusb/tiny_servo_common.py b/extra/tigertool/ecusb/tiny_servo_common.py
index fc028104ed..2d87cf043c 100644
--- a/extra/tigertool/ecusb/tiny_servo_common.py
+++ b/extra/tigertool/ecusb/tiny_servo_common.py
@@ -13,7 +13,8 @@ import time
import six
import usb # pylint:disable=import-error
-from . import pty_driver, stm32uart
+from . import pty_driver
+from . import stm32uart
def get_subprocess_args():
diff --git a/extra/tigertool/ecusb/tiny_servod.py b/extra/tigertool/ecusb/tiny_servod.py
index f8d61b5305..ca84b4474a 100644
--- a/extra/tigertool/ecusb/tiny_servod.py
+++ b/extra/tigertool/ecusb/tiny_servod.py
@@ -4,7 +4,8 @@
"""Helper class to facilitate communication to servo ec console."""
-from ecusb import pty_driver, stm32uart
+from ecusb import pty_driver
+from ecusb import stm32uart
class TinyServod(object):
diff --git a/extra/tigertool/tigertest.py b/extra/tigertool/tigertest.py
index b1186cca77..637652de5c 100755
--- a/extra/tigertool/tigertest.py
+++ b/extra/tigertool/tigertest.py
@@ -9,6 +9,7 @@ import argparse
import subprocess
import sys
+
# Script to control tigertail USB-C Mux board.
#
# optional arguments:
diff --git a/extra/tigertool/tigertool.py b/extra/tigertool/tigertool.py
index 69303aa02a..f036000afe 100755
--- a/extra/tigertool/tigertool.py
+++ b/extra/tigertool/tigertool.py
@@ -13,6 +13,7 @@ import time
import ecusb.tiny_servo_common as c
+
STM_VIDPID = "18d1:5027"
serialno = "Uninitialized"
diff --git a/extra/usb_power/powerlog.py b/extra/usb_power/powerlog.py
index 13e41bd23a..ded8d83215 100755
--- a/extra/usb_power/powerlog.py
+++ b/extra/usb_power/powerlog.py
@@ -13,6 +13,7 @@ from __future__ import print_function
import argparse
import array
+from distutils import sysconfig
import json
import logging
import os
@@ -21,10 +22,10 @@ import struct
import sys
import time
import traceback
-from distutils import sysconfig
-import usb # pylint:disable=import-error
from stats_manager import StatsManager # pylint:disable=import-error
+import usb # pylint:disable=import-error
+
# Directory where hdctools installs configuration files into.
LIB_DIR = os.path.join(
diff --git a/extra/usb_power/stats_manager.py b/extra/usb_power/stats_manager.py
index 2035138731..fc24ef6cae 100644
--- a/extra/usb_power/stats_manager.py
+++ b/extra/usb_power/stats_manager.py
@@ -16,6 +16,7 @@ import os
import numpy # pylint:disable=import-error
+
STATS_PREFIX = "@@"
NAN_TAG = "*"
NAN_DESCRIPTION = "%s domains contain NaN samples" % NAN_TAG
diff --git a/extra/usb_serial/console.py b/extra/usb_serial/console.py
index 2b0ecd5f13..07444c39f3 100755
--- a/extra/usb_serial/console.py
+++ b/extra/usb_serial/console.py
@@ -18,6 +18,7 @@ import threading
import time
import tty
+
try:
import usb # pylint:disable=import-error
except ModuleNotFoundError:
diff --git a/extra/usb_updater/fw_update.py b/extra/usb_updater/fw_update.py
index a77de94a7c..08d579e311 100755
--- a/extra/usb_updater/fw_update.py
+++ b/extra/usb_updater/fw_update.py
@@ -12,13 +12,14 @@ import argparse
import array
import json
import os
+from pprint import pprint
import struct
import sys
import time
-from pprint import pprint
-import usb # pylint:disable=import-error
from ecusb.stm32usb import SusbError
+import usb # pylint:disable=import-error
+
debug = False
diff --git a/extra/usb_updater/servo_updater.py b/extra/usb_updater/servo_updater.py
index c0be11fdde..e53eaac85e 100755
--- a/extra/usb_updater/servo_updater.py
+++ b/extra/usb_updater/servo_updater.py
@@ -16,9 +16,9 @@ import re
import subprocess
import time
+from ecusb import tiny_servod
import ecusb.tiny_servo_common as c
import fw_update
-from ecusb import tiny_servod
class ServoUpdaterException(Exception):
diff --git a/firmware_builder.py b/firmware_builder.py
index dfe1161c59..2fcccd6476 100755
--- a/firmware_builder.py
+++ b/firmware_builder.py
@@ -17,11 +17,12 @@ import shutil
import subprocess
import sys
-from chromite.api.gen_sdk.chromite.api import firmware_pb2
-
# pylint: disable=import-error
from google.protobuf import json_format
+from chromite.api.gen_sdk.chromite.api import firmware_pb2
+
+
DEFAULT_BUNDLE_DIRECTORY = "/tmp/artifact_bundles"
DEFAULT_BUNDLE_METADATA_FILE = "/tmp/artifact_bundle_metadata"
@@ -61,15 +62,17 @@ def build(opts):
message.
"""
metric_list = firmware_pb2.FwBuildMetricList()
+ ec_dir = pathlib.Path(__file__).parent
# Run formatting checks on all python files.
subprocess.run(
["black", "--check", "."], cwd=os.path.dirname(__file__), check=True
)
+ chromite_dir = ec_dir.resolve().parent.parent.parent / "chromite"
subprocess.run(
[
"isort",
- "--settings-file=.isort.cfg",
+ f"--settings-file={chromite_dir / '.isort.cfg'}",
"--check",
"--gitignore",
"--dont-follow-links",
@@ -88,7 +91,6 @@ def build(opts):
file.write(json_format.MessageToJson(metric_list))
return
- ec_dir = pathlib.Path(__file__).parent
subprocess.run([ec_dir / "util" / "check_clang_format.py"], check=True)
cmd = ["make", "clobber"]
diff --git a/setup.py b/setup.py
index 51ab1cff64..031894cfe0 100644
--- a/setup.py
+++ b/setup.py
@@ -4,6 +4,7 @@
from setuptools import setup
+
setup(
name="ec3po",
version="1.0.0rc1",
diff --git a/test/run_device_tests.py b/test/run_device_tests.py
index a2277afd4f..6e89bb2452 100755
--- a/test/run_device_tests.py
+++ b/test/run_device_tests.py
@@ -40,24 +40,26 @@ Run the script on the remote machine:
import argparse
import concurrent
+from concurrent.futures.thread import ThreadPoolExecutor
+from dataclasses import dataclass
+from dataclasses import field
+from enum import Enum
import io
import logging
import os
+from pathlib import Path
import re
import socket
import subprocess
import sys
import time
-from concurrent.futures.thread import ThreadPoolExecutor
-from dataclasses import dataclass, field
-from enum import Enum
-from pathlib import Path
from typing import BinaryIO, Dict, List, Optional, Tuple
# pylint: disable=import-error
import colorama # type: ignore[import]
-import fmap
from contextlib2 import ExitStack
+import fmap
+
# pylint: enable=import-error
diff --git a/test/timer_jump.py b/test/timer_jump.py
index a4350cecdf..bd2310f3d7 100644
--- a/test/timer_jump.py
+++ b/test/timer_jump.py
@@ -7,6 +7,7 @@
import time
+
DELAY = 5
ERROR_MARGIN = 0.5
diff --git a/util/build_with_clang.py b/util/build_with_clang.py
index 79ba1072fd..bf1f452008 100755
--- a/util/build_with_clang.py
+++ b/util/build_with_clang.py
@@ -7,6 +7,7 @@
"""Build firmware with clang instead of gcc."""
import argparse
import concurrent
+from concurrent.futures import ThreadPoolExecutor
import logging
import multiprocessing
import os
@@ -14,7 +15,7 @@ import shutil
import subprocess
import sys
import typing
-from concurrent.futures import ThreadPoolExecutor
+
# Add to this list as compilation errors are fixed for boards.
BOARDS_THAT_COMPILE_SUCCESSFULLY_WITH_CLANG = [
diff --git a/util/check_zephyr_project_config.py b/util/check_zephyr_project_config.py
index be90e8092f..d879a9f04e 100755
--- a/util/check_zephyr_project_config.py
+++ b/util/check_zephyr_project_config.py
@@ -14,6 +14,7 @@ import site
import sys
import tempfile
+
EC_BASE = pathlib.Path(__file__).parent.parent
if "ZEPHYR_BASE" in os.environ:
@@ -35,6 +36,7 @@ site.addsitedir(ZEPHYR_BASE / "scripts" / "kconfig")
import kconfiglib
import zephyr_module
+
# pylint:enable=import-error,wrong-import-position
# Known configuration file extensions.
diff --git a/util/check_zephyr_project_config_unittest.py b/util/check_zephyr_project_config_unittest.py
index ad28d8e128..d881cc5a91 100755
--- a/util/check_zephyr_project_config_unittest.py
+++ b/util/check_zephyr_project_config_unittest.py
@@ -13,6 +13,7 @@ import unittest
import check_zephyr_project_config
import mock # pylint:disable=import-error
+
# pylint:disable=protected-access
diff --git a/util/clangd_config.py b/util/clangd_config.py
index 1e013b4159..e9b23e3a04 100755
--- a/util/clangd_config.py
+++ b/util/clangd_config.py
@@ -10,10 +10,10 @@ import argparse
import glob
import multiprocessing
import os
+from pathlib import Path
import shutil
import subprocess
import sys
-from pathlib import Path
from typing import List, Optional
diff --git a/util/crash_analyzer.py b/util/crash_analyzer.py
index 88592f800a..d564984500 100755
--- a/util/crash_analyzer.py
+++ b/util/crash_analyzer.py
@@ -10,6 +10,7 @@ import pathlib
import re
import sys
+
# TODO(b/253492108): Add regexp for missing architectures.
# Regex tested here: https://regex101.com/r/K5S8cB/1
_REGEX_CORTEX_M0 = (
diff --git a/util/ec3po/console.py b/util/ec3po/console.py
index 12b31baa60..cc822a7073 100755
--- a/util/ec3po/console.py
+++ b/util/ec3po/console.py
@@ -17,6 +17,7 @@ from __future__ import print_function
import argparse
import binascii
import ctypes
+from datetime import datetime
import logging
import os
import pty
@@ -25,10 +26,11 @@ import select
import stat
import sys
import traceback
-from datetime import datetime
+from ec3po import interpreter
+from ec3po import threadproc_shim
import six
-from ec3po import interpreter, threadproc_shim
+
PROMPT = b"> "
CONSOLE_INPUT_LINE_SIZE = 80 # Taken from the CONFIG_* with the same name.
diff --git a/util/ec3po/console_unittest.py b/util/ec3po/console_unittest.py
index e2a3d588fd..dfa411f3c8 100755
--- a/util/ec3po/console_unittest.py
+++ b/util/ec3po/console_unittest.py
@@ -14,9 +14,12 @@ import logging
import tempfile
import unittest
+from ec3po import console
+from ec3po import interpreter
+from ec3po import threadproc_shim
import mock # pylint:disable=import-error
import six
-from ec3po import console, interpreter, threadproc_shim
+
ESC_STRING = six.int2byte(console.ControlKey.ESC)
diff --git a/util/ec3po/interpreter.py b/util/ec3po/interpreter.py
index 8d21af247a..16c047039b 100644
--- a/util/ec3po/interpreter.py
+++ b/util/ec3po/interpreter.py
@@ -25,6 +25,7 @@ import traceback
import six
+
COMMAND_RETRIES = 3 # Number of attempts to retry a command.
EC_MAX_READ = 1024 # Max bytes to read at a time from the EC.
EC_SYN = b"\xec" # Byte indicating EC interrogation.
diff --git a/util/ec3po/interpreter_unittest.py b/util/ec3po/interpreter_unittest.py
index e8f19e2e46..a6bfd3baec 100755
--- a/util/ec3po/interpreter_unittest.py
+++ b/util/ec3po/interpreter_unittest.py
@@ -13,9 +13,10 @@ import logging
import tempfile
import unittest
+from ec3po import interpreter
+from ec3po import threadproc_shim
import mock # pylint:disable=import-error
import six
-from ec3po import interpreter, threadproc_shim
def GetBuiltins(func):
diff --git a/util/ec3po/threadproc_shim.py b/util/ec3po/threadproc_shim.py
index f76841dbf7..b468de1535 100644
--- a/util/ec3po/threadproc_shim.py
+++ b/util/ec3po/threadproc_shim.py
@@ -38,6 +38,7 @@ from threading import Thread as ThreadOrProcess
from six.moves.queue import Queue
+
# True if this module has ec3po using subprocesses, False if using threads.
USING_SUBPROCS = False
diff --git a/util/ec_openocd.py b/util/ec_openocd.py
index e0a15bd08b..4d114d4343 100755
--- a/util/ec_openocd.py
+++ b/util/ec_openocd.py
@@ -12,6 +12,7 @@ import subprocess
import sys
import time
+
"""
Flashes and debugs the EC through openocd
"""
diff --git a/util/flash_jlink.py b/util/flash_jlink.py
index dc462e354b..9f4a55e544 100755
--- a/util/flash_jlink.py
+++ b/util/flash_jlink.py
@@ -25,6 +25,7 @@ import sys
import tempfile
import time
+
DEFAULT_SEGGER_REMOTE_PORT = 19020
# Commands are documented here: https://wiki.segger.com/J-Link_Commander
diff --git a/util/inject-keys.py b/util/inject-keys.py
index 7ff72ea134..71eb7a3281 100755
--- a/util/inject-keys.py
+++ b/util/inject-keys.py
@@ -13,6 +13,7 @@ import string
import subprocess
import sys
+
KEYMATRIX = {
"`": (3, 1),
"1": (6, 1),
diff --git a/util/kconfig_check.py b/util/kconfig_check.py
index f3d127175c..1b67f0c846 100755
--- a/util/kconfig_check.py
+++ b/util/kconfig_check.py
@@ -27,6 +27,7 @@ import re
import sys
import traceback
+
# Try to use kconfiglib if available, but fall back to a simple recursive grep.
# This is used by U-Boot in some situations so we keep it to avoid forking this
# script.
diff --git a/util/lcov_stencil.py b/util/lcov_stencil.py
index 12d613c6a4..ba08f0ccaa 100755
--- a/util/lcov_stencil.py
+++ b/util/lcov_stencil.py
@@ -13,12 +13,13 @@ https://github.com/linux-test-project/lcov/blob/master/bin/geninfo
"""
import argparse
+from collections import defaultdict
import logging
import re
import sys
-from collections import defaultdict
from typing import Dict, Set
+
EXTRACT_LINE = re.compile(r"^(FN|DA|BRDA):(\d+),")
EXTRACT_FN = re.compile(r"^(FN):(\d+),(\S+)")
EXTRACT_FNDA = re.compile(r"^(FNDA):(\d+),(\S+)")
diff --git a/util/run_ects.py b/util/run_ects.py
index a3bf4d295c..e9ab944938 100644
--- a/util/run_ects.py
+++ b/util/run_ects.py
@@ -11,6 +11,7 @@ import os
import subprocess
import sys
+
# List of tests to run.
TESTS = ["meta", "gpio", "hook", "i2c", "interrupt", "mutex", "task", "timer"]
diff --git a/util/test_kconfig_check.py b/util/test_kconfig_check.py
index 3e459006b1..e30df416fb 100644
--- a/util/test_kconfig_check.py
+++ b/util/test_kconfig_check.py
@@ -14,6 +14,7 @@ import unittest
import kconfig_check
+
# Prefix that we strip from each Kconfig option, when considering whether it is
# equivalent to a CONFIG option with the same name
PREFIX = "PLATFORM_EC_"
diff --git a/util/twister_launcher.py b/util/twister_launcher.py
index 2d6fe9616a..9178b142d9 100755
--- a/util/twister_launcher.py
+++ b/util/twister_launcher.py
@@ -82,16 +82,16 @@ import argparse
import json
import os
import pathlib
+from pathlib import Path
import re
import shlex
import shutil
+from shutil import which
import socket
import subprocess
import sys
import tempfile
import time
-from pathlib import Path
-from shutil import which
def find_checkout() -> Path:
diff --git a/util/twister_tags.py b/util/twister_tags.py
index 68ac5846bd..851c526bac 100755
--- a/util/twister_tags.py
+++ b/util/twister_tags.py
@@ -24,6 +24,7 @@ import sys
import yaml # pylint: disable=import-error
+
TAG_TO_DESCRIPTION = {
"common": "Directly test shared code in the ec/common dir",
"mkbp": "Testing the MKBP (Matrix Keyboard Protocol) stack",
diff --git a/util/uart_stress_tester.py b/util/uart_stress_tester.py
index 8abb71d144..2e96174930 100755
--- a/util/uart_stress_tester.py
+++ b/util/uart_stress_tester.py
@@ -17,7 +17,9 @@ Prerequisite:
e.g. dut-control cr50_uart_timestamp:off
"""
-from __future__ import absolute_import, division, print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
import argparse
import atexit
@@ -30,6 +32,7 @@ import time
import serial # pylint:disable=import-error
+
BAUDRATE = 115200 # Default baudrate setting for UART port
CROS_USERNAME = "root" # Account name to login to ChromeOS
CROS_PASSWORD = "test0000" # Password to login to ChromeOS
diff --git a/util/update_release_branch.py b/util/update_release_branch.py
index 939d572dc4..93527c312c 100755
--- a/util/update_release_branch.py
+++ b/util/update_release_branch.py
@@ -19,6 +19,7 @@ import subprocess
import sys
import textwrap
+
BUG_NONE_PATTERN = re.compile("none", flags=re.IGNORECASE)
diff --git a/zephyr/firmware_builder.py b/zephyr/firmware_builder.py
index aa470ea583..830f774afd 100755
--- a/zephyr/firmware_builder.py
+++ b/zephyr/firmware_builder.py
@@ -16,9 +16,11 @@ import shlex
import subprocess
import sys
+from google.protobuf import json_format # pylint: disable=import-error
import zmake.project
+
from chromite.api.gen_sdk.chromite.api import firmware_pb2
-from google.protobuf import json_format # pylint: disable=import-error
+
DEFAULT_BUNDLE_DIRECTORY = "/tmp/artifact_bundles"
DEFAULT_BUNDLE_METADATA_FILE = "/tmp/artifact_bundle_metadata"
diff --git a/zephyr/zmake/setup.py b/zephyr/zmake/setup.py
index b7e58ef803..6e986ef8d0 100644
--- a/zephyr/zmake/setup.py
+++ b/zephyr/zmake/setup.py
@@ -5,6 +5,7 @@
"""Configuration to allow pip install."""
import setuptools
+
setuptools.setup(
name="zephyr-chrome-utils",
version="0.1",
diff --git a/zephyr/zmake/tests/conftest.py b/zephyr/zmake/tests/conftest.py
index dfea10457c..af56f794cc 100644
--- a/zephyr/zmake/tests/conftest.py
+++ b/zephyr/zmake/tests/conftest.py
@@ -11,6 +11,7 @@ import hypothesis # pylint:disable=import-error
import pytest # pylint:disable=import-error
import zmake.zmake as zm
+
hypothesis.settings.register_profile(
"cq", suppress_health_check=hypothesis.HealthCheck.all()
)
diff --git a/zephyr/zmake/tests/test_build_config.py b/zephyr/zmake/tests/test_build_config.py
index f0497fc4d5..6b4ab203b6 100644
--- a/zephyr/zmake/tests/test_build_config.py
+++ b/zephyr/zmake/tests/test_build_config.py
@@ -13,9 +13,10 @@ import tempfile
import hypothesis # pylint:disable=import-error
import hypothesis.strategies as st # pylint:disable=import-error
import pytest # pylint:disable=import-error
+from zmake.build_config import BuildConfig
import zmake.jobserver
import zmake.util as util
-from zmake.build_config import BuildConfig
+
# pylint:disable=redefined-outer-name,unused-argument
diff --git a/zephyr/zmake/tests/test_jobserver.py b/zephyr/zmake/tests/test_jobserver.py
index a79e6dc280..d9f4f63163 100644
--- a/zephyr/zmake/tests/test_jobserver.py
+++ b/zephyr/zmake/tests/test_jobserver.py
@@ -4,10 +4,10 @@
"""Test jobserver functionality."""
+from asyncio import subprocess
import logging
import os
import threading
-from asyncio import subprocess
import pytest # pylint:disable=import-error
import zmake.jobserver
diff --git a/zephyr/zmake/tests/test_modules.py b/zephyr/zmake/tests/test_modules.py
index dc4c170535..a42192d789 100644
--- a/zephyr/zmake/tests/test_modules.py
+++ b/zephyr/zmake/tests/test_modules.py
@@ -11,6 +11,7 @@ import hypothesis # pylint:disable=import-error
import hypothesis.strategies as st # pylint:disable=import-error
import zmake.modules
+
module_lists = st.lists(
st.one_of(*map(st.just, zmake.modules.known_modules)), unique=True
)
diff --git a/zephyr/zmake/tests/test_packers.py b/zephyr/zmake/tests/test_packers.py
index 23bdb2bf6b..441e5db7e6 100644
--- a/zephyr/zmake/tests/test_packers.py
+++ b/zephyr/zmake/tests/test_packers.py
@@ -12,6 +12,7 @@ import hypothesis.strategies as st # pylint:disable=import-error
import pytest # pylint:disable=import-error
import zmake.output_packers as packers
+
# Strategies for use with hypothesis
absolute_path = st.from_regex(regex=r"\A/[\w/]*\Z")
diff --git a/zephyr/zmake/tests/test_project.py b/zephyr/zmake/tests/test_project.py
index 3225de1d75..661072959d 100644
--- a/zephyr/zmake/tests/test_project.py
+++ b/zephyr/zmake/tests/test_project.py
@@ -15,6 +15,7 @@ import zmake.modules
import zmake.output_packers
import zmake.project
+
board_names = st.text(alphabet=set(string.ascii_lowercase) | {"_"}, min_size=1)
sets_of_board_names = st.lists(st.lists(board_names, unique=True))
diff --git a/zephyr/zmake/tests/test_toolchains.py b/zephyr/zmake/tests/test_toolchains.py
index 703149179c..2a71fd0d60 100644
--- a/zephyr/zmake/tests/test_toolchains.py
+++ b/zephyr/zmake/tests/test_toolchains.py
@@ -12,6 +12,7 @@ import zmake.output_packers
import zmake.project as project
import zmake.toolchains as toolchains
+
# pylint:disable=redefined-outer-name,unused-argument
diff --git a/zephyr/zmake/tests/test_util.py b/zephyr/zmake/tests/test_util.py
index c5efa2d18e..70378073d4 100644
--- a/zephyr/zmake/tests/test_util.py
+++ b/zephyr/zmake/tests/test_util.py
@@ -12,6 +12,7 @@ import hypothesis.strategies as st # pylint:disable=import-error
import pytest # pylint:disable=import-error
import zmake.util as util
+
# Strategies for use with hypothesis
version_integers = st.integers(min_value=0)
version_tuples = st.tuples(version_integers, version_integers, version_integers)
diff --git a/zephyr/zmake/tests/test_version.py b/zephyr/zmake/tests/test_version.py
index d6202c0d85..8881522e4b 100644
--- a/zephyr/zmake/tests/test_version.py
+++ b/zephyr/zmake/tests/test_version.py
@@ -13,6 +13,7 @@ import zmake.output_packers
import zmake.project
import zmake.version as version
+
# pylint:disable=redefined-outer-name,unused-argument
diff --git a/zephyr/zmake/tests/test_zmake.py b/zephyr/zmake/tests/test_zmake.py
index ff528edb8f..8fd39f1e9e 100644
--- a/zephyr/zmake/tests/test_zmake.py
+++ b/zephyr/zmake/tests/test_zmake.py
@@ -11,13 +11,14 @@ import re
import unittest.mock
import pytest # pylint:disable=import-error
+from testfixtures import LogCapture # pylint:disable=import-error
import zmake.build_config
import zmake.jobserver
import zmake.multiproc as multiproc
import zmake.output_packers
import zmake.project
import zmake.toolchains
-from testfixtures import LogCapture # pylint:disable=import-error
+
OUR_PATH = os.path.dirname(os.path.realpath(__file__))
diff --git a/zephyr/zmake/zmake/multiproc.py b/zephyr/zmake/zmake/multiproc.py
index a668bcb961..61163b2df5 100644
--- a/zephyr/zmake/zmake/multiproc.py
+++ b/zephyr/zmake/zmake/multiproc.py
@@ -18,6 +18,7 @@ import select
import threading
from typing import Any, ClassVar, Dict, List
+
# Should we log job names or not
LOG_JOB_NAMES = True
diff --git a/zephyr/zmake/zmake/output_packers.py b/zephyr/zmake/zmake/output_packers.py
index e0e342fd66..ce3099077c 100644
--- a/zephyr/zmake/zmake/output_packers.py
+++ b/zephyr/zmake/zmake/output_packers.py
@@ -3,9 +3,9 @@
# found in the LICENSE file.
"""Types which provide many builds and composite them into a single binary."""
import logging
+from pathlib import Path
import shutil
import subprocess
-from pathlib import Path
from typing import Dict, Optional
import zmake.build_config as build_config
diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py
index 30d56cc08f..731a409268 100644
--- a/zephyr/zmake/zmake/zmake.py
+++ b/zephyr/zmake/zmake/zmake.py
@@ -25,6 +25,7 @@ import zmake.project
import zmake.util as util
import zmake.version
+
ninja_warnings = re.compile(r"^(\S*: )?warning:.*")
ninja_errors = re.compile(r"error:.*")