Enable collections-named-tuple (PYI024) rule in ruff (#123019)
This commit is contained in:
parent
b6c9fe86e1
commit
e734971d33
20 changed files with 21 additions and 22 deletions
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -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__)
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"]
|
||||
)
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -821,7 +821,6 @@ ignore = [
|
|||
"PLE0605",
|
||||
|
||||
# temporarily disabled
|
||||
"PYI024", # Use typing.NamedTuple instead of collections.namedtuple
|
||||
"RET503",
|
||||
"RET501",
|
||||
"TRY301"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue