diff --git a/homeassistant/components/ads/__init__.py b/homeassistant/components/ads/__init__.py index 7041a757a42..f5742718b12 100644 --- a/homeassistant/components/ads/__init__.py +++ b/homeassistant/components/ads/__init__.py @@ -136,7 +136,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool: # Tuple to hold data needed for notification -NotificationItem = namedtuple( +NotificationItem = namedtuple( # noqa: PYI024 "NotificationItem", "hnotify huser name plc_datatype callback" ) diff --git a/homeassistant/components/asuswrt/bridge.py b/homeassistant/components/asuswrt/bridge.py index b193787f500..4e928d63666 100644 --- a/homeassistant/components/asuswrt/bridge.py +++ b/homeassistant/components/asuswrt/bridge.py @@ -52,7 +52,7 @@ SENSORS_TYPE_LOAD_AVG = "sensors_load_avg" SENSORS_TYPE_RATES = "sensors_rates" SENSORS_TYPE_TEMPERATURES = "sensors_temperatures" -WrtDevice = namedtuple("WrtDevice", ["ip", "name", "connected_to"]) +WrtDevice = namedtuple("WrtDevice", ["ip", "name", "connected_to"]) # noqa: PYI024 _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/bbox/device_tracker.py b/homeassistant/components/bbox/device_tracker.py index 6ced2c73c9a..7157c47830c 100644 --- a/homeassistant/components/bbox/device_tracker.py +++ b/homeassistant/components/bbox/device_tracker.py @@ -39,7 +39,7 @@ def get_scanner(hass: HomeAssistant, config: ConfigType) -> BboxDeviceScanner | return scanner if scanner.success_init else None -Device = namedtuple("Device", ["mac", "name", "ip", "last_update"]) +Device = namedtuple("Device", ["mac", "name", "ip", "last_update"]) # noqa: PYI024 class BboxDeviceScanner(DeviceScanner): diff --git a/homeassistant/components/bt_smarthub/device_tracker.py b/homeassistant/components/bt_smarthub/device_tracker.py index 10c8000fb93..4b52f38ff31 100644 --- a/homeassistant/components/bt_smarthub/device_tracker.py +++ b/homeassistant/components/bt_smarthub/device_tracker.py @@ -51,7 +51,7 @@ def _create_device(data): return _Device(ip_address, mac, host, status, name) -_Device = namedtuple("_Device", ["ip_address", "mac", "host", "status", "name"]) +_Device = namedtuple("_Device", ["ip_address", "mac", "host", "status", "name"]) # noqa: PYI024 class BTSmartHubScanner(DeviceScanner): diff --git a/homeassistant/components/epic_games_store/calendar.py b/homeassistant/components/epic_games_store/calendar.py index 75c448e8467..2ebb381341e 100644 --- a/homeassistant/components/epic_games_store/calendar.py +++ b/homeassistant/components/epic_games_store/calendar.py @@ -16,7 +16,7 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import DOMAIN, CalendarType from .coordinator import EGSCalendarUpdateCoordinator -DateRange = namedtuple("DateRange", ["start", "end"]) +DateRange = namedtuple("DateRange", ["start", "end"]) # noqa: PYI024 async def async_setup_entry( diff --git a/homeassistant/components/fints/sensor.py b/homeassistant/components/fints/sensor.py index 2f47fdc09eb..8a92850ad47 100644 --- a/homeassistant/components/fints/sensor.py +++ b/homeassistant/components/fints/sensor.py @@ -28,7 +28,7 @@ SCAN_INTERVAL = timedelta(hours=4) ICON = "mdi:currency-eur" -BankCredentials = namedtuple("BankCredentials", "blz login pin url") +BankCredentials = namedtuple("BankCredentials", "blz login pin url") # noqa: PYI024 CONF_BIN = "bank_identification_number" CONF_ACCOUNTS = "accounts" diff --git a/homeassistant/components/hitron_coda/device_tracker.py b/homeassistant/components/hitron_coda/device_tracker.py index 68d93e9719d..61199e4b2f7 100644 --- a/homeassistant/components/hitron_coda/device_tracker.py +++ b/homeassistant/components/hitron_coda/device_tracker.py @@ -42,7 +42,7 @@ def get_scanner( return scanner if scanner.success_init else None -Device = namedtuple("Device", ["mac", "name"]) +Device = namedtuple("Device", ["mac", "name"]) # noqa: PYI024 class HitronCODADeviceScanner(DeviceScanner): diff --git a/homeassistant/components/modbus/modbus.py b/homeassistant/components/modbus/modbus.py index 82caa772ac4..e70b9de50f0 100644 --- a/homeassistant/components/modbus/modbus.py +++ b/homeassistant/components/modbus/modbus.py @@ -76,8 +76,8 @@ from .validators import check_config _LOGGER = logging.getLogger(__name__) -ConfEntry = namedtuple("ConfEntry", "call_type attr func_name") -RunEntry = namedtuple("RunEntry", "attr func") +ConfEntry = namedtuple("ConfEntry", "call_type attr func_name") # noqa: PYI024 +RunEntry = namedtuple("RunEntry", "attr func") # noqa: PYI024 PB_CALL = [ ConfEntry( CALL_TYPE_COIL, diff --git a/homeassistant/components/modbus/validators.py b/homeassistant/components/modbus/validators.py index 90ef0b5f083..e1120094d01 100644 --- a/homeassistant/components/modbus/validators.py +++ b/homeassistant/components/modbus/validators.py @@ -46,7 +46,7 @@ from .const import ( _LOGGER = logging.getLogger(__name__) -ENTRY = namedtuple( +ENTRY = namedtuple( # noqa: PYI024 "ENTRY", [ "struct_id", @@ -60,7 +60,7 @@ ILLEGAL = "I" OPTIONAL = "O" DEMANDED = "D" -PARM_IS_LEGAL = namedtuple( +PARM_IS_LEGAL = namedtuple( # noqa: PYI024 "PARM_IS_LEGAL", [ "count", diff --git a/homeassistant/components/ness_alarm/__init__.py b/homeassistant/components/ness_alarm/__init__.py index a8202434ce5..730a9aff765 100644 --- a/homeassistant/components/ness_alarm/__init__.py +++ b/homeassistant/components/ness_alarm/__init__.py @@ -44,7 +44,7 @@ DEFAULT_INFER_ARMING_STATE = False SIGNAL_ZONE_CHANGED = "ness_alarm.zone_changed" SIGNAL_ARMING_STATE_CHANGED = "ness_alarm.arming_state_changed" -ZoneChangedData = namedtuple("ZoneChangedData", ["zone_id", "state"]) +ZoneChangedData = namedtuple("ZoneChangedData", ["zone_id", "state"]) # noqa: PYI024 DEFAULT_ZONE_TYPE = BinarySensorDeviceClass.MOTION ZONE_SCHEMA = vol.Schema( diff --git a/homeassistant/components/netio/switch.py b/homeassistant/components/netio/switch.py index f5627f5e56b..54bfef5e1da 100644 --- a/homeassistant/components/netio/switch.py +++ b/homeassistant/components/netio/switch.py @@ -38,7 +38,7 @@ CONF_OUTLETS = "outlets" DEFAULT_PORT = 1234 DEFAULT_USERNAME = "admin" -Device = namedtuple("Device", ["netio", "entities"]) +Device = namedtuple("Device", ["netio", "entities"]) # noqa: PYI024 DEVICES: dict[str, Device] = {} MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) diff --git a/homeassistant/components/tellstick/sensor.py b/homeassistant/components/tellstick/sensor.py index 2c304f259da..1e27511bd84 100644 --- a/homeassistant/components/tellstick/sensor.py +++ b/homeassistant/components/tellstick/sensor.py @@ -29,7 +29,7 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType _LOGGER = logging.getLogger(__name__) -DatatypeDescription = namedtuple( +DatatypeDescription = namedtuple( # noqa: PYI024 "DatatypeDescription", ["name", "unit", "device_class"] ) diff --git a/homeassistant/scripts/benchmark/__init__.py b/homeassistant/scripts/benchmark/__init__.py index 34bc536502f..d39b1b64861 100644 --- a/homeassistant/scripts/benchmark/__init__.py +++ b/homeassistant/scripts/benchmark/__init__.py @@ -322,7 +322,7 @@ def _create_state_changed_event_from_old_new( attributes_json = json.dumps(attributes, cls=JSONEncoder) if attributes_json == "null": attributes_json = "{}" - row = collections.namedtuple( + row = collections.namedtuple( # noqa: PYI024 "Row", [ "event_type" diff --git a/pyproject.toml b/pyproject.toml index eb4bfc4970d..93f8427ef7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -821,7 +821,6 @@ ignore = [ "PLE0605", # temporarily disabled - "PYI024", # Use typing.NamedTuple instead of collections.namedtuple "RET503", "RET501", "TRY301" diff --git a/script/lint_and_test.py b/script/lint_and_test.py index e23870364b6..ff3db8aa1ed 100755 --- a/script/lint_and_test.py +++ b/script/lint_and_test.py @@ -20,7 +20,7 @@ except ImportError: RE_ASCII = re.compile(r"\033\[[^m]*m") -Error = namedtuple("Error", ["file", "line", "col", "msg", "skip"]) +Error = namedtuple("Error", ["file", "line", "col", "msg", "skip"]) # noqa: PYI024 PASS = "green" FAIL = "bold_red" diff --git a/tests/components/hardware/test_websocket_api.py b/tests/components/hardware/test_websocket_api.py index e8099069a9c..1379bdba120 100644 --- a/tests/components/hardware/test_websocket_api.py +++ b/tests/components/hardware/test_websocket_api.py @@ -61,7 +61,7 @@ async def test_system_status_subscription( response = await client.receive_json() assert response["success"] - VirtualMem = namedtuple("VirtualMemory", ["available", "percent", "total"]) + VirtualMem = namedtuple("VirtualMemory", ["available", "percent", "total"]) # noqa: PYI024 vmem = VirtualMem(10 * 1024**2, 50, 30 * 1024**2) with ( diff --git a/tests/components/jewish_calendar/__init__.py b/tests/components/jewish_calendar/__init__.py index 60726fc3a3e..440bffc2256 100644 --- a/tests/components/jewish_calendar/__init__.py +++ b/tests/components/jewish_calendar/__init__.py @@ -8,7 +8,7 @@ from freezegun import freeze_time as alter_time # noqa: F401 from homeassistant.components import jewish_calendar import homeassistant.util.dt as dt_util -_LatLng = namedtuple("_LatLng", ["lat", "lng"]) +_LatLng = namedtuple("_LatLng", ["lat", "lng"]) # noqa: PYI024 HDATE_DEFAULT_ALTITUDE = 754 NYC_LATLNG = _LatLng(40.7128, -74.0060) diff --git a/tests/components/logbook/test_init.py b/tests/components/logbook/test_init.py index 3534192a43e..34052cd8024 100644 --- a/tests/components/logbook/test_init.py +++ b/tests/components/logbook/test_init.py @@ -328,7 +328,7 @@ def create_state_changed_event_from_old_new( if new_state is not None: attributes = new_state.get("attributes") attributes_json = json.dumps(attributes, cls=JSONEncoder) - row = collections.namedtuple( + row = collections.namedtuple( # noqa: PYI024 "Row", [ "event_type", diff --git a/tests/components/russound_rio/const.py b/tests/components/russound_rio/const.py index d1f6aa7eead..527f4fe3377 100644 --- a/tests/components/russound_rio/const.py +++ b/tests/components/russound_rio/const.py @@ -12,5 +12,5 @@ MOCK_CONFIG = { "port": PORT, } -_CONTROLLER = namedtuple("Controller", ["mac_address", "controller_type"]) +_CONTROLLER = namedtuple("Controller", ["mac_address", "controller_type"]) # noqa: PYI024 MOCK_CONTROLLERS = {1: _CONTROLLER(mac_address=HARDWARE_MAC, controller_type=MODEL)} diff --git a/tests/components/tplink/__init__.py b/tests/components/tplink/__init__.py index c51a451c847..c63ca9139f1 100644 --- a/tests/components/tplink/__init__.py +++ b/tests/components/tplink/__init__.py @@ -39,7 +39,7 @@ from homeassistant.setup import async_setup_component from tests.common import MockConfigEntry, load_json_value_fixture -ColorTempRange = namedtuple("ColorTempRange", ["min", "max"]) +ColorTempRange = namedtuple("ColorTempRange", ["min", "max"]) # noqa: PYI024 MODULE = "homeassistant.components.tplink" MODULE_CONFIG_FLOW = "homeassistant.components.tplink.config_flow"