1
0
mirror of https://github.com/home-assistant/core synced 2024-07-01 07:15:04 +00:00

Update mypy-dev to 1.11.0a9 (#120289)

This commit is contained in:
Marc Mueller 2024-06-24 09:57:15 +02:00 committed by GitHub
parent 213cb6f0fd
commit b798d76706
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 15 deletions

View File

@ -146,20 +146,19 @@ class PassiveBluetoothDataUpdate[_T]:
""" """
device_change = False device_change = False
changed_entity_keys: set[PassiveBluetoothEntityKey] = set() changed_entity_keys: set[PassiveBluetoothEntityKey] = set()
for key, device_info in new_data.devices.items(): for device_key, device_info in new_data.devices.items():
if device_change or self.devices.get(key, UNDEFINED) != device_info: if device_change or self.devices.get(device_key, UNDEFINED) != device_info:
device_change = True device_change = True
self.devices[key] = device_info self.devices[device_key] = device_info
for incoming, current in ( for incoming, current in (
(new_data.entity_descriptions, self.entity_descriptions), (new_data.entity_descriptions, self.entity_descriptions),
(new_data.entity_names, self.entity_names), (new_data.entity_names, self.entity_names),
(new_data.entity_data, self.entity_data), (new_data.entity_data, self.entity_data),
): ):
# mypy can't seem to work this out for key, data in incoming.items():
for key, data in incoming.items(): # type: ignore[attr-defined] if current.get(key, UNDEFINED) != data:
if current.get(key, UNDEFINED) != data: # type: ignore[attr-defined] changed_entity_keys.add(key)
changed_entity_keys.add(key) # type: ignore[arg-type] current[key] = data # type: ignore[assignment]
current[key] = data # type: ignore[index]
# If the device changed we don't need to return the changed # If the device changed we don't need to return the changed
# entity keys as all entities will be updated # entity keys as all entities will be updated
return None if device_change else changed_entity_keys return None if device_change else changed_entity_keys

View File

@ -85,6 +85,7 @@ from .db_schema import (
) )
from .executor import DBInterruptibleThreadPoolExecutor from .executor import DBInterruptibleThreadPoolExecutor
from .migration import ( from .migration import (
BaseRunTimeMigration,
EntityIDMigration, EntityIDMigration,
EventsContextIDMigration, EventsContextIDMigration,
EventTypeIDMigration, EventTypeIDMigration,
@ -805,6 +806,7 @@ class Recorder(threading.Thread):
for row in execute_stmt_lambda_element(session, get_migration_changes()) for row in execute_stmt_lambda_element(session, get_migration_changes())
} }
migrator: BaseRunTimeMigration
for migrator_cls in (StatesContextIDMigration, EventsContextIDMigration): for migrator_cls in (StatesContextIDMigration, EventsContextIDMigration):
migrator = migrator_cls(session, schema_version, migration_changes) migrator = migrator_cls(session, schema_version, migration_changes)
if migrator.needs_migrate(): if migrator.needs_migrate():

View File

@ -9,7 +9,7 @@ import datetime
from functools import partial from functools import partial
import logging import logging
import socket import socket
from typing import TYPE_CHECKING, Any, cast from typing import Any, cast
from urllib.parse import urlparse from urllib.parse import urlparse
from aiohttp import ClientError from aiohttp import ClientError
@ -372,12 +372,11 @@ class SonosDiscoveryManager:
(SonosAlarms, self.data.alarms), (SonosAlarms, self.data.alarms),
(SonosFavorites, self.data.favorites), (SonosFavorites, self.data.favorites),
): ):
if TYPE_CHECKING: c_dict: dict[str, Any] = coord_dict
coord_dict = cast(dict[str, Any], coord_dict) if soco.household_id not in c_dict:
if soco.household_id not in coord_dict:
new_coordinator = coordinator(self.hass, soco.household_id) new_coordinator = coordinator(self.hass, soco.household_id)
new_coordinator.setup(soco) new_coordinator.setup(soco)
coord_dict[soco.household_id] = new_coordinator c_dict[soco.household_id] = new_coordinator
speaker.setup(self.entry) speaker.setup(self.entry)
except (OSError, SoCoException, Timeout) as ex: except (OSError, SoCoException, Timeout) as ex:
_LOGGER.warning("Failed to add SonosSpeaker using %s: %s", soco, ex) _LOGGER.warning("Failed to add SonosSpeaker using %s: %s", soco, ex)

View File

@ -35,7 +35,7 @@ async def async_setup_entry(
"""Set up the Tessie sensor platform from a config entry.""" """Set up the Tessie sensor platform from a config entry."""
data = entry.runtime_data data = entry.runtime_data
entities = [ entities: list[TessieEntity] = [
klass(vehicle) klass(vehicle)
for klass in (TessieLockEntity, TessieCableLockEntity) for klass in (TessieLockEntity, TessieCableLockEntity)
for vehicle in data.vehicles for vehicle in data.vehicles

View File

@ -11,7 +11,7 @@ astroid==3.2.2
coverage==7.5.3 coverage==7.5.3
freezegun==1.5.0 freezegun==1.5.0
mock-open==1.4.0 mock-open==1.4.0
mypy-dev==1.11.0a8 mypy-dev==1.11.0a9
pre-commit==3.7.1 pre-commit==3.7.1
pydantic==1.10.17 pydantic==1.10.17
pylint==3.2.2 pylint==3.2.2