1
0
mirror of https://github.com/home-assistant/core synced 2024-06-29 06:15:03 +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
changed_entity_keys: set[PassiveBluetoothEntityKey] = set()
for key, device_info in new_data.devices.items():
if device_change or self.devices.get(key, UNDEFINED) != device_info:
for device_key, device_info in new_data.devices.items():
if device_change or self.devices.get(device_key, UNDEFINED) != device_info:
device_change = True
self.devices[key] = device_info
self.devices[device_key] = device_info
for incoming, current in (
(new_data.entity_descriptions, self.entity_descriptions),
(new_data.entity_names, self.entity_names),
(new_data.entity_data, self.entity_data),
):
# mypy can't seem to work this out
for key, data in incoming.items(): # type: ignore[attr-defined]
if current.get(key, UNDEFINED) != data: # type: ignore[attr-defined]
changed_entity_keys.add(key) # type: ignore[arg-type]
current[key] = data # type: ignore[index]
for key, data in incoming.items():
if current.get(key, UNDEFINED) != data:
changed_entity_keys.add(key)
current[key] = data # type: ignore[assignment]
# If the device changed we don't need to return the changed
# entity keys as all entities will be updated
return None if device_change else changed_entity_keys

View File

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

View File

@ -9,7 +9,7 @@ import datetime
from functools import partial
import logging
import socket
from typing import TYPE_CHECKING, Any, cast
from typing import Any, cast
from urllib.parse import urlparse
from aiohttp import ClientError
@ -372,12 +372,11 @@ class SonosDiscoveryManager:
(SonosAlarms, self.data.alarms),
(SonosFavorites, self.data.favorites),
):
if TYPE_CHECKING:
coord_dict = cast(dict[str, Any], coord_dict)
if soco.household_id not in coord_dict:
c_dict: dict[str, Any] = coord_dict
if soco.household_id not in c_dict:
new_coordinator = coordinator(self.hass, soco.household_id)
new_coordinator.setup(soco)
coord_dict[soco.household_id] = new_coordinator
c_dict[soco.household_id] = new_coordinator
speaker.setup(self.entry)
except (OSError, SoCoException, Timeout) as 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."""
data = entry.runtime_data
entities = [
entities: list[TessieEntity] = [
klass(vehicle)
for klass in (TessieLockEntity, TessieCableLockEntity)
for vehicle in data.vehicles

View File

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