From a6759d731d4f1a835e0eb8e4c7715a4f0f0e8d81 Mon Sep 17 00:00:00 2001 From: Ruslan Sayfutdinov Date: Wed, 31 Mar 2021 18:34:00 +0100 Subject: [PATCH] Use Mapping[str, Any] instead of dict in Entity (#48421) --- homeassistant/helpers/entity.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index 894ae6c8225..0074c0ba5e8 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -3,6 +3,7 @@ from __future__ import annotations from abc import ABC import asyncio +from collections.abc import Mapping from datetime import datetime, timedelta import functools as ft import logging @@ -151,7 +152,7 @@ class Entity(ABC): return STATE_UNKNOWN @property - def capability_attributes(self) -> dict[str, Any] | None: + def capability_attributes(self) -> Mapping[str, Any] | None: """Return the capability attributes. Attributes that explain the capabilities of an entity. @@ -171,7 +172,7 @@ class Entity(ABC): return None @property - def device_state_attributes(self) -> dict[str, Any] | None: + def device_state_attributes(self) -> Mapping[str, Any] | None: """Return entity specific state attributes. This method is deprecated, platform classes should implement @@ -180,7 +181,7 @@ class Entity(ABC): return None @property - def extra_state_attributes(self) -> dict[str, Any] | None: + def extra_state_attributes(self) -> Mapping[str, Any] | None: """Return entity specific state attributes. Implemented by platform classes. Convention for attribute names @@ -189,7 +190,7 @@ class Entity(ABC): return None @property - def device_info(self) -> dict[str, Any] | None: + def device_info(self) -> Mapping[str, Any] | None: """Return device specific attributes. Implemented by platform classes.