Replace lambda with attrgetter in homekit_controller (#99666)
This commit is contained in:
parent
abb0537928
commit
e9062bb1b3
1 changed files with 2 additions and 3 deletions
|
@ -5,6 +5,7 @@ import asyncio
|
||||||
from collections.abc import Callable, Iterable
|
from collections.abc import Callable, Iterable
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
|
from operator import attrgetter
|
||||||
from types import MappingProxyType
|
from types import MappingProxyType
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -508,9 +509,7 @@ class HKDevice:
|
||||||
|
|
||||||
# Accessories need to be created in the correct order or setting up
|
# Accessories need to be created in the correct order or setting up
|
||||||
# relationships with ATTR_VIA_DEVICE may fail.
|
# relationships with ATTR_VIA_DEVICE may fail.
|
||||||
for accessory in sorted(
|
for accessory in sorted(self.entity_map.accessories, key=attrgetter("aid")):
|
||||||
self.entity_map.accessories, key=lambda accessory: accessory.aid
|
|
||||||
):
|
|
||||||
device_info = self.device_info_for_accessory(accessory)
|
device_info = self.device_info_for_accessory(accessory)
|
||||||
|
|
||||||
device = device_registry.async_get_or_create(
|
device = device_registry.async_get_or_create(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue