mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 10:47:10 +00:00
Replace lambda with attrgetter in device_tracker device_trigger (#99663)
This commit is contained in:
parent
035fea3ee0
commit
a04c61e77b
@ -1,6 +1,7 @@
|
|||||||
"""Provides device automations for Device Tracker."""
|
"""Provides device automations for Device Tracker."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from operator import attrgetter
|
||||||
from typing import Final
|
from typing import Final
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -98,7 +99,7 @@ async def async_get_trigger_capabilities(
|
|||||||
"""List trigger capabilities."""
|
"""List trigger capabilities."""
|
||||||
zones = {
|
zones = {
|
||||||
ent.entity_id: ent.name
|
ent.entity_id: ent.name
|
||||||
for ent in sorted(hass.states.async_all(DOMAIN_ZONE), key=lambda ent: ent.name)
|
for ent in sorted(hass.states.async_all(DOMAIN_ZONE), key=attrgetter("name"))
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
"extra_fields": vol.Schema(
|
"extra_fields": vol.Schema(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user