Remove use of typing.List
Replace all use of typing.List with the Python collection equivalent,
list. This syntax was introduced as part of the Python 3.9 release.
Change-Id: I456babbfebe30c923c33478b68fba1624a71dbaf
Reviewed-on: https://fuchsia-review.googlesource.com/c/antlion/+/890273
Reviewed-by: Jonathan Chang <jnchang@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Fuchsia-Auto-Submit: Sam Balana <sbalana@google.com>
diff --git a/packages/antlion/base_test.py b/packages/antlion/base_test.py
index 96c44e0..2035416 100755
--- a/packages/antlion/base_test.py
+++ b/packages/antlion/base_test.py
@@ -23,7 +23,7 @@
import re
import traceback
from concurrent.futures import ThreadPoolExecutor
-from typing import Callable, List, Tuple
+from typing import Callable, Tuple
from mobly import asserts
from mobly.base_test import BaseTestClass as MoblyBaseTest
@@ -977,8 +977,8 @@
# TODO(https://github.com/google/mobly/issues/887): Remove this once similar
# functionality is merged into Mobly.
def _get_test_methods(
- self, test_names: List[str]
- ) -> List[Tuple[str, Callable[[], None]]]:
+ self, test_names: list[str]
+ ) -> list[Tuple[str, Callable[[], None]]]:
"""Resolves test method names to bound test methods.
Args:
@@ -997,7 +997,7 @@
if name.startswith("test_"):
test_table[name] = getattr(self, name)
- test_methods: List[Tuple[str, Callable[[], None]]] = []
+ test_methods: list[Tuple[str, Callable[[], None]]] = []
for test_name in test_names:
if test_name in test_table:
test_methods.append((test_name, test_table[test_name]))
diff --git a/packages/antlion/capabilities/ssh.py b/packages/antlion/capabilities/ssh.py
index c9aa072..a29f2f2 100644
--- a/packages/antlion/capabilities/ssh.py
+++ b/packages/antlion/capabilities/ssh.py
@@ -18,7 +18,7 @@
import subprocess
import time
from dataclasses import dataclass
-from typing import Any, BinaryIO, List, Mapping, Union
+from typing import Any, BinaryIO, Mapping, Union
from antlion import logger, signals
from antlion.net import wait_for_port
@@ -133,7 +133,7 @@
user_known_hosts_file: str = "/dev/null"
log_level: str = "ERROR"
- def full_command(self, command: str, force_tty: bool = False) -> List[str]:
+ def full_command(self, command: str, force_tty: bool = False) -> list[str]:
"""Generate the complete command to execute command over SSH.
Args:
diff --git a/packages/antlion/controllers/access_point.py b/packages/antlion/controllers/access_point.py
index 75ab2fb..da27d5a 100755
--- a/packages/antlion/controllers/access_point.py
+++ b/packages/antlion/controllers/access_point.py
@@ -17,7 +17,7 @@
import ipaddress
import time
from dataclasses import dataclass
-from typing import Any, Dict, FrozenSet, List, Mapping, Set, Tuple
+from typing import Any, Dict, FrozenSet, Mapping, Set, Tuple
from antlion import logger, utils
from antlion.capabilities.ssh import SSHConfig, SSHProvider
@@ -174,7 +174,7 @@
setup_bridge: bool = False,
is_nat_enabled: bool = True,
additional_parameters: Dict[str, Any] | None = None,
- ) -> List[Any]:
+ ) -> list[Any]:
"""Starts as an ap using a set of configurations.
This will start an ap on this host. To start an ap the controller
@@ -334,7 +334,7 @@
return bss_interfaces
- def get_configured_subnets(self) -> List[Subnet]:
+ def get_configured_subnets(self) -> list[Subnet]:
"""Get the list of configured subnets on the access point.
This allows consumers of the access point objects create custom DHCP
@@ -446,7 +446,7 @@
"""
self.ssh.run("iptables -t nat -F")
- def create_bridge(self, bridge_name: str, interfaces: List[str]) -> None:
+ def create_bridge(self, bridge_name: str, interfaces: list[str]) -> None:
"""Create the specified bridge and bridge the specified interfaces.
Args:
@@ -624,8 +624,8 @@
def hard_power_cycle(
self,
- pdus: List[PduDevice],
- hostapd_configs: List[HostapdConfig] | None = None,
+ pdus: list[PduDevice],
+ hostapd_configs: list[HostapdConfig] | None = None,
) -> None:
"""Kills, then restores power to AccessPoint, verifying it goes down and
comes back online cleanly.
@@ -754,8 +754,8 @@
pmf_support: int | None = None,
additional_ap_parameters: Dict[str, Any] | None = None,
password: str | None = None,
- n_capabilities: List[Any] | None = None,
- ac_capabilities: List[Any] | None = None,
+ n_capabilities: list[Any] | None = None,
+ ac_capabilities: list[Any] | None = None,
vht_bandwidth: int | None = None,
wnm_features: FrozenSet[hostapd_constants.WnmFeature] = frozenset(),
setup_bridge: bool = False,
@@ -831,7 +831,7 @@
)
-def create(configs: Any) -> List[AccessPoint]:
+def create(configs: Any) -> list[AccessPoint]:
"""Creates ap controllers from a json config.
Creates an ap controller from either a list, or a single
@@ -847,7 +847,7 @@
return [AccessPoint(c) for c in configs]
-def destroy(aps: List[AccessPoint]) -> None:
+def destroy(aps: list[AccessPoint]) -> None:
"""Destroys a list of access points.
Args:
@@ -857,7 +857,7 @@
ap.close()
-def get_info(aps: List[AccessPoint]) -> List[str]:
+def get_info(aps: list[AccessPoint]) -> list[str]:
"""Get information on a list of access points.
Args:
diff --git a/packages/antlion/controllers/ap_lib/ap_get_interface.py b/packages/antlion/controllers/ap_lib/ap_get_interface.py
index 8e5f199..b7701ab 100644
--- a/packages/antlion/controllers/ap_lib/ap_get_interface.py
+++ b/packages/antlion/controllers/ap_lib/ap_get_interface.py
@@ -15,7 +15,7 @@
# limitations under the License.
import logging
-from typing import TYPE_CHECKING, List, Tuple
+from typing import TYPE_CHECKING, Tuple
from antlion.libs.proc import job
@@ -46,7 +46,7 @@
self.ssh = ap.ssh
self.wan_interface_override = wan_interface_override
- def get_all_interface(self) -> List[str]:
+ def get_all_interface(self) -> list[str]:
"""Get all network interfaces on the device.
Returns:
@@ -57,7 +57,7 @@
return interfaces_all
- def get_virtual_interface(self) -> List[str]:
+ def get_virtual_interface(self) -> list[str]:
"""Get all virtual interfaces on the device.
Returns:
@@ -68,7 +68,7 @@
return interfaces_virtual
- def get_physical_interface(self) -> List[str]:
+ def get_physical_interface(self) -> list[str]:
"""Get all the physical interfaces of the device.
Get all physical interfaces such as eth ports and wlan ports
@@ -82,7 +82,7 @@
return interfaces_phy
- def get_bridge_interface(self) -> List[str]:
+ def get_bridge_interface(self) -> list[str]:
"""Get all the bridge interfaces of the device.
Returns:
diff --git a/packages/antlion/controllers/ap_lib/hostapd_ap_preset.py b/packages/antlion/controllers/ap_lib/hostapd_ap_preset.py
index 6054701..65d2bd3 100644
--- a/packages/antlion/controllers/ap_lib/hostapd_ap_preset.py
+++ b/packages/antlion/controllers/ap_lib/hostapd_ap_preset.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from typing import Any, FrozenSet, List, TypeVar
+from typing import Any, FrozenSet, TypeVar
from antlion import utils
from antlion.controllers.ap_lib import hostapd_config, hostapd_constants, hostapd_utils
@@ -60,11 +60,11 @@
force_wmm: bool | None = None,
beacon_interval: int | None = None,
short_preamble: bool | None = None,
- n_capabilities: List[Any] | None = None,
- ac_capabilities: List[Any] | None = None,
+ n_capabilities: list[Any] | None = None,
+ ac_capabilities: list[Any] | None = None,
vht_bandwidth: int | None = None,
wnm_features: FrozenSet[hostapd_constants.WnmFeature] = frozenset(),
- bss_settings: List[Any] = [],
+ bss_settings: list[Any] = [],
) -> hostapd_config.HostapdConfig:
"""AP preset config generator. This a wrapper for hostapd_config but
but supplies the default settings for the preset that is selected.
diff --git a/packages/antlion/controllers/ap_lib/hostapd_config.py b/packages/antlion/controllers/ap_lib/hostapd_config.py
index dd93392..9bb7e46 100644
--- a/packages/antlion/controllers/ap_lib/hostapd_config.py
+++ b/packages/antlion/controllers/ap_lib/hostapd_config.py
@@ -14,7 +14,7 @@
import collections
import logging
-from typing import Any, Dict, FrozenSet, List, Union
+from typing import Any, Dict, FrozenSet, Union
from antlion.controllers.ap_lib import hostapd_constants
from antlion.controllers.ap_lib.hostapd_bss_settings import BssSettings
@@ -85,7 +85,7 @@
mode: str | None = None,
channel: int | None = None,
frequency: int | None = None,
- n_capabilities: List[Any] | None = None,
+ n_capabilities: list[Any] | None = None,
beacon_interval: int | None = None,
dtim_period: int | None = None,
frag_threshold: int | None = None,
@@ -100,13 +100,13 @@
obss_interval: int | None = None,
vht_channel_width: Any | None = None,
vht_center_channel: int | None = None,
- ac_capabilities: List[Any] | None = None,
+ ac_capabilities: list[Any] | None = None,
beacon_footer: str = "",
spectrum_mgmt_required: bool | None = None,
scenario_name: str | None = None,
min_streams: int | None = None,
wnm_features: FrozenSet[hostapd_constants.WnmFeature] = frozenset(),
- bss_settings: List[Any] | None = None,
+ bss_settings: list[Any] | None = None,
additional_parameters: Dict[str, Any] | None = None,
set_ap_defaults_profile: str = "whirlwind",
) -> None:
@@ -619,7 +619,7 @@
"""Removes a bss setting from the config."""
del self._bss_lookup[bss_name]
- def package_configs(self) -> List[Dict[str, Union[str, int]]]:
+ def package_configs(self) -> list[Dict[str, Union[str, int]]]:
"""Package the configs.
Returns:
diff --git a/packages/antlion/controllers/ap_lib/hostapd_constants.py b/packages/antlion/controllers/ap_lib/hostapd_constants.py
index de3836f..3ec979b 100755
--- a/packages/antlion/controllers/ap_lib/hostapd_constants.py
+++ b/packages/antlion/controllers/ap_lib/hostapd_constants.py
@@ -16,7 +16,7 @@
import itertools
from enum import Enum, auto, unique
-from typing import List, Tuple, TypedDict
+from typing import Tuple, TypedDict
BAND_2G = "2g"
BAND_5G = "5g"
@@ -374,7 +374,7 @@
class VHTChannelWidth(TypedDict):
delta: int
- channels: List[Tuple[int, int]]
+ channels: list[Tuple[int, int]]
CENTER_CHANNEL_MAP = {
diff --git a/packages/antlion/controllers/ap_lib/hostapd_utils.py b/packages/antlion/controllers/ap_lib/hostapd_utils.py
index 9693652..060777e 100644
--- a/packages/antlion/controllers/ap_lib/hostapd_utils.py
+++ b/packages/antlion/controllers/ap_lib/hostapd_utils.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from typing import List
from antlion import utils
from antlion.controllers.ap_lib import hostapd_constants
@@ -46,7 +45,7 @@
return generator_func(hostapd_constants.MIN_WPA_PSK_LENGTH)
-def verify_interface(interface: str, valid_interfaces: List[str]) -> None:
+def verify_interface(interface: str, valid_interfaces: list[str]) -> None:
"""Raises error if interface is missing or invalid
Args:
@@ -58,7 +57,7 @@
def verify_security_mode(
- security_profile: Security, valid_security_modes: List[SecurityMode]
+ security_profile: Security, valid_security_modes: list[SecurityMode]
) -> None:
"""Raises error if security mode is not in list of valid security modes.
@@ -73,7 +72,7 @@
)
-def verify_cipher(security_profile: Security, valid_ciphers: List[str]) -> None:
+def verify_cipher(security_profile: Security, valid_ciphers: list[str]) -> None:
"""Raise error if cipher is not in list of valid ciphers.
Args:
diff --git a/packages/antlion/controllers/ap_lib/radvd_config.py b/packages/antlion/controllers/ap_lib/radvd_config.py
index 23ffc67..0d0a8c4 100644
--- a/packages/antlion/controllers/ap_lib/radvd_config.py
+++ b/packages/antlion/controllers/ap_lib/radvd_config.py
@@ -13,7 +13,7 @@
# limitations under the License.
import collections
-from typing import Any, Dict, List
+from typing import Any, Dict
from antlion.controllers.ap_lib import radvd_constants
@@ -27,9 +27,9 @@
def __init__(
self,
prefix: str = radvd_constants.DEFAULT_PREFIX,
- clients: List[str] = [],
+ clients: list[str] = [],
route: Any | None = None,
- rdnss: List[str] = [],
+ rdnss: list[str] = [],
ignore_if_missing: str | None = None,
adv_send_advert: str = radvd_constants.ADV_SEND_ADVERT_ON,
unicast_only: str | None = None,
diff --git a/packages/antlion/controllers/ap_lib/regulatory_channels.py b/packages/antlion/controllers/ap_lib/regulatory_channels.py
index 8c35858..66c9fd1 100644
--- a/packages/antlion/controllers/ap_lib/regulatory_channels.py
+++ b/packages/antlion/controllers/ap_lib/regulatory_channels.py
@@ -1,11 +1,11 @@
from dataclasses import dataclass
-from typing import Dict, List
+from typing import Dict
Channel = int
Bandwidth = int
# TODO(http://b/281728764): Add device requirements to each frequency e.g.
# "MUST be used indoors only" or "MUST be used with DFS".
-ChannelBandwidthMap = Dict[Channel, List[Bandwidth]]
+ChannelBandwidthMap = Dict[Channel, list[Bandwidth]]
@dataclass
diff --git a/packages/antlion/controllers/ap_lib/wireless_network_management.py b/packages/antlion/controllers/ap_lib/wireless_network_management.py
index f061707..848cf5f 100644
--- a/packages/antlion/controllers/ap_lib/wireless_network_management.py
+++ b/packages/antlion/controllers/ap_lib/wireless_network_management.py
@@ -14,12 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from typing import List, NewType
+from typing import NewType
from antlion.controllers.ap_lib.radio_measurement import NeighborReportElement
BssTransitionCandidateList = NewType(
- "BssTransitionCandidateList", List[NeighborReportElement]
+ "BssTransitionCandidateList", list[NeighborReportElement]
)
diff --git a/packages/antlion/controllers/fuchsia_device.py b/packages/antlion/controllers/fuchsia_device.py
index 83d70f9..7ebbd31 100644
--- a/packages/antlion/controllers/fuchsia_device.py
+++ b/packages/antlion/controllers/fuchsia_device.py
@@ -19,7 +19,7 @@
import re
import textwrap
import time
-from typing import Any, Dict, List, Mapping
+from typing import Any, Dict, Mapping
from antlion import context
from antlion import logger as acts_logger
@@ -247,7 +247,7 @@
self.wlan_ap_test_interface_name = fd_conf_data.get(
"wlan_ap_test_interface", None
)
- self.wlan_features: List[str] = fd_conf_data.get("wlan_features", [])
+ self.wlan_features: list[str] = fd_conf_data.get("wlan_features", [])
# Whether to use 'policy' or 'drivers' for WLAN connect/disconnect calls
# If set to None, wlan is not configured.
@@ -578,7 +578,7 @@
use_ssh: bool = False,
unreachable_timeout: int = FUCHSIA_DEFAULT_CONNECT_TIMEOUT,
reboot_type: str = FUCHSIA_REBOOT_TYPE_SOFT,
- testbed_pdus: List[pdu.PduDevice] = [],
+ testbed_pdus: list[pdu.PduDevice] = [],
) -> None:
"""Reboot a FuchsiaDevice.
diff --git a/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_policy_controller.py b/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_policy_controller.py
index a79248b..aca193c 100644
--- a/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_policy_controller.py
+++ b/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_policy_controller.py
@@ -17,7 +17,7 @@
import multiprocessing
import time
from dataclasses import dataclass
-from typing import Any, Dict, List, Tuple
+from typing import Any, Dict, Tuple
from antlion import logger, signals
from antlion.controllers.ap_lib.hostapd_security import FuchsiaSecurityType
@@ -46,7 +46,7 @@
@dataclass
class PreservedState:
- saved_networks: List[Dict[str, Any]] | None
+ saved_networks: list[Dict[str, Any]] | None
client_connections_state: str | None
@@ -375,7 +375,7 @@
return False
return True
- def get_saved_networks(self) -> List[Any]:
+ def get_saved_networks(self) -> list[Any]:
"""Retrieves saved networks from device.
Returns:
@@ -679,7 +679,7 @@
self.log.info("Preserved networks and client state restored.")
self.preserved_networks_and_client_state = None
- def _get_phy_ids(self) -> List[str]:
+ def _get_phy_ids(self) -> list[str]:
"""Get a list of WLAN physical interfaces."""
phy_ids_response = self.sl4f.wlan_lib.wlanPhyIdList()
if phy_ids_response.get("error"):
diff --git a/packages/antlion/controllers/fuchsia_lib/package_server.py b/packages/antlion/controllers/fuchsia_lib/package_server.py
index 398f283..2c0ab5a 100644
--- a/packages/antlion/controllers/fuchsia_lib/package_server.py
+++ b/packages/antlion/controllers/fuchsia_lib/package_server.py
@@ -23,7 +23,7 @@
import tempfile
from dataclasses import dataclass
from datetime import datetime
-from typing import List, TextIO
+from typing import TextIO
from antlion import context, logger, signals, utils
from antlion.controllers.fuchsia_lib.ssh import SSHError, SSHProvider
@@ -51,7 +51,7 @@
preferred_source: str | None
-def find_routes_to(dest_ip) -> List[Route]:
+def find_routes_to(dest_ip) -> list[Route]:
"""Find the routes used to reach a destination.
Look through the routing table for the routes that would be used without
diff --git a/packages/antlion/controllers/iperf_client.py b/packages/antlion/controllers/iperf_client.py
index 1354e24..6ca239e 100644
--- a/packages/antlion/controllers/iperf_client.py
+++ b/packages/antlion/controllers/iperf_client.py
@@ -19,7 +19,6 @@
import socket
import subprocess
import threading
-from typing import List
from antlion import context
from antlion.capabilities.ssh import SSHConfig
@@ -48,7 +47,7 @@
Args:
configs: config parameters for the iperf server
"""
- results: List[IPerfClientBase] = []
+ results: list[IPerfClientBase] = []
for c in configs:
if type(c) is dict and "AndroidDevice" in c:
results.append(
diff --git a/packages/antlion/controllers/openwrt_ap.py b/packages/antlion/controllers/openwrt_ap.py
index 02b409f..7c1a039 100644
--- a/packages/antlion/controllers/openwrt_ap.py
+++ b/packages/antlion/controllers/openwrt_ap.py
@@ -3,7 +3,7 @@
import random
import re
import time
-from typing import Dict, List, Literal
+from typing import Dict, Literal
import yaml
@@ -127,7 +127,7 @@
def configure_ap(
self,
- wireless_configs: List[wireless_config.WirelessConfig],
+ wireless_configs: list[wireless_config.WirelessConfig],
channel_2g: int,
channel_5g: int,
):
diff --git a/packages/antlion/controllers/openwrt_lib/network_settings.py b/packages/antlion/controllers/openwrt_lib/network_settings.py
index 69b3f2c..46632cb 100644
--- a/packages/antlion/controllers/openwrt_lib/network_settings.py
+++ b/packages/antlion/controllers/openwrt_lib/network_settings.py
@@ -14,7 +14,6 @@
import re
import time
-from typing import List
from antlion import signals, utils
from antlion.controllers.openwrt_lib import network_const
@@ -525,7 +524,7 @@
def setup_ipsec(self):
"""Setup ipsec config."""
- config: List[str] = []
+ config: list[str] = []
def load_ipsec_config(data, rightsourceip=False):
for i in data.keys():
diff --git a/packages/antlion/controllers/openwrt_lib/wireless_config.py b/packages/antlion/controllers/openwrt_lib/wireless_config.py
index 78ad703..8cbcd19 100644
--- a/packages/antlion/controllers/openwrt_lib/wireless_config.py
+++ b/packages/antlion/controllers/openwrt_lib/wireless_config.py
@@ -1,6 +1,5 @@
"""Class for Wireless config."""
-from typing import List
from antlion.controllers.ap_lib.hostapd_security import OpenWRTEncryptionMode
@@ -32,7 +31,7 @@
band: str,
iface: str = "lan",
password: str | None = None,
- wep_key: List[str] | None = None,
+ wep_key: list[str] | None = None,
wep_key_num: int = 1,
radius_server_ip: str | None = None,
radius_server_port: int | None = None,
diff --git a/packages/antlion/controllers/openwrt_lib/wireless_settings_applier.py b/packages/antlion/controllers/openwrt_lib/wireless_settings_applier.py
index 491a4f9..da0d2d7 100644
--- a/packages/antlion/controllers/openwrt_lib/wireless_settings_applier.py
+++ b/packages/antlion/controllers/openwrt_lib/wireless_settings_applier.py
@@ -1,7 +1,6 @@
"""Class to configure wireless settings."""
import time
-from typing import List
from antlion.controllers.ap_lib import hostapd_constants
from antlion.controllers.openwrt_lib.network_settings import (
@@ -52,7 +51,7 @@
"""
self.ssh = ssh
self.service_manager = ServiceManager(ssh)
- self.wireless_configs: List[WirelessConfig] = configs
+ self.wireless_configs: list[WirelessConfig] = configs
self.channel_2g = channel_2g
self.channel_5g = channel_5g
self.radio_2g = radio_2g
diff --git a/packages/antlion/test_utils/abstract_devices/wlan_device.py b/packages/antlion/test_utils/abstract_devices/wlan_device.py
index e587ef0..5618d6e 100644
--- a/packages/antlion/test_utils/abstract_devices/wlan_device.py
+++ b/packages/antlion/test_utils/abstract_devices/wlan_device.py
@@ -15,7 +15,7 @@
# limitations under the License.
import logging
-from typing import Any, Dict, List, Protocol, Union, runtime_checkable
+from typing import Any, Dict, Protocol, Union, runtime_checkable
from mobly.records import TestResultRecord
@@ -130,7 +130,7 @@
"""
...
- def get_wlan_interface_id_list(self) -> List[str]:
+ def get_wlan_interface_id_list(self) -> list[str]:
"""List available WLAN interfaces.
Returns:
@@ -180,7 +180,7 @@
"""
...
- def hard_power_cycle(self, pdus: List[PduDevice]) -> None:
+ def hard_power_cycle(self, pdus: list[PduDevice]) -> None:
"""Reboot a device abruptly without notification.
Args:
@@ -270,7 +270,7 @@
def disconnect(self) -> None:
awutils.turn_location_off_and_scan_toggle_off(self.device)
- def get_wlan_interface_id_list(self) -> List[str]:
+ def get_wlan_interface_id_list(self) -> list[str]:
raise NotImplementedError("get_wlan_interface_id_list is not implemented")
def get_default_wlan_test_interface(self) -> str:
@@ -309,7 +309,7 @@
) -> Dict[str, Any]:
raise NotImplementedError("ping is not implemented")
- def hard_power_cycle(self, pdus: List[PduDevice]) -> None:
+ def hard_power_cycle(self, pdus: list[PduDevice]) -> None:
raise NotImplementedError("hard_power_cycle is not implemented")
def create_iperf_client(self, test_interface: str | None = None) -> IPerfClientBase:
@@ -429,7 +429,7 @@
additional_ping_params=additional_ping_params,
)
- def get_wlan_interface_id_list(self) -> List[str]:
+ def get_wlan_interface_id_list(self) -> list[str]:
response = self.device.sl4f.wlan_lib.wlanGetIfaceIdList()
if response.get("error"):
raise ConnectionError(
@@ -473,7 +473,7 @@
return True
return False
- def hard_power_cycle(self, pdus: List[PduDevice]) -> None:
+ def hard_power_cycle(self, pdus: list[PduDevice]) -> None:
self.device.reboot(reboot_type="hard", testbed_pdus=pdus)
def create_iperf_client(self, test_interface: str | None = None) -> IPerfClientBase:
diff --git a/packages/antlion/test_utils/abstract_devices/wmm_transceiver.py b/packages/antlion/test_utils/abstract_devices/wmm_transceiver.py
index 021c58e..0b391c4 100644
--- a/packages/antlion/test_utils/abstract_devices/wmm_transceiver.py
+++ b/packages/antlion/test_utils/abstract_devices/wmm_transceiver.py
@@ -19,7 +19,7 @@
import time
from datetime import datetime
from multiprocessing.managers import DictProxy
-from typing import Any, List, Mapping
+from typing import Any, Mapping
from uuid import UUID, uuid4
from antlion import signals, tracelogger, utils
@@ -53,8 +53,8 @@
def create(
config: Mapping[str, Any],
identifier: str | None = None,
- wlan_devices: List[SupportsWLAN] | None = None,
- access_points: List[AccessPoint] | None = None,
+ wlan_devices: list[SupportsWLAN] | None = None,
+ access_points: list[AccessPoint] | None = None,
):
"""Creates a WmmTransceiver from a config.
@@ -111,7 +111,7 @@
def _find_wlan_device(
- wlan_device_identifier: str, wlan_devices: List[SupportsWLAN]
+ wlan_device_identifier: str, wlan_devices: list[SupportsWLAN]
) -> SupportsWLAN:
"""Returns WLAN device based on string identifier (e.g. ip, serial, etc.)
@@ -134,7 +134,7 @@
def _find_access_point(
- access_point_ip: str, access_points: List[AccessPoint]
+ access_point_ip: str, access_points: list[AccessPoint]
) -> AccessPoint:
"""Returns AccessPoint based on string ip address
diff --git a/packages/antlion/test_utils/wifi/base_test.py b/packages/antlion/test_utils/wifi/base_test.py
index d8c2a51..c7c81f0 100644
--- a/packages/antlion/test_utils/wifi/base_test.py
+++ b/packages/antlion/test_utils/wifi/base_test.py
@@ -19,7 +19,7 @@
import copy
import os
-from typing import Any, Dict, List, TypedDict, TypeVar, Union
+from typing import Any, Dict, TypedDict, TypeVar, Union
from mobly.base_test import STAGE_NAME_TEARDOWN_CLASS
from mobly.config_parser import TestRunConfig
@@ -55,7 +55,7 @@
security: SecurityMode
password: str | None
hiddenSSID: bool
- wepKeys: List[str] | None
+ wepKeys: list[str] | None
ieee80211w: str | None
@@ -64,7 +64,7 @@
security: SecurityMode
password: str | None
hiddenSSID: bool
- wepKeys: List[str] | None
+ wepKeys: list[str] | None
ieee80211w: str | None
@@ -77,50 +77,50 @@
self.enable_packet_log = False
self.packet_log_2g = hostapd_constants.AP_DEFAULT_CHANNEL_2G
self.packet_log_5g = hostapd_constants.AP_DEFAULT_CHANNEL_5G
- self.tcpdump_proc: List[Any] = []
+ self.tcpdump_proc: list[Any] = []
self.packet_log_pid: Dict[str, Any] = {}
def setup_class(self) -> None:
T = TypeVar("T")
- def register_controller(module: Any) -> List[T]:
- controllers: List[T] | None = self.register_controller(
+ def register_controller(module: Any) -> list[T]:
+ controllers: list[T] | None = self.register_controller(
module, required=False
)
if controllers is None:
return []
return controllers
- self.access_points: List[AccessPoint] = register_controller(
+ self.access_points: list[AccessPoint] = register_controller(
controllers.access_point
)
- self.openwrt_aps: List[OpenWrtAP] = register_controller(controllers.openwrt_ap)
- self.android_devices: List[AndroidDevice] = register_controller(
+ self.openwrt_aps: list[OpenWrtAP] = register_controller(controllers.openwrt_ap)
+ self.android_devices: list[AndroidDevice] = register_controller(
controllers.android_device
)
- self.attenuators: List[Attenuator] = register_controller(controllers.attenuator)
- self.fuchsia_devices: List[FuchsiaDevice] = register_controller(
+ self.attenuators: list[Attenuator] = register_controller(controllers.attenuator)
+ self.fuchsia_devices: list[FuchsiaDevice] = register_controller(
controllers.fuchsia_device
)
- self.iperf_clients: List[IPerfClientBase] = register_controller(
+ self.iperf_clients: list[IPerfClientBase] = register_controller(
controllers.iperf_client
)
- self.iperf_servers: List[IPerfServerOverSsh] = register_controller(
+ self.iperf_servers: list[IPerfServerOverSsh] = register_controller(
controllers.iperf_server
)
- self.pdu_devices: List[PduDevice] = register_controller(controllers.pdu)
- self.packet_capture: List[PacketCapture] = register_controller(
+ self.pdu_devices: list[PduDevice] = register_controller(controllers.pdu)
+ self.packet_capture: list[PacketCapture] = register_controller(
controllers.packet_capture
)
for attenuator in self.attenuators:
attenuator.set_atten(0)
- self.pixel_models: List[str] | None = self.user_params.get("pixel_models")
- self.cnss_diag_file: Union[str, List[str]] | None = self.user_params.get(
+ self.pixel_models: list[str] | None = self.user_params.get("pixel_models")
+ self.cnss_diag_file: Union[str, list[str]] | None = self.user_params.get(
"cnss_diag_file"
)
- self.country_code_file: Union[str, List[str]] | None = self.user_params.get(
+ self.country_code_file: Union[str, list[str]] | None = self.user_params.get(
"country_code_file"
)
@@ -269,7 +269,7 @@
def get_psk_network(
self,
mirror_ap: bool,
- reference_networks: List[NetworkList],
+ reference_networks: list[NetworkList],
hidden: bool = False,
same_ssid: bool = False,
security_mode: SecurityMode = SecurityMode.WPA2,
@@ -336,7 +336,7 @@
def get_open_network(
self,
mirror_ap: bool,
- open_network: List[NetworkList],
+ open_network: list[NetworkList],
hidden: bool = False,
same_ssid: bool = False,
ssid_length_2g: int = hostapd_constants.AP_SSID_LENGTH_2G,
@@ -394,7 +394,7 @@
def get_wep_network(
self,
mirror_ap: bool,
- networks: List[NetworkList],
+ networks: list[NetworkList],
hidden: bool = False,
same_ssid: bool = False,
ssid_length_2g: int = hostapd_constants.AP_SSID_LENGTH_2G,
@@ -533,9 +533,9 @@
if radius_conf_pwd is None:
radius_conf_pwd = {}
- self.bssid_map: List[BSSIDMap] = []
+ self.bssid_map: list[BSSIDMap] = []
for i in range(ap_count):
- configs: List[WirelessConfig] = []
+ configs: list[WirelessConfig] = []
num_2g: int = 1
num_5g: int = 1
diff --git a/packages/antlion/test_utils/wifi/wifi_test_utils.py b/packages/antlion/test_utils/wifi/wifi_test_utils.py
index aa000d8..8b74b54 100755
--- a/packages/antlion/test_utils/wifi/wifi_test_utils.py
+++ b/packages/antlion/test_utils/wifi/wifi_test_utils.py
@@ -2738,7 +2738,7 @@
num_probes: number of probes to perform
delay_sec: delay time between probes, in seconds
Returns:
- List[LinkProbeResult] one LinkProbeResults for each probe
+ list[LinkProbeResult] one LinkProbeResults for each probe
"""
logging.info("Sending link probes")
results = []
diff --git a/packages/antlion/typing.py b/packages/antlion/typing.py
index 24f1a0e..535c1e3 100644
--- a/packages/antlion/typing.py
+++ b/packages/antlion/typing.py
@@ -15,7 +15,7 @@
# limitations under the License.
from enum import Enum
-from typing import List, Type, TypeVar
+from typing import Type, TypeVar
T = TypeVar("T", bound="StrEnum")
@@ -27,7 +27,7 @@
return self.value
@classmethod
- def all(cls: Type[T]) -> List[T]:
+ def all(cls: Type[T]) -> list[T]:
return [e for e in cls]
@classmethod
diff --git a/packages/antlion/utils.py b/packages/antlion/utils.py
index 9c0c4ae..7af17c4 100755
--- a/packages/antlion/utils.py
+++ b/packages/antlion/utils.py
@@ -35,7 +35,7 @@
import traceback
import zipfile
from concurrent.futures import ThreadPoolExecutor
-from typing import TYPE_CHECKING, Any, Dict, List, Union
+from typing import TYPE_CHECKING, Any, Dict, Union
import mobly.keys as mobly_keys
import yaml
@@ -1495,7 +1495,7 @@
def get_interface_ip_addresses(
comm_channel: Union["AndroidDevice", "SshConnection", "FuchsiaDevice"],
interface: str,
-) -> Dict[str, List[str]]:
+) -> Dict[str, list[str]]:
"""Gets all of the ip addresses, ipv4 and ipv6, associated with a
particular interface name.
diff --git a/tests/examples/Sl4fSanityTest.py b/tests/examples/Sl4fSanityTest.py
index e93ef1c..4056e65 100644
--- a/tests/examples/Sl4fSanityTest.py
+++ b/tests/examples/Sl4fSanityTest.py
@@ -19,7 +19,6 @@
"""
import logging
-from typing import List
from mobly import asserts, test_runner
@@ -31,7 +30,7 @@
class Sl4fSanityTest(base_test.AntlionBaseTest):
def setup_class(self):
self.log = logging.getLogger()
- self.fuchsia_devices: List[FuchsiaDevice] = self.register_controller(
+ self.fuchsia_devices: list[FuchsiaDevice] = self.register_controller(
fuchsia_device
)
diff --git a/tests/flash/FlashTest.py b/tests/flash/FlashTest.py
index bd0c7c4..f1263b8 100644
--- a/tests/flash/FlashTest.py
+++ b/tests/flash/FlashTest.py
@@ -20,7 +20,6 @@
"""
import logging
-from typing import List
from mobly import asserts, signals, test_runner
@@ -36,10 +35,10 @@
class FlashTest(base_test.AntlionBaseTest):
def setup_class(self):
self.log = logging.getLogger()
- self.fuchsia_devices: List[FuchsiaDevice] = self.register_controller(
+ self.fuchsia_devices: list[FuchsiaDevice] = self.register_controller(
fuchsia_device
)
- self.pdu_devices: List[PduDevice] = self.register_controller(pdu)
+ self.pdu_devices: list[PduDevice] = self.register_controller(pdu)
self.failed_to_get_device_info = False
def teardown_class(self):
diff --git a/tests/logging/FuchsiaLoggingTest.py b/tests/logging/FuchsiaLoggingTest.py
index 6250773..f7760a7 100644
--- a/tests/logging/FuchsiaLoggingTest.py
+++ b/tests/logging/FuchsiaLoggingTest.py
@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from typing import List
from mobly import asserts, signals, test_runner
@@ -27,7 +26,7 @@
class FuchsiaLoggingTest(base_test.AntlionBaseTest):
def setup_class(self):
- self.fuchsia_devices: List[FuchsiaDevice] = self.register_controller(
+ self.fuchsia_devices: list[FuchsiaDevice] = self.register_controller(
fuchsia_device
)
diff --git a/tests/netstack/NetstackIfaceTest.py b/tests/netstack/NetstackIfaceTest.py
index e9abd02..27a44c9 100644
--- a/tests/netstack/NetstackIfaceTest.py
+++ b/tests/netstack/NetstackIfaceTest.py
@@ -15,7 +15,6 @@
# limitations under the License.
import logging
-from typing import List
from mobly import asserts, signals, test_runner
@@ -32,7 +31,7 @@
def setup_class(self):
self.log = logging.getLogger()
- self.fuchsia_devices: List[FuchsiaDevice] = self.register_controller(
+ self.fuchsia_devices: list[FuchsiaDevice] = self.register_controller(
fuchsia_device
)
diff --git a/tests/netstack/ToggleWlanInterfaceStressTest.py b/tests/netstack/ToggleWlanInterfaceStressTest.py
index 6cca67b..7f910f7 100644
--- a/tests/netstack/ToggleWlanInterfaceStressTest.py
+++ b/tests/netstack/ToggleWlanInterfaceStressTest.py
@@ -16,7 +16,6 @@
import logging
import time
-from typing import List
from mobly import asserts, signals, test_runner
@@ -29,7 +28,7 @@
class ToggleWlanInterfaceStressTest(base_test.AntlionBaseTest):
def setup_class(self):
self.log = logging.getLogger()
- self.fuchsia_devices: List[FuchsiaDevice] = self.register_controller(
+ self.fuchsia_devices: list[FuchsiaDevice] = self.register_controller(
fuchsia_device
)
diff --git a/tests/wlan/compliance/RegulatoryComplianceTest.py b/tests/wlan/compliance/RegulatoryComplianceTest.py
index b93ef50..742e4df 100644
--- a/tests/wlan/compliance/RegulatoryComplianceTest.py
+++ b/tests/wlan/compliance/RegulatoryComplianceTest.py
@@ -15,7 +15,7 @@
# limitations under the License.
import logging
-from typing import List, NamedTuple
+from typing import NamedTuple
from mobly import asserts, test_runner
@@ -59,7 +59,7 @@
"""
def pre_run(self) -> None:
- tests: List[RegulatoryTest] = []
+ tests: list[RegulatoryTest] = []
for country in COUNTRY_CHANNELS.values():
for channel in TEST_CHANNELS:
for bandwidth in TEST_CHANNELS[channel]:
diff --git a/tests/wlan/compliance/WlanPhyCompliance11ACTest.py b/tests/wlan/compliance/WlanPhyCompliance11ACTest.py
index 5dfec3d..fb3bb4f 100644
--- a/tests/wlan/compliance/WlanPhyCompliance11ACTest.py
+++ b/tests/wlan/compliance/WlanPhyCompliance11ACTest.py
@@ -17,7 +17,7 @@
import itertools
import logging
from dataclasses import dataclass
-from typing import Any, List, Tuple
+from typing import Any, Tuple
from mobly import asserts, signals, test_runner
from mobly.records import TestResultRecord
@@ -95,7 +95,7 @@
wpa2_cipher=hostapd_constants.WPA2_DEFAULT_CIPER,
)
-SECURITIES: List[Security] = [Security(), WPA2_SECURITY]
+SECURITIES: list[Security] = [Security(), WPA2_SECURITY]
@dataclass
@@ -103,8 +103,8 @@
security: Security
vht_bandwidth_mhz: int
# TODO(http://b/290396383): Type AP capabilities as enums
- n_capabilities: List[Any]
- ac_capabilities: List[Any]
+ n_capabilities: list[Any]
+ ac_capabilities: list[Any]
# 6912 test cases
@@ -120,7 +120,7 @@
super().__init__(controllers)
def setup_generated_tests(self):
- test_args: List[Tuple[TestParams]] = (
+ test_args: list[Tuple[TestParams]] = (
self._generate_20mhz_test_args()
+ self._generate_40mhz_test_args()
+ self._generate_80mhz_test_args()
@@ -217,8 +217,8 @@
)
# 1728 tests
- def _generate_20mhz_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_20mhz_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
# 864 test cases for open security
# 864 test cases for wpa2 security
@@ -246,8 +246,8 @@
return test_args
# 1728 tests
- def _generate_40mhz_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_40mhz_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
# 864 test cases for open security
# 864 test cases for wpa2 security
@@ -275,8 +275,8 @@
return test_args
# 3456 tests
- def _generate_80mhz_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_80mhz_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
# 1728 test cases for open security
# 1728 test cases for wpa2 security
diff --git a/tests/wlan/compliance/WlanPhyCompliance11NTest.py b/tests/wlan/compliance/WlanPhyCompliance11NTest.py
index 7f740b6..9e68db5 100644
--- a/tests/wlan/compliance/WlanPhyCompliance11NTest.py
+++ b/tests/wlan/compliance/WlanPhyCompliance11NTest.py
@@ -17,7 +17,7 @@
import itertools
import logging
from dataclasses import dataclass
-from typing import Any, List, Tuple
+from typing import Any, Tuple
from mobly import asserts, signals, test_runner
from mobly.records import TestResultRecord
@@ -56,7 +56,7 @@
n_mode: str
security: SecurityMode
# TODO(http://b/290396383): Type AP capabilities as enums
- n_capabilities: List[Any]
+ n_capabilities: list[Any]
class WlanPhyCompliance11NTest(base_test.WifiBaseTest):
@@ -71,7 +71,7 @@
super().__init__(controllers)
def setup_generated_tests(self):
- test_args: List[Tuple[TestParams]] = (
+ test_args: list[Tuple[TestParams]] = (
self._generate_24_HT20_test_args()
+ self._generate_24_HT40_lower_test_args()
+ self._generate_24_HT40_upper_test_args()
@@ -224,8 +224,8 @@
"Failed to connect.",
)
- def _generate_24_HT20_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_24_HT20_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_24,
CHANNEL_BANDWIDTH_20,
@@ -251,8 +251,8 @@
)
return test_args
- def _generate_24_HT40_lower_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_24_HT40_lower_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_24,
CHANNEL_BANDWIDTH_40_LOWER,
@@ -278,8 +278,8 @@
)
return test_args
- def _generate_24_HT40_upper_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_24_HT40_upper_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_24,
CHANNEL_BANDWIDTH_40_UPPER,
@@ -305,8 +305,8 @@
)
return test_args
- def _generate_5_HT20_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_5_HT20_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_5,
CHANNEL_BANDWIDTH_20,
@@ -331,8 +331,8 @@
)
return test_args
- def _generate_5_HT40_lower_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_5_HT40_lower_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_5,
CHANNEL_BANDWIDTH_40_LOWER,
@@ -358,8 +358,8 @@
)
return test_args
- def _generate_5_HT40_upper_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_5_HT40_upper_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_5,
CHANNEL_BANDWIDTH_40_UPPER,
@@ -386,8 +386,8 @@
)
return test_args
- def _generate_24_HT20_wpa2_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_24_HT20_wpa2_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_24,
CHANNEL_BANDWIDTH_20,
@@ -412,8 +412,8 @@
)
return test_args
- def _generate_24_HT40_lower_wpa2_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_24_HT40_lower_wpa2_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_24,
CHANNEL_BANDWIDTH_40_LOWER,
@@ -439,8 +439,8 @@
)
return test_args
- def _generate_24_HT40_upper_wpa2_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_24_HT40_upper_wpa2_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_24,
CHANNEL_BANDWIDTH_40_UPPER,
@@ -466,8 +466,8 @@
)
return test_args
- def _generate_5_HT20_wpa2_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_5_HT20_wpa2_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_5,
CHANNEL_BANDWIDTH_20,
@@ -492,8 +492,8 @@
)
return test_args
- def _generate_5_HT40_lower_wpa2_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_5_HT40_lower_wpa2_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_5,
CHANNEL_BANDWIDTH_40_LOWER,
@@ -519,8 +519,8 @@
)
return test_args
- def _generate_5_HT40_upper_wpa2_test_args(self) -> List[Tuple[TestParams]]:
- test_args: List[Tuple[TestParams]] = []
+ def _generate_5_HT40_upper_wpa2_test_args(self) -> list[Tuple[TestParams]]:
+ test_args: list[Tuple[TestParams]] = []
for combination in itertools.product(
FREQUENCY_5,
CHANNEL_BANDWIDTH_40_UPPER,
diff --git a/tests/wlan/functional/ConnectionStressTest.py b/tests/wlan/functional/ConnectionStressTest.py
index 191fd61..992a14f 100644
--- a/tests/wlan/functional/ConnectionStressTest.py
+++ b/tests/wlan/functional/ConnectionStressTest.py
@@ -21,7 +21,6 @@
import logging
import time
from dataclasses import dataclass
-from typing import List
from mobly import asserts, test_runner
from mobly.records import TestResultRecord
@@ -56,7 +55,7 @@
num_of_iterations = 10
def pre_run(self):
- tests: List[TestParams] = []
+ tests: list[TestParams] = []
# Successful associate
for profile in ["whirlwind", "whirlwind_11ab_legacy", "whirlwind_11ag_legacy"]:
diff --git a/tests/wlan/functional/PingStressTest.py b/tests/wlan/functional/PingStressTest.py
index 4ffd292..8daa004 100644
--- a/tests/wlan/functional/PingStressTest.py
+++ b/tests/wlan/functional/PingStressTest.py
@@ -22,7 +22,7 @@
import logging
import multiprocessing
-from typing import Any, Callable, List, NamedTuple, Union
+from typing import Any, Callable, NamedTuple, Union
from mobly import asserts, signals, test_runner
@@ -235,8 +235,8 @@
self.iperf_server_ipv6,
f"{self.ap_ipv6}%{self.dut.get_default_wlan_test_interface()}",
]
- ping_processes: List[multiprocessing.Process] = []
- ping_results: List[Any] = []
+ ping_processes: list[multiprocessing.Process] = []
+ ping_results: list[Any] = []
def ping_from_dut(self, dest_ip, ping_results):
self.log.info(f"Attempting to ping {dest_ip}...")
diff --git a/tests/wlan/functional/SoftApTest.py b/tests/wlan/functional/SoftApTest.py
index 24e6d5f..2c01159 100644
--- a/tests/wlan/functional/SoftApTest.py
+++ b/tests/wlan/functional/SoftApTest.py
@@ -20,7 +20,7 @@
import time
from dataclasses import dataclass
from enum import Enum, auto, unique
-from typing import Any, Dict, List, Mapping, Type, TypeVar, Union
+from typing import Any, Dict, Mapping, Type, TypeVar, Union
from mobly import asserts, signals, test_runner
from mobly.config_parser import TestRunConfig
@@ -56,7 +56,7 @@
STATE_UP = True
STATE_DOWN = False
-ConfigValue = Union[str, int, bool, List["ConfigValue"], "Config"]
+ConfigValue = Union[str, int, bool, list["ConfigValue"], "Config"]
Config = Dict[str, ConfigValue]
T = TypeVar("T")
@@ -315,7 +315,7 @@
self.generate_soft_ap_and_client_mode_random_toggle_stress_tests()
def generate_soft_ap_tests(self):
- tests: List[SoftAPParams] = []
+ tests: list[SoftAPParams] = []
for operating_band in OperatingBand.all():
for security_mode in [
@@ -367,7 +367,7 @@
# TODO(fxb/51313): Add in device agnosticity for clients
# Create a wlan device and iperf client for each Android client
- self.clients: List[SupportsWLAN] = []
+ self.clients: list[SupportsWLAN] = []
self.iperf_clients_map: Dict[Any, Any] = {}
for device in self.android_devices:
client_wlan_device = create_wlan_device(device)
@@ -1126,7 +1126,7 @@
self.start_soft_ap(soft_ap_params)
- associated: List[Dict[str, Any]] = []
+ associated: list[Dict[str, Any]] = []
for client in self.clients:
# Associate new client
@@ -1311,7 +1311,7 @@
operating_band: "only_2_4_ghz"
iterations: 10
"""
- test_specs: List[Dict[str, Any]] = self.soft_ap_test_params.get(
+ test_specs: list[Dict[str, Any]] = self.soft_ap_test_params.get(
"test_soft_ap_association_stress",
[],
)
@@ -1357,7 +1357,7 @@
operating_band: "only_2_4_ghz"
iterations: 5
"""
- test_specs: List[Dict[str, Any]] = self.soft_ap_test_params.get(
+ test_specs: list[Dict[str, Any]] = self.soft_ap_test_params.get(
"toggle_soft_ap_and_client_tests",
[],
)
@@ -1397,7 +1397,7 @@
operating_band: "only_2_4_ghz"
iterations: 5
"""
- test_specs: List[Dict[str, Any]] = self.soft_ap_test_params.get(
+ test_specs: list[Dict[str, Any]] = self.soft_ap_test_params.get(
"test_soft_ap_toggle_stress",
[],
)
@@ -1437,7 +1437,7 @@
operating_band: "only_2_4_ghz"
iterations: 10
"""
- test_specs: List[Dict[str, Any]] = self.soft_ap_test_params.get(
+ test_specs: list[Dict[str, Any]] = self.soft_ap_test_params.get(
"test_client_mode_toggle_stress",
[],
)
@@ -1461,7 +1461,7 @@
"""Same as test_soft_ap_toggle_stress, but client mode is set up
at test start and verified after every toggle."""
- test_specs: List[Dict[str, Any]] = self.soft_ap_test_params.get(
+ test_specs: list[Dict[str, Any]] = self.soft_ap_test_params.get(
"test_soft_ap_toggle_stress_with_client_mode",
[],
)
@@ -1484,7 +1484,7 @@
def generate_client_mode_toggle_stress_with_soft_ap_tests(self):
"""Same as test_client_mode_toggle_stress, but softap is set up at
test start and verified after every toggle."""
- test_specs: List[Dict[str, Any]] = self.soft_ap_test_params.get(
+ test_specs: list[Dict[str, Any]] = self.soft_ap_test_params.get(
"test_client_mode_toggle_stress_with_soft_ap",
[],
)
@@ -1507,7 +1507,7 @@
def generate_soft_ap_and_client_mode_random_toggle_stress_tests(self):
"""Same as above toggle stres tests, but each iteration, either softap,
client mode, or both are toggled, then states are verified."""
- test_specs: List[Dict[str, Any]] = self.soft_ap_test_params.get(
+ test_specs: list[Dict[str, Any]] = self.soft_ap_test_params.get(
"test_soft_ap_and_client_mode_random_toggle_stress",
[],
)
diff --git a/tests/wlan/functional/reboot/WlanRebootApTest.py b/tests/wlan/functional/reboot/WlanRebootApTest.py
index 11fcf3b..6b2f74b 100644
--- a/tests/wlan/functional/reboot/WlanRebootApTest.py
+++ b/tests/wlan/functional/reboot/WlanRebootApTest.py
@@ -15,7 +15,7 @@
# limitations under the License.
import itertools
-from typing import List, Tuple
+from typing import Tuple
import base_test
from base_test import BandType, DeviceType, IpVersionType, RebootType, TestParams
@@ -40,8 +40,8 @@
arg_sets=self._generate_reboot_ap_test_params(),
)
- def _generate_reboot_ap_test_params(self) -> List[Tuple[TestParams]]:
- test_params: List[Tuple[TestParams]] = []
+ def _generate_reboot_ap_test_params(self) -> list[Tuple[TestParams]]:
+ test_params: list[Tuple[TestParams]] = []
for (
reboot_type,
band,
diff --git a/tests/wlan/functional/reboot/WlanRebootDutTest.py b/tests/wlan/functional/reboot/WlanRebootDutTest.py
index 2938f95..0b916a8 100644
--- a/tests/wlan/functional/reboot/WlanRebootDutTest.py
+++ b/tests/wlan/functional/reboot/WlanRebootDutTest.py
@@ -15,7 +15,7 @@
# limitations under the License.
import itertools
-from typing import List, Tuple
+from typing import Tuple
import base_test
from base_test import BandType, DeviceType, IpVersionType, RebootType, TestParams
@@ -40,8 +40,8 @@
arg_sets=self._generate_reboot_dut_test_params(),
)
- def _generate_reboot_dut_test_params(self) -> List[Tuple[TestParams]]:
- test_params: List[Tuple[TestParams]] = []
+ def _generate_reboot_dut_test_params(self) -> list[Tuple[TestParams]]:
+ test_params: list[Tuple[TestParams]] = []
for (
reboot_type,
band,
diff --git a/tests/wlan/functional/reboot/base_test.py b/tests/wlan/functional/reboot/base_test.py
index fc8d14b..e40ae26 100644
--- a/tests/wlan/functional/reboot/base_test.py
+++ b/tests/wlan/functional/reboot/base_test.py
@@ -20,7 +20,6 @@
from dataclasses import dataclass
from enum import Enum, auto, unique
from multiprocessing import Process
-from typing import List
from mobly import asserts, signals
@@ -83,7 +82,7 @@
return False
@staticmethod
- def all() -> List["IpVersionType"]:
+ def all() -> list["IpVersionType"]:
return [IpVersionType.IPV4, IpVersionType.IPV6, IpVersionType.DUAL_IPV4_IPV6]
diff --git a/tests/wlan/performance/ChannelSweepTest.py b/tests/wlan/performance/ChannelSweepTest.py
index b5f662c..67fc66d 100644
--- a/tests/wlan/performance/ChannelSweepTest.py
+++ b/tests/wlan/performance/ChannelSweepTest.py
@@ -20,7 +20,7 @@
from dataclasses import dataclass
from pathlib import Path
from statistics import pstdev
-from typing import Dict, List, Tuple
+from typing import Dict, Tuple
from mobly import asserts, test_runner
from mobly.config_parser import TestRunConfig
@@ -95,7 +95,7 @@
rx_throughput_mbps: float | None
-ChannelThroughputMap = Dict[ThroughputKey, List[ThroughputValue]]
+ChannelThroughputMap = Dict[ThroughputKey, list[ThroughputValue]]
class ChannelSweepTest(base_test.WifiBaseTest):
@@ -114,7 +114,7 @@
self.channel_throughput: ChannelThroughputMap = {}
def pre_run(self):
- tests: List[Tuple[TestParams]] = []
+ tests: list[Tuple[TestParams]] = []
def generate_test_name(test: TestParams):
return f"test_{test.country_code}_{test.security_mode}_channel_{test.channel}_{test.channel_bandwidth}mhz"
@@ -155,8 +155,8 @@
self.generate_tests(self.run_channel_performance, generate_test_name, tests)
- def get_existing_test_names(self) -> List[str]:
- test_names: List[str] = super().get_existing_test_names()
+ def get_existing_test_names(self) -> list[str]:
+ test_names: list[str] = super().get_existing_test_names()
# Verify standard deviation last since it depends on the throughput results from
# all other tests.
test_names.sort(key=lambda n: n == "test_standard_deviation")
@@ -524,7 +524,7 @@
f"deviation of {max_std_dev} Mb/s"
)
- errors: List[str] = []
+ errors: list[str] = []
for test, throughputs in self.channel_throughput.items():
tx_values = []
diff --git a/tests/wlan/performance/WlanRvrTest.py b/tests/wlan/performance/WlanRvrTest.py
index 8a03ad6..926fcd3 100644
--- a/tests/wlan/performance/WlanRvrTest.py
+++ b/tests/wlan/performance/WlanRvrTest.py
@@ -16,7 +16,6 @@
import logging
import os
import time
-from typing import List
from mobly import asserts, test_runner
from mobly.records import TestResultRecord
@@ -367,8 +366,8 @@
Returns:
The bokeh graph data.
"""
- throughput: List[int] = []
- relative_attn: List[int] = []
+ throughput: list[int] = []
+ relative_attn: list[int] = []
if band == "2g":
rvr_attenuators = self.attenuators_2g
elif band == "5g":
diff --git a/tests/wlan_policy/PolicyScanTest.py b/tests/wlan_policy/PolicyScanTest.py
index 11fc751..4a3c7e8 100644
--- a/tests/wlan_policy/PolicyScanTest.py
+++ b/tests/wlan_policy/PolicyScanTest.py
@@ -18,7 +18,7 @@
import logging
from datetime import datetime
-from typing import Any, List, TypeGuard
+from typing import Any, TypeGuard
from mobly import asserts, signals, test_runner
@@ -32,7 +32,7 @@
from antlion.test_utils.wifi import base_test
-def is_str_list(v: Any) -> TypeGuard[List[str]]:
+def is_str_list(v: Any) -> TypeGuard[list[str]]:
return isinstance(v, list) and all(isinstance(s, str) for s in v)
@@ -60,8 +60,8 @@
self.access_point = self.access_points[0]
self.access_point.stop_all_aps()
# Generate network params.
- bss_settings_2g: List[hostapd_bss_settings.BssSettings] = []
- bss_settings_5g: List[hostapd_bss_settings.BssSettings] = []
+ bss_settings_2g: list[hostapd_bss_settings.BssSettings] = []
+ bss_settings_5g: list[hostapd_bss_settings.BssSettings] = []
open_network = self.get_open_network(False, [])
self.open_network_2g = open_network["2g"]
self.open_network_5g = open_network["5g"]
@@ -130,7 +130,7 @@
"""Helper Functions"""
- def perform_scan(self, fd: FuchsiaDevice) -> List[str]:
+ def perform_scan(self, fd: FuchsiaDevice) -> list[str]:
"""Initiates scan on a Fuchsia device and returns results
Args:
@@ -190,7 +190,7 @@
raise signals.TestFailure("Aborting test - Connect call failed")
self.log.info("Network connection successful.")
- def assert_network_is_in_results(self, scan_results: List[str], ssid: str) -> None:
+ def assert_network_is_in_results(self, scan_results: list[str], ssid: str) -> None:
"""Verified scan results contain a specified network
Args: