scripts: Fix twisterlib for ruff - E402
This fixes errors E402 - module import not at top of file. One error in testplan.py left in, as it is a part of a obscure 2020 fix that would need to be re-tested. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
This commit is contained in:
parent
7bd5fa21ac
commit
4175bbb4ce
4 changed files with 11 additions and 16 deletions
|
@ -787,8 +787,8 @@
|
|||
]
|
||||
"./scripts/pylib/twister/twisterlib/environment.py" = [
|
||||
"B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default
|
||||
"E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
|
||||
"SIM118", # https://docs.astral.sh/ruff/rules/in-dict-keys
|
||||
"UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation
|
||||
"UP021", # https://docs.astral.sh/ruff/rules/replace-universal-newlines
|
||||
|
@ -867,7 +867,6 @@
|
|||
]
|
||||
"./scripts/pylib/twister/twisterlib/runner.py" = [
|
||||
"B006", # https://docs.astral.sh/ruff/rules/mutable-argument-default
|
||||
"E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
"E713", # https://docs.astral.sh/ruff/rules/not-in-test
|
||||
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
|
||||
|
@ -964,7 +963,6 @@
|
|||
"UP032", # https://docs.astral.sh/ruff/rules/f-string
|
||||
]
|
||||
"./scripts/release/list_devicetree_bindings_changes.py" = [
|
||||
"E402", # https://docs.astral.sh/ruff/rules/module-import-not-at-top-of-file
|
||||
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
|
||||
"SIM117", # https://docs.astral.sh/ruff/rules/multiple-with-statements
|
||||
"UP006", # https://docs.astral.sh/ruff/rules/non-pep585-annotation
|
||||
|
|
|
@ -22,21 +22,17 @@ from typing import Generator, List
|
|||
|
||||
from twisterlib.constants import SUPPORTED_SIMS
|
||||
from twisterlib.coverage import supported_coverage_formats
|
||||
from twisterlib.error import TwisterRuntimeError
|
||||
from twisterlib.log_helper import log_command
|
||||
import zephyr_module
|
||||
|
||||
logger = logging.getLogger('twister')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
from twisterlib.error import TwisterRuntimeError
|
||||
from twisterlib.log_helper import log_command
|
||||
|
||||
ZEPHYR_BASE = os.getenv("ZEPHYR_BASE")
|
||||
if not ZEPHYR_BASE:
|
||||
sys.exit("$ZEPHYR_BASE environment variable undefined")
|
||||
|
||||
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/"))
|
||||
|
||||
import zephyr_module
|
||||
|
||||
# Use this for internal comparisons; that's what canonicalization is
|
||||
# for. Don't use it when invoking other components of the build system
|
||||
# to avoid confusing and hard to trace inconsistencies in error messages
|
||||
|
|
|
@ -54,11 +54,12 @@ try:
|
|||
except ImportError:
|
||||
from yaml import SafeLoader
|
||||
|
||||
logger = logging.getLogger('twister')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
import expr_parser
|
||||
from anytree import Node, RenderTree
|
||||
|
||||
logger = logging.getLogger('twister')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
class ExecutionCounter(object):
|
||||
def __init__(self, total=0):
|
||||
|
|
|
@ -21,9 +21,6 @@ import snippets
|
|||
from pathlib import Path
|
||||
from argparse import Namespace
|
||||
|
||||
logger = logging.getLogger('twister')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
try:
|
||||
from anytree import RenderTree, Node, find
|
||||
except ImportError:
|
||||
|
@ -37,9 +34,13 @@ from twisterlib.statuses import TwisterStatus
|
|||
from twisterlib.testinstance import TestInstance
|
||||
from twisterlib.quarantine import Quarantine
|
||||
|
||||
import scl
|
||||
import list_boards
|
||||
from zephyr_module import parse_modules
|
||||
|
||||
logger = logging.getLogger('twister')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
ZEPHYR_BASE = os.getenv("ZEPHYR_BASE")
|
||||
if not ZEPHYR_BASE:
|
||||
sys.exit("$ZEPHYR_BASE environment variable undefined")
|
||||
|
@ -51,7 +52,6 @@ from devicetree import edtlib # pylint: disable=unused-import
|
|||
|
||||
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/"))
|
||||
|
||||
import scl
|
||||
class Filters:
|
||||
# platform keys
|
||||
PLATFORM_KEY = 'platform key filter'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue