From ccf44d58cc537573746487328e1db74a1f718acb Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 15 Feb 2023 14:48:27 +0100 Subject: [PATCH] Expose DEVICE_CLASS_STATE_CLASSES sensor constant (#88172) --- homeassistant/components/sensor/__init__.py | 1 + homeassistant/components/statistics/sensor.py | 2 +- pylint/plugins/hass_imports.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/sensor/__init__.py b/homeassistant/components/sensor/__init__.py index c9e8568c638..30395c3a0a5 100644 --- a/homeassistant/components/sensor/__init__.py +++ b/homeassistant/components/sensor/__init__.py @@ -99,6 +99,7 @@ __all__ = [ "ATTR_OPTIONS", "ATTR_STATE_CLASS", "CONF_STATE_CLASS", + "DEVICE_CLASS_STATE_CLASSES", "DOMAIN", "PLATFORM_SCHEMA_BASE", "PLATFORM_SCHEMA", diff --git a/homeassistant/components/statistics/sensor.py b/homeassistant/components/statistics/sensor.py index 8479b1311dd..9a87129e5d1 100644 --- a/homeassistant/components/statistics/sensor.py +++ b/homeassistant/components/statistics/sensor.py @@ -13,7 +13,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN from homeassistant.components.recorder import get_instance, history -from homeassistant.components.sensor import ( # pylint: disable=hass-deprecated-import +from homeassistant.components.sensor import ( DEVICE_CLASS_STATE_CLASSES, PLATFORM_SCHEMA, SensorDeviceClass, diff --git a/pylint/plugins/hass_imports.py b/pylint/plugins/hass_imports.py index 6bde2193b59..8c176644ce2 100644 --- a/pylint/plugins/hass_imports.py +++ b/pylint/plugins/hass_imports.py @@ -215,7 +215,7 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = { "homeassistant.components.sensor": [ ObsoleteImportMatch( reason="replaced by SensorDeviceClass enum", - constant=re.compile(r"^DEVICE_CLASS_(\w*)$"), + constant=re.compile(r"^DEVICE_CLASS_(?!STATE_CLASSES)$"), ), ObsoleteImportMatch( reason="replaced by SensorStateClass enum",