From fc5555d1c07b41ebc39f7b43bbacc01d1c3984a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szablowski?= <56074162+doublemis1@users.noreply.github.com> Date: Fri, 12 Aug 2022 17:18:34 +0200 Subject: [PATCH] Align List/Tuple typing in python script (#21856) --- src/python_testing/matter_testing_support.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index 9ac5f8ed44d80a..6064d46fda0dcd 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -27,7 +27,7 @@ import chip.FabricAdmin from chip.utils import CommissioningBuildingBlocks import builtins -from typing import Optional +from typing import Optional, List, Tuple from dataclasses import dataclass, field from dataclasses import asdict as dataclass_asdict import re @@ -126,7 +126,7 @@ class MatterTestConfig: admin_vendor_id: int = _DEFAULT_ADMIN_VENDOR_ID global_test_params: dict = field(default_factory=dict) # List of explicit tests to run by name. If empty, all tests will run - tests: list[str] = field(default_factory=list) + tests: List[str] = field(default_factory=list) commissioning_method: str = None discriminator: int = None @@ -321,7 +321,7 @@ def int_from_manual_code(s: str) -> int: return int(s, 10) -def int_named_arg(s: str) -> tuple[str, int]: +def int_named_arg(s: str) -> Tuple[str, int]: regex = r"^(?P[a-zA-Z_0-9.]+):((?P0x[0-9a-fA-F_]+)|(?P-?\d+))$" match = re.match(regex, s) if not match: @@ -335,7 +335,7 @@ def int_named_arg(s: str) -> tuple[str, int]: return (name, value) -def str_named_arg(s: str) -> tuple[str, str]: +def str_named_arg(s: str) -> Tuple[str, str]: regex = r"^(?P[a-zA-Z_0-9.]+):(?P.*)$" match = re.match(regex, s) if not match: @@ -344,7 +344,7 @@ def str_named_arg(s: str) -> tuple[str, str]: return (match.group("name"), match.group("value")) -def float_named_arg(s: str) -> tuple[str, float]: +def float_named_arg(s: str) -> Tuple[str, float]: regex = r"^(?P[a-zA-Z_0-9.]+):(?P.*)$" match = re.match(regex, s) if not match: @@ -356,7 +356,7 @@ def float_named_arg(s: str) -> tuple[str, float]: return (name, value) -def json_named_arg(s: str) -> tuple[str, object]: +def json_named_arg(s: str) -> Tuple[str, object]: regex = r"^(?P[a-zA-Z_0-9.]+):(?P.*)$" match = re.match(regex, s) if not match: @@ -368,7 +368,7 @@ def json_named_arg(s: str) -> tuple[str, object]: return (name, value) -def bool_named_arg(s: str) -> tuple[str, bool]: +def bool_named_arg(s: str) -> Tuple[str, bool]: regex = r"^(?P[a-zA-Z_0-9.]+):((?Ptrue|false)|(?P[01]))$" match = re.match(regex, s.lower()) if not match: @@ -383,7 +383,7 @@ def bool_named_arg(s: str) -> tuple[str, bool]: return (name, value) -def bytes_as_hex_named_arg(s: str) -> tuple[str, bytes]: +def bytes_as_hex_named_arg(s: str) -> Tuple[str, bytes]: regex = r"^(?P[a-zA-Z_0-9.]+):(?P[0-9a-fA-F:]+)$" match = re.match(regex, s) if not match: @@ -510,7 +510,7 @@ def convert_args_to_matter_config(args: argparse.Namespace) -> MatterTestConfig: return config -def parse_matter_test_args(argv: list[str]) -> MatterTestConfig: +def parse_matter_test_args(argv: List[str]) -> MatterTestConfig: parser = argparse.ArgumentParser(description='Matter standalone Python test') basic_group = parser.add_argument_group(title="Basic arguments", description="Overall test execution arguments")