Prevent use of deprecated units (#83384)
* Prevent use of deprecated units * Adjust obsolete util * More units * Add FREQUENCY * Adjust pylint ignore * Add ELECTRIC (current/potential) * Add TIME * Adjust unitspull/84371/head
parent
55133b3a27
commit
d6fc2d9452
|
@ -3,7 +3,8 @@ from __future__ import annotations
|
|||
|
||||
from collections.abc import Callable
|
||||
|
||||
from homeassistant.const import ( # pylint: disable=unused-import # noqa: F401
|
||||
# pylint: disable-next=unused-import,hass-deprecated-import
|
||||
from homeassistant.const import ( # noqa: F401
|
||||
LENGTH,
|
||||
LENGTH_CENTIMETERS,
|
||||
LENGTH_FEET,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
"""Pressure util functions."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.const import ( # pylint: disable=unused-import # noqa: F401
|
||||
# pylint: disable-next=unused-import,hass-deprecated-import
|
||||
from homeassistant.const import ( # noqa: F401
|
||||
PRESSURE,
|
||||
PRESSURE_BAR,
|
||||
PRESSURE_CBAR,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
"""Distance util functions."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.const import ( # pylint: disable=unused-import # noqa: F401
|
||||
# pylint: disable-next=unused-import,hass-deprecated-import
|
||||
from homeassistant.const import ( # noqa: F401
|
||||
SPEED,
|
||||
SPEED_FEET_PER_SECOND,
|
||||
SPEED_INCHES_PER_DAY,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Temperature util functions."""
|
||||
from homeassistant.const import ( # pylint: disable=unused-import # noqa: F401
|
||||
# pylint: disable-next=unused-import,hass-deprecated-import
|
||||
from homeassistant.const import ( # noqa: F401
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
TEMP_KELVIN,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
"""Volume conversion util functions."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.const import ( # pylint: disable=unused-import # noqa: F401
|
||||
# pylint: disable-next=unused-import,hass-deprecated-import
|
||||
from homeassistant.const import ( # noqa: F401
|
||||
UNIT_NOT_RECOGNIZED_TEMPLATE,
|
||||
VOLUME,
|
||||
VOLUME_CUBIC_FEET,
|
||||
|
|
|
@ -260,16 +260,76 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = {
|
|||
],
|
||||
"homeassistant.const": [
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by SensorDeviceClass enum",
|
||||
constant=re.compile(r"^DEVICE_CLASS_(\w*)$"),
|
||||
reason="replaced by local constants",
|
||||
constant=re.compile(r"^CONF_UNIT_SYSTEM_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^DATA_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by ***DeviceClass enum",
|
||||
constant=re.compile(r"^DEVICE_CLASS_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^ELECTRIC_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^ENERGY_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by EntityCategory enum",
|
||||
constant=re.compile(r"^(ENTITY_CATEGORY_(\w*))|(ENTITY_CATEGORIES)$"),
|
||||
constant=re.compile(r"^(ENTITY_CATEGORY_(\w+))|(ENTITY_CATEGORIES)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by local constants",
|
||||
constant=re.compile(r"^(CONF_UNIT_SYSTEM_(\w*))$"),
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^FREQUENCY_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^IRRADIATION_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^LENGTH_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^MASS_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^POWER_(?!VOLT_AMPERE_REACTIVE)(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^PRECIPITATION_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^PRESSURE_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^SOUND_PRESSURE_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^SPEED_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^TEMP_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^TIME_(\w+)$"),
|
||||
),
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by unit enums",
|
||||
constant=re.compile(r"^VOLUME_(\w+)$"),
|
||||
),
|
||||
],
|
||||
"homeassistant.core": [
|
||||
|
|
Loading…
Reference in New Issue