Migrate temperature units to an enum (#81006)

* Migrate temperature units to an enum

* Adjust spacing
This commit is contained in:
epenet 2022-10-26 14:00:15 +02:00 committed by GitHub
parent 9ee4d77935
commit e0d94d799a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -520,10 +520,22 @@ CURRENCY_EURO: Final = "€"
CURRENCY_DOLLAR: Final = "$"
CURRENCY_CENT: Final = "¢"
# Temperature units
class UnitOfTemperature(StrEnum):
"""Temperature units."""
CELSIUS = "°C"
FAHRENHEIT = "°F"
KELVIN = "K"
TEMP_CELSIUS: Final = "°C"
"""Deprecated: please use UnitOfTemperature.CELSIUS"""
TEMP_FAHRENHEIT: Final = "°F"
"""Deprecated: please use UnitOfTemperature.FAHRENHEIT"""
TEMP_KELVIN: Final = "K"
"""Deprecated: please use UnitOfTemperature.KELVIN"""
# Time units
TIME_MICROSECONDS: Final = "μs"