Migrate mass units to an enum (#81021)

This commit is contained in:
epenet 2022-10-26 16:21:29 +02:00 committed by GitHub
parent dde763418a
commit e18adb379d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -644,14 +644,31 @@ VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE: Final = "ft³/m"
# Area units
AREA_SQUARE_METERS: Final = ""
# Mass units
MASS_GRAMS: Final = "g"
MASS_KILOGRAMS: Final = "kg"
MASS_MILLIGRAMS: Final = "mg"
MASS_MICROGRAMS: Final = "µg"
# Mass units
class UnitOfMass(StrEnum):
"""Mass units."""
GRAMS = "g"
KILOGRAMS = "kg"
MILLIGRAMS = "mg"
MICROGRAMS = "µg"
OUNCES = "oz"
POUNDS = "lb"
MASS_GRAMS: Final = "g"
"""Deprecated: please use UnitOfMass.GRAMS"""
MASS_KILOGRAMS: Final = "kg"
"""Deprecated: please use UnitOfMass.KILOGRAMS"""
MASS_MILLIGRAMS: Final = "mg"
"""Deprecated: please use UnitOfMass.MILLIGRAMS"""
MASS_MICROGRAMS: Final = "µg"
"""Deprecated: please use UnitOfMass.MICROGRAMS"""
MASS_OUNCES: Final = "oz"
"""Deprecated: please use UnitOfMass.OUNCES"""
MASS_POUNDS: Final = "lb"
"""Deprecated: please use UnitOfMass.POUNDS"""
# Conductivity units
CONDUCTIVITY: Final = "µS/cm"