mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +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."""
|
||||
from __future__ import annotations
|
||||
|
||||
from operator import attrgetter
|
||||
from typing import Final
|
||||
|
||||
import voluptuous as vol
|
||||
@ -98,7 +99,7 @@ async def async_get_trigger_capabilities(
|
||||
"""List trigger capabilities."""
|
||||
zones = {
|
||||
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 {
|
||||
"extra_fields": vol.Schema(
|
||||
|
Loading…
x
Reference in New Issue
Block a user