Remove use of typing.Dict
Replace all use of typing.Dict with its equivalent Python collection,
dict. This syntax was introduced as part of the Python 3.9 release.
Change-Id: I290211e75c929e4fee48e20c127c32cf09842e2c
Reviewed-on: https://fuchsia-review.googlesource.com/c/antlion/+/890274
Reviewed-by: Hayden Nix <haydennix@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/controllers/access_point.py b/packages/antlion/controllers/access_point.py
index da27d5a..0db1411 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, Mapping, Set, Tuple
+from typing import Any, FrozenSet, Mapping, Set, Tuple
from antlion import logger, utils
from antlion.capabilities.ssh import SSHConfig, SSHProvider
@@ -117,9 +117,9 @@
# A map from network interface name to _ApInstance objects representing
# the hostapd instance running against the interface.
- self._aps: Dict[str, _ApInstance] = dict()
+ self._aps: dict[str, _ApInstance] = dict()
self._dhcp: DhcpServer | None = None
- self._dhcp_bss: Dict[Any, Subnet] = dict()
+ self._dhcp_bss: dict[Any, Subnet] = dict()
self._radvd: Radvd | None = None
self.bridge = BridgeInterface(self)
self.iwconfig = ApIwconfig(self)
@@ -173,7 +173,7 @@
radvd_config: RadvdConfig | None = None,
setup_bridge: bool = False,
is_nat_enabled: bool = True,
- additional_parameters: Dict[str, Any] | None = None,
+ additional_parameters: dict[str, Any] | None = None,
) -> list[Any]:
"""Starts as an ap using a set of configurations.
@@ -383,7 +383,7 @@
return self._dhcp.get_logs()
return None
- def get_hostapd_logs(self) -> Dict[str, str]:
+ def get_hostapd_logs(self) -> dict[str, str]:
"""Get hostapd logs for all interfaces on AP object.
This allows consumers of the access point objects to validate hostapd
@@ -391,7 +391,7 @@
Returns: A dict with {interface: log} from hostapd instances.
"""
- hostapd_logs: Dict[str, str] = dict()
+ hostapd_logs: dict[str, str] = dict()
for identifier in self._aps:
hostapd_logs[identifier] = self._aps[identifier].hostapd.pull_logs()
return hostapd_logs
@@ -590,7 +590,7 @@
timeout: int = 1000,
size: int = 56,
additional_ping_params: Any | None = None,
- ) -> Dict[str, Any]:
+ ) -> dict[str, Any]:
"""Pings from AP to dest_ip, returns dict of ping stats (see utils.ping)"""
return utils.ping(
self.ssh,
@@ -677,7 +677,7 @@
if isinstance(settings, HostapdConfig):
config = settings
setup_bridge = False
- additional_parameters: Dict[str, Any] = {}
+ additional_parameters: dict[str, Any] = {}
elif isinstance(settings, dict):
config = settings["hostapd_config"]
@@ -752,7 +752,7 @@
hidden: bool | None = False,
security: Security | None = None,
pmf_support: int | None = None,
- additional_ap_parameters: Dict[str, Any] | 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,
diff --git a/packages/antlion/controllers/ap_lib/hostapd.py b/packages/antlion/controllers/ap_lib/hostapd.py
index 3cf0cc4..6e355f2 100644
--- a/packages/antlion/controllers/ap_lib/hostapd.py
+++ b/packages/antlion/controllers/ap_lib/hostapd.py
@@ -17,7 +17,7 @@
import logging
import re
import time
-from typing import Any, Dict, Iterable, Set
+from typing import Any, Iterable, Set
from antlion.controllers.ap_lib import hostapd_constants
from antlion.controllers.ap_lib.extended_capabilities import ExtendedCapabilities
@@ -65,7 +65,7 @@
self,
config: HostapdConfig,
timeout: int = 60,
- additional_parameters: Dict[str, Any] | None = None,
+ additional_parameters: dict[str, Any] | None = None,
) -> None:
"""Starts hostapd
@@ -357,7 +357,7 @@
if should_be_up and is_dead:
raise Error("Hostapd failed to start", self)
- def _write_configs(self, additional_parameters: Dict[str, Any]) -> None:
+ def _write_configs(self, additional_parameters: dict[str, Any]) -> None:
"""Writes the configs to the hostapd config file."""
self._shell.delete_file(self._config_file)
diff --git a/packages/antlion/controllers/ap_lib/hostapd_bss_settings.py b/packages/antlion/controllers/ap_lib/hostapd_bss_settings.py
index 5047069..88cddab 100644
--- a/packages/antlion/controllers/ap_lib/hostapd_bss_settings.py
+++ b/packages/antlion/controllers/ap_lib/hostapd_bss_settings.py
@@ -13,7 +13,7 @@
# limitations under the License.
import collections
-from typing import Dict, Union
+from typing import Union
from antlion.controllers.ap_lib.hostapd_security import Security
@@ -45,9 +45,9 @@
self.hidden = hidden
self.bssid = bssid
- def generate_dict(self) -> Dict[str, Union[str, int]]:
+ def generate_dict(self) -> dict[str, Union[str, int]]:
"""Returns: A dictionary of bss settings."""
- settings: Dict[str, Union[str, int]] = collections.OrderedDict()
+ settings: dict[str, Union[str, int]] = collections.OrderedDict()
settings["bss"] = self.name
if self.bssid:
settings["bssid"] = self.bssid
diff --git a/packages/antlion/controllers/ap_lib/hostapd_config.py b/packages/antlion/controllers/ap_lib/hostapd_config.py
index 9bb7e46..40c7406 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, Union
+from typing import Any, FrozenSet, Union
from antlion.controllers.ap_lib import hostapd_constants
from antlion.controllers.ap_lib.hostapd_bss_settings import BssSettings
@@ -107,7 +107,7 @@
min_streams: int | None = None,
wnm_features: FrozenSet[hostapd_constants.WnmFeature] = frozenset(),
bss_settings: list[Any] | None = None,
- additional_parameters: Dict[str, Any] | None = None,
+ additional_parameters: dict[str, Any] | None = None,
set_ap_defaults_profile: str = "whirlwind",
) -> None:
"""Construct a HostapdConfig.
@@ -267,7 +267,7 @@
self._wnm_features = wnm_features
self._additional_parameters = additional_parameters
- self._bss_lookup: Dict[str, BssSettings] = collections.OrderedDict()
+ self._bss_lookup: dict[str, BssSettings] = collections.OrderedDict()
for bss in bss_settings:
if bss.name in self._bss_lookup:
raise ValueError(
@@ -420,7 +420,7 @@
self._frequency = value
@property
- def bss_lookup(self) -> Dict[str, BssSettings]:
+ def bss_lookup(self) -> dict[str, BssSettings]:
return self._bss_lookup
@property
@@ -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_security.py b/packages/antlion/controllers/ap_lib/hostapd_security.py
index ac55961..82e96cb 100644
--- a/packages/antlion/controllers/ap_lib/hostapd_security.py
+++ b/packages/antlion/controllers/ap_lib/hostapd_security.py
@@ -15,7 +15,7 @@
import collections
import string
from enum import Enum, unique
-from typing import Dict, Union
+from typing import Union
from antlion.controllers.ap_lib import hostapd_constants
from antlion.typing import StrEnum
@@ -354,12 +354,12 @@
else:
self.password = password
- def generate_dict(self) -> Dict[str, Union[str, int]]:
+ def generate_dict(self) -> dict[str, Union[str, int]]:
"""Returns: an ordered dictionary of settings"""
if self.security_mode is SecurityMode.OPEN:
return {}
- settings: Dict[str, Union[str, int]] = collections.OrderedDict()
+ settings: dict[str, Union[str, int]] = collections.OrderedDict()
if self.security_mode is SecurityMode.WEP:
settings["wep_default_key"] = self.wep_default_key
diff --git a/packages/antlion/controllers/ap_lib/radvd_config.py b/packages/antlion/controllers/ap_lib/radvd_config.py
index 0d0a8c4..d3d6d97 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
+from typing import Any
from antlion.controllers.ap_lib import radvd_constants
@@ -240,7 +240,7 @@
self._adv_rdnss_lifetime = adv_rdnss_lifetime
def package_configs(self):
- conf: Dict[str, Any] = dict()
+ conf: dict[str, Any] = dict()
conf["prefix"] = self._prefix
conf["clients"] = self._clients
conf["route"] = self._route
diff --git a/packages/antlion/controllers/ap_lib/regulatory_channels.py b/packages/antlion/controllers/ap_lib/regulatory_channels.py
index 66c9fd1..c27d163 100644
--- a/packages/antlion/controllers/ap_lib/regulatory_channels.py
+++ b/packages/antlion/controllers/ap_lib/regulatory_channels.py
@@ -1,11 +1,10 @@
from dataclasses import dataclass
-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/fuchsia_device.py b/packages/antlion/controllers/fuchsia_device.py
index 7ebbd31..509d121 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, Mapping
+from typing import Any, Mapping
from antlion import context
from antlion import logger as acts_logger
@@ -239,8 +239,8 @@
self._generate_ssh_config(self.ssh_config)
# WLAN interface info is populated inside configure_wlan
- self.wlan_client_interfaces: Dict[str, Any] = {}
- self.wlan_ap_interfaces: Dict[str, Any] = {}
+ self.wlan_client_interfaces: dict[str, Any] = {}
+ self.wlan_ap_interfaces: dict[str, Any] = {}
self.wlan_client_test_interface_name = fd_conf_data.get(
"wlan_client_test_interface", None
)
diff --git a/packages/antlion/controllers/fuchsia_lib/base_lib.py b/packages/antlion/controllers/fuchsia_lib/base_lib.py
index 3bf0a4b..c361643 100644
--- a/packages/antlion/controllers/fuchsia_lib/base_lib.py
+++ b/packages/antlion/controllers/fuchsia_lib/base_lib.py
@@ -16,7 +16,7 @@
import json
import logging
-from typing import Any, Dict, Mapping
+from typing import Any, Mapping
from urllib.request import Request, urlopen
from mobly.logger import PrefixLoggerAdapter
@@ -47,7 +47,7 @@
cmd: str,
args: Mapping[str, Any],
response_timeout: int = DEFAULT_SL4F_RESPONSE_TIMEOUT_SEC,
- ) -> Dict[str, Any]:
+ ) -> dict[str, Any]:
"""Builds and sends a JSON command to SL4F server.
Args:
diff --git a/packages/antlion/controllers/fuchsia_lib/device_lib.py b/packages/antlion/controllers/fuchsia_lib/device_lib.py
index b5b560e..7b6768c 100644
--- a/packages/antlion/controllers/fuchsia_lib/device_lib.py
+++ b/packages/antlion/controllers/fuchsia_lib/device_lib.py
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from typing import Any, Dict
+from typing import Any
from antlion.controllers.fuchsia_lib.base_lib import BaseLib
@@ -23,17 +23,17 @@
def __init__(self, addr: str) -> None:
super().__init__(addr, "device")
- def get_device_name(self) -> Dict[str, Any]:
+ def get_device_name(self) -> dict[str, Any]:
"""Get the device name."""
return self.send_command("device_facade.GetDeviceName", {})
- def get_product_name(self) -> Dict[str, Any]:
+ def get_product_name(self) -> dict[str, Any]:
"""Get the product name."""
return self.send_command("device_facade.GetProduct", {})
- def get_version(self) -> Dict[str, Any]:
+ def get_version(self) -> dict[str, Any]:
"""Get the device version."""
return self.send_command("device_facade.GetVersion", {})
diff --git a/packages/antlion/controllers/fuchsia_lib/ffx.py b/packages/antlion/controllers/fuchsia_lib/ffx.py
index 50543da..256c082 100644
--- a/packages/antlion/controllers/fuchsia_lib/ffx.py
+++ b/packages/antlion/controllers/fuchsia_lib/ffx.py
@@ -21,7 +21,7 @@
import time
from pathlib import Path, PurePath
from shutil import rmtree
-from typing import Any, Dict
+from typing import Any
from antlion import context, logger, signals, utils
@@ -177,7 +177,7 @@
self._ssh_auth_sock_path = str(PurePath(self._sock_dir, "ssh_auth_sock"))
self._overnet_socket_path = str(PurePath(self._sock_dir, "overnet_socket"))
- config: Dict[str, Any] = {
+ config: dict[str, Any] = {
"target": {
"default": self.mdns_name,
},
diff --git a/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_controller.py b/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_controller.py
index 6f4e56d..608a006 100644
--- a/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_controller.py
+++ b/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_controller.py
@@ -15,7 +15,7 @@
# limitations under the License.
import time
-from typing import TYPE_CHECKING, Any, Dict
+from typing import TYPE_CHECKING, Any
from antlion import logger, signals, utils
@@ -26,7 +26,7 @@
TIME_TO_WAIT_FOR_COUNTRY_CODE = 10
-WlanInterfaces = Dict[str, Dict[str, Any]]
+WlanInterfaces = dict[str, dict[str, Any]]
class WlanControllerError(signals.ControllerError):
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 aca193c..676a206 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, Tuple
+from typing import Any, 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
@@ -688,7 +688,7 @@
)
return phy_ids_response["result"]
- def _get_phy_country_codes(self) -> Dict[str, str]:
+ def _get_phy_country_codes(self) -> dict[str, str]:
"""Get mapping of WLAN interfaces to the country code they are set to."""
phy_ids = self._get_phy_ids()
args = [GetCountryCodeFromPhyParams(self.sl4f.wlan_lib, id) for id in phy_ids]
diff --git a/packages/antlion/controllers/openwrt_ap.py b/packages/antlion/controllers/openwrt_ap.py
index 7c1a039..69d778c 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, Literal
+from typing import Literal
import yaml
@@ -90,7 +90,7 @@
return [ap.ssh_settings.hostname for ap in aps]
-BSSIDMap = Dict[Literal["2g", "5g"], Dict[str, str]]
+BSSIDMap = dict[Literal["2g", "5g"], dict[str, str]]
class OpenWrtAP(object):
@@ -214,7 +214,7 @@
bssid_map["2g"][ssid] = self.get_bssid(ifname)
return bssid_map
- def get_ifnames_for_ssids(self, radio) -> Dict[str, str]:
+ def get_ifnames_for_ssids(self, radio) -> dict[str, str]:
"""Get interfaces for wifi networks.
Args:
@@ -223,7 +223,7 @@
Returns:
dictionary of ssid - ifname mappings.
"""
- ssid_ifname_map: Dict[str, str] = {}
+ ssid_ifname_map: dict[str, str] = {}
str_output = self.ssh.run(f"wifi status {radio}").stdout
wifi_status = yaml.load(
str_output.replace("\t", "").replace("\n", ""), Loader=yaml.SafeLoader
diff --git a/packages/antlion/controllers/utils_lib/ssh/settings.py b/packages/antlion/controllers/utils_lib/ssh/settings.py
index f7da15f..b277045 100644
--- a/packages/antlion/controllers/utils_lib/ssh/settings.py
+++ b/packages/antlion/controllers/utils_lib/ssh/settings.py
@@ -20,7 +20,7 @@
An instance of SshSettings or None
"""
-from typing import Dict, Mapping, Union
+from typing import Mapping, Union
class SshSettings(object):
@@ -62,7 +62,7 @@
self.identity_file = identity_file
self.ssh_config = ssh_config
- def construct_ssh_options(self) -> Dict[str, Union[str, int, bool]]:
+ def construct_ssh_options(self) -> dict[str, Union[str, int, bool]]:
"""Construct the ssh options.
Constructs a dictionary of option that should be used with the ssh
@@ -71,14 +71,14 @@
Returns:
A dictionary of option name to value.
"""
- current_options: Dict[str, Union[str, int, bool]] = {}
+ current_options: dict[str, Union[str, int, bool]] = {}
current_options["StrictHostKeyChecking"] = False
current_options["UserKnownHostsFile"] = self.host_file
current_options["ConnectTimeout"] = self.connect_timeout
current_options["ServerAliveInterval"] = self.alive_interval
return current_options
- def construct_ssh_flags(self) -> Dict[str, Union[None, str, int]]:
+ def construct_ssh_flags(self) -> dict[str, Union[None, str, int]]:
"""Construct the ssh flags.
Constructs what flags should be used in the ssh connection.
@@ -87,7 +87,7 @@
A dictionary of flag name to value. If value is none then it is
treated as a binary flag.
"""
- current_flags: Dict[str, Union[None, str, int]] = {}
+ current_flags: dict[str, Union[None, str, int]] = {}
current_flags["-a"] = None
current_flags["-x"] = None
current_flags["-p"] = self.port
diff --git a/packages/antlion/test_utils/abstract_devices/wlan_device.py b/packages/antlion/test_utils/abstract_devices/wlan_device.py
index 5618d6e..944ab8e 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, Protocol, Union, runtime_checkable
+from typing import Any, Protocol, Union, runtime_checkable
from mobly.records import TestResultRecord
@@ -157,7 +157,7 @@
timeout: int = 1000,
size: int = 25,
additional_ping_params: str | None = None,
- ) -> Dict[str, Any]:
+ ) -> dict[str, Any]:
"""Pings from a device to an IP address or hostname
Args:
@@ -306,7 +306,7 @@
timeout: int = 1000,
size: int = 25,
additional_ping_params: str | None = None,
- ) -> Dict[str, Any]:
+ ) -> dict[str, Any]:
raise NotImplementedError("ping is not implemented")
def hard_power_cycle(self, pdus: list[PduDevice]) -> None:
@@ -419,7 +419,7 @@
timeout: int = 1000,
size: int = 25,
additional_ping_params: str | None = None,
- ) -> Dict[str, Any]:
+ ) -> dict[str, Any]:
return self.device.ping(
dest_ip,
count=count,
diff --git a/packages/antlion/test_utils/wifi/base_test.py b/packages/antlion/test_utils/wifi/base_test.py
index c7c81f0..5693e6e 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, TypedDict, TypeVar, Union
+from typing import Any, TypedDict, TypeVar, Union
from mobly.base_test import STAGE_NAME_TEARDOWN_CLASS
from mobly.config_parser import TestRunConfig
@@ -68,7 +68,7 @@
ieee80211w: str | None
-NetworkList = Dict[str, Network]
+NetworkList = dict[str, Network]
class WifiBaseTest(AntlionBaseTest):
@@ -78,7 +78,7 @@
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.packet_log_pid: Dict[str, Any] = {}
+ self.packet_log_pid: dict[str, Any] = {}
def setup_class(self) -> None:
T = TypeVar("T")
@@ -480,9 +480,9 @@
owe_network: bool = False,
sae_network: bool = False,
saemixed_network: bool = False,
- radius_conf_2g: Dict[str, Any] | None = None,
- radius_conf_5g: Dict[str, Any] | None = None,
- radius_conf_pwd: Dict[str, Any] | None = None,
+ radius_conf_2g: dict[str, Any] | None = None,
+ radius_conf_5g: dict[str, Any] | None = None,
+ radius_conf_pwd: dict[str, Any] | None = None,
ap_count: int = 1,
ieee80211w: int | None = None,
) -> None:
diff --git a/packages/antlion/utils.py b/packages/antlion/utils.py
index 7af17c4..222a31d 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, Union
+from typing import TYPE_CHECKING, Any, 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/dhcp/Dhcpv4InteropCombinatorialOptionsTest.py b/tests/dhcp/Dhcpv4InteropCombinatorialOptionsTest.py
index 042481c..6eb321f 100644
--- a/tests/dhcp/Dhcpv4InteropCombinatorialOptionsTest.py
+++ b/tests/dhcp/Dhcpv4InteropCombinatorialOptionsTest.py
@@ -16,7 +16,7 @@
import random
from collections import namedtuple
-from typing import Dict, Union
+from typing import Union
from mobly import asserts, test_runner
@@ -86,7 +86,7 @@
],
)
- def _generate_max_sized_message_dhcp_options(self) -> Dict[str, Union[int, str]]:
+ def _generate_max_sized_message_dhcp_options(self) -> dict[str, Union[int, str]]:
"""Generates the DHCP options for max sized message test.
The RFC limits DHCP payloads to 576 bytes unless the client signals it
diff --git a/tests/wlan/functional/SoftApTest.py b/tests/wlan/functional/SoftApTest.py
index 2c01159..4b38333 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, Mapping, Type, TypeVar, Union
+from typing import Any, Mapping, Type, TypeVar, Union
from mobly import asserts, signals, test_runner
from mobly.config_parser import TestRunConfig
@@ -57,7 +57,7 @@
STATE_DOWN = False
ConfigValue = Union[str, int, bool, list["ConfigValue"], "Config"]
-Config = Dict[str, ConfigValue]
+Config = dict[str, ConfigValue]
T = TypeVar("T")
@@ -102,7 +102,7 @@
password: str
@staticmethod
- def from_dict(d: Dict[str, Any]) -> "APParams":
+ def from_dict(d: dict[str, Any]) -> "APParams":
security_mode_str = get_typed(d, "security_mode", str, SecurityMode.OPEN.value)
security_mode = SecurityMode.from_str(security_mode_str)
password = get_typed(
@@ -171,7 +171,7 @@
return f'{band}_{self.security_type.replace("/", "_")}_{self.connectivity_mode}'
@staticmethod
- def from_dict(d: Dict[str, Any]) -> "SoftAPParams":
+ def from_dict(d: dict[str, Any]) -> "SoftAPParams":
security_type = get_typed(d, "security_type", str, SecurityMode.OPEN.value)
security_mode = SecurityMode.from_str(security_type)
@@ -216,7 +216,7 @@
return f"{self.soft_ap_params}_{self.test_type}_{self.iterations}_iterations"
@staticmethod
- def from_dict(d: Dict[str, Any]) -> "AssociationStressTestParams":
+ def from_dict(d: dict[str, Any]) -> "AssociationStressTestParams":
test_type = get_typed(
d, "test_type", str, TestType.ASSOCIATE_AND_PASS_TRAFFIC.value
)
@@ -241,7 +241,7 @@
)
@staticmethod
- def from_dict(d: Dict[str, Any]) -> "ClientModeAlternatingTestParams":
+ def from_dict(d: dict[str, Any]) -> "ClientModeAlternatingTestParams":
return ClientModeAlternatingTestParams(
ap_params=APParams.from_dict(d.get("ap_params", {})),
soft_ap_params=SoftAPParams.from_dict(d.get("soft_ap_params", {})),
@@ -258,7 +258,7 @@
return f"{self.soft_ap_params}_{self.iterations}_iterations"
@staticmethod
- def from_dict(d: Dict[str, Any]) -> "ToggleTestParams":
+ def from_dict(d: dict[str, Any]) -> "ToggleTestParams":
return ToggleTestParams(
soft_ap_params=SoftAPParams.from_dict(d.get("soft_ap_params", {})),
iterations=get_typed(d, "iterations", int, 10),
@@ -274,7 +274,7 @@
return f"{self.ap_params}_{self.iterations}_iterations"
@staticmethod
- def from_dict(d: Dict[str, Any]) -> "ClientModeToggleTestParams":
+ def from_dict(d: dict[str, Any]) -> "ClientModeToggleTestParams":
return ClientModeToggleTestParams(
ap_params=APParams.from_dict(d.get("ap_params", {})),
iterations=get_typed(d, "iterations", int, 10),
@@ -368,7 +368,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.iperf_clients_map: Dict[Any, Any] = {}
+ self.iperf_clients_map: dict[Any, Any] = {}
for device in self.android_devices:
client_wlan_device = create_wlan_device(device)
self.clients.append(client_wlan_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/performance/ChannelSweepTest.py b/tests/wlan/performance/ChannelSweepTest.py
index 67fc66d..b8c6912 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, Tuple
+from typing import 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):