Migrate volume units to an enum (#81028)

* Migrate volume units to an enum

* Adjust docstring

* Deprecate -> Deprecated

* Plural
This commit is contained in:
epenet 2022-10-26 17:57:41 +02:00 committed by GitHub
parent 3eea61361c
commit a28b0e1b6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -637,17 +637,38 @@ PRESSURE_PSI: Final = "psi"
SOUND_PRESSURE_DB: Final = "dB"
SOUND_PRESSURE_WEIGHTED_DBA: Final = "dBa"
# Volume units
class UnitOfVolume(StrEnum):
"""Volume units."""
CUBIC_FEET = "ft³"
CUBIC_METERS = ""
LITERS = "L"
MILLILITERS = "mL"
GALLONS = "gal"
"""Assumed to be US gallons in conversion utilities.
British/Imperial gallons are not yet supported"""
FLUID_OUNCES = "fl. oz."
"""Assumed to be US fluid ounces in conversion utilities.
British/Imperial fluid ounces are not yet supported"""
VOLUME_LITERS: Final = "L"
"""Deprecated: please use UnitOfVolume.LITERS"""
VOLUME_MILLILITERS: Final = "mL"
"""Deprecated: please use UnitOfVolume.MILLILITERS"""
VOLUME_CUBIC_METERS: Final = ""
"""Deprecated: please use UnitOfVolume.CUBIC_METERS"""
VOLUME_CUBIC_FEET: Final = "ft³"
"""Deprecated: please use UnitOfVolume.CUBIC_FEET"""
VOLUME_GALLONS: Final = "gal"
"""US gallon (British gallon is not yet supported)"""
"""Deprecated: please use UnitOfVolume.GALLONS"""
VOLUME_FLUID_OUNCE: Final = "fl. oz."
"""US fluid ounce (British fluid ounce is not yet supported)"""
"""Deprecated: please use UnitOfVolume.FLUID_OUNCES"""
# Volume Flow Rate units
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR: Final = "m³/h"