Remove deprecated unit system properties (#86643)

* Remove deprecated unit system properties

* Fix tests
This commit is contained in:
epenet
2023-01-27 12:09:26 +01:00
committed by GitHub
parent 3ff3834cae
commit 561fc2d771
4 changed files with 7 additions and 81 deletions

View File

@ -23,7 +23,6 @@ from homeassistant.const import (
UnitOfTemperature,
UnitOfVolume,
)
from homeassistant.helpers.frame import report
from .unit_conversion import (
DistanceConverter,
@ -121,35 +120,6 @@ class UnitSystem:
self.wind_speed_unit = wind_speed
self._conversions = conversions
@property
def name(self) -> str:
"""Return the name of the unit system."""
report(
(
"accesses the `name` property of the unit system. "
"This is deprecated and will stop working in Home Assistant 2023.1. "
"Please adjust to use instance check instead."
),
error_if_core=False,
)
if self is IMPERIAL_SYSTEM:
# kept for compatibility reasons, with associated warning above
return _CONF_UNIT_SYSTEM_IMPERIAL
return self._name
@property
def is_metric(self) -> bool:
"""Determine if this is the metric unit system."""
report(
(
"accesses the `is_metric` property of the unit system. "
"This is deprecated and will stop working in Home Assistant 2023.1. "
"Please adjust to use instance check instead."
),
error_if_core=False,
)
return self is METRIC_SYSTEM
def temperature(self, temperature: float, from_unit: str) -> float:
"""Convert the given temperature to this unit system."""
if not isinstance(temperature, Number):