mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 13:45:12 +02:00
Replace lambda with attrgetter in device_tracker device_trigger (#99663)
This commit is contained in:
@@ -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(
|
||||
|
Reference in New Issue
Block a user