scripts: Fix twisterlib for ruff - UP007
This fixes ruff linting error UP007, where one would use Optional or Union instead of X | Y notation. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
This commit is contained in:
parent
9b4397a764
commit
bbd5d16a7a
3 changed files with 7 additions and 13 deletions
|
@ -759,9 +759,6 @@
|
|||
"./scripts/pylib/twister/twisterlib/cmakecache.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
]
|
||||
"./scripts/pylib/twister/twisterlib/config_parser.py" = [
|
||||
"UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation
|
||||
]
|
||||
"./scripts/pylib/twister/twisterlib/coverage.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
]
|
||||
|
@ -770,7 +767,6 @@
|
|||
]
|
||||
"./scripts/pylib/twister/twisterlib/handlers.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
"UP007", # https://docs.astral.sh/ruff/rules/non-pep604-annotation
|
||||
]
|
||||
"./scripts/pylib/twister/twisterlib/hardwaremap.py" = [
|
||||
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
|
||||
|
|
|
@ -5,13 +5,12 @@
|
|||
|
||||
import copy
|
||||
import warnings
|
||||
from typing import Union
|
||||
|
||||
import scl
|
||||
from twisterlib.error import ConfigurationError
|
||||
|
||||
|
||||
def extract_fields_from_arg_list(target_fields: set, arg_list: Union[str, list]):
|
||||
def extract_fields_from_arg_list(target_fields: set, arg_list: str | list):
|
||||
"""
|
||||
Given a list of "FIELD=VALUE" args, extract values of args with a
|
||||
given field name and return the remaining args separately.
|
||||
|
|
|
@ -23,7 +23,6 @@ import time
|
|||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from queue import Empty, Queue
|
||||
from typing import Optional
|
||||
|
||||
import psutil
|
||||
from twisterlib.environment import ZEPHYR_BASE, strip_ansi_sequences
|
||||
|
@ -71,7 +70,7 @@ def terminate_process(proc):
|
|||
|
||||
class Handler:
|
||||
def __init__(self, instance, type_str: str, options: argparse.Namespace,
|
||||
generator_cmd: Optional[str] = None, suite_name_check: bool = True):
|
||||
generator_cmd: str | None = None, suite_name_check: bool = True):
|
||||
"""Constructor
|
||||
|
||||
"""
|
||||
|
@ -175,7 +174,7 @@ class Handler:
|
|||
|
||||
|
||||
class BinaryHandler(Handler):
|
||||
def __init__(self, instance, type_str: str, options: argparse.Namespace, generator_cmd: Optional[str] = None,
|
||||
def __init__(self, instance, type_str: str, options: argparse.Namespace, generator_cmd: str | None = None,
|
||||
suite_name_check: bool = True):
|
||||
"""Constructor
|
||||
|
||||
|
@ -186,7 +185,7 @@ class BinaryHandler(Handler):
|
|||
self.seed = None
|
||||
self.extra_test_args = None
|
||||
self.line = b""
|
||||
self.binary: Optional[str] = None
|
||||
self.binary: str | None = None
|
||||
|
||||
def try_kill_process_by_pid(self):
|
||||
if self.pid_fn:
|
||||
|
@ -374,7 +373,7 @@ class BinaryHandler(Handler):
|
|||
|
||||
|
||||
class SimulationHandler(BinaryHandler):
|
||||
def __init__(self, instance, type_str: str, options: argparse.Namespace, generator_cmd: Optional[str] = None,
|
||||
def __init__(self, instance, type_str: str, options: argparse.Namespace, generator_cmd: str | None = None,
|
||||
suite_name_check: bool = True):
|
||||
"""Constructor
|
||||
|
||||
|
@ -827,7 +826,7 @@ class QEMUHandler(Handler):
|
|||
for these to collect whether the test passed or failed.
|
||||
"""
|
||||
|
||||
def __init__(self, instance, type_str: str, options: argparse.Namespace, generator_cmd: Optional[str] = None,
|
||||
def __init__(self, instance, type_str: str, options: argparse.Namespace, generator_cmd: str | None = None,
|
||||
suite_name_check: bool = True):
|
||||
"""Constructor
|
||||
|
||||
|
@ -1117,7 +1116,7 @@ class QEMUWinHandler(Handler):
|
|||
for these to collect whether the test passed or failed.
|
||||
"""
|
||||
|
||||
def __init__(self, instance, type_str: str, options: argparse.Namespace, generator_cmd: Optional[str] = None,
|
||||
def __init__(self, instance, type_str: str, options: argparse.Namespace, generator_cmd: str | None = None,
|
||||
suite_name_check: bool = True):
|
||||
"""Constructor
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue