Use two words for Nautical miles unit (#126905)

pull/126900/head^2
Michael 2024-09-27 13:16:13 +02:00 committed by GitHub
parent b78a1f7b61
commit ffa6b5fcb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 12 deletions

View File

@ -896,7 +896,7 @@ class UnitOfLength(StrEnum):
FEET = "ft"
YARDS = "yd"
MILES = "mi"
NAUTICALMILES = "nmi"
NAUTICAL_MILES = "nmi"
_DEPRECATED_LENGTH_MILLIMETERS: Final = DeprecatedConstantEnum(

View File

@ -158,12 +158,12 @@ class DistanceConverter(BaseUnitConverter):
UnitOfLength.FEET: 1 / _FOOT_TO_M,
UnitOfLength.YARDS: 1 / _YARD_TO_M,
UnitOfLength.MILES: 1 / _MILE_TO_M,
UnitOfLength.NAUTICALMILES: 1 / _NAUTICAL_MILE_TO_M,
UnitOfLength.NAUTICAL_MILES: 1 / _NAUTICAL_MILE_TO_M,
}
VALID_UNITS = {
UnitOfLength.KILOMETERS,
UnitOfLength.MILES,
UnitOfLength.NAUTICALMILES,
UnitOfLength.NAUTICAL_MILES,
UnitOfLength.FEET,
UnitOfLength.METERS,
UnitOfLength.CENTIMETERS,

View File

@ -238,7 +238,7 @@ METRIC_SYSTEM = UnitSystem(
("distance", UnitOfLength.FEET): UnitOfLength.METERS,
("distance", UnitOfLength.INCHES): UnitOfLength.MILLIMETERS,
("distance", UnitOfLength.MILES): UnitOfLength.KILOMETERS,
("distance", UnitOfLength.NAUTICALMILES): UnitOfLength.KILOMETERS,
("distance", UnitOfLength.NAUTICAL_MILES): UnitOfLength.KILOMETERS,
("distance", UnitOfLength.YARDS): UnitOfLength.METERS,
# Convert non-metric volumes of gas meters
("gas", UnitOfVolume.CENTUM_CUBIC_FEET): UnitOfVolume.CUBIC_METERS,

View File

@ -173,13 +173,13 @@ _CONVERTED_VALUE: dict[
(5, UnitOfLength.MILES, 8800.0, UnitOfLength.YARDS),
(5, UnitOfLength.MILES, 26400.0008448, UnitOfLength.FEET),
(5, UnitOfLength.MILES, 316800.171072, UnitOfLength.INCHES),
(5, UnitOfLength.NAUTICALMILES, 9.26, UnitOfLength.KILOMETERS),
(5, UnitOfLength.NAUTICALMILES, 9260.0, UnitOfLength.METERS),
(5, UnitOfLength.NAUTICALMILES, 926000.0, UnitOfLength.CENTIMETERS),
(5, UnitOfLength.NAUTICALMILES, 9260000.0, UnitOfLength.MILLIMETERS),
(5, UnitOfLength.NAUTICALMILES, 10126.859142607176, UnitOfLength.YARDS),
(5, UnitOfLength.NAUTICALMILES, 30380.57742782153, UnitOfLength.FEET),
(5, UnitOfLength.NAUTICALMILES, 364566.9291338583, UnitOfLength.INCHES),
(5, UnitOfLength.NAUTICAL_MILES, 9.26, UnitOfLength.KILOMETERS),
(5, UnitOfLength.NAUTICAL_MILES, 9260.0, UnitOfLength.METERS),
(5, UnitOfLength.NAUTICAL_MILES, 926000.0, UnitOfLength.CENTIMETERS),
(5, UnitOfLength.NAUTICAL_MILES, 9260000.0, UnitOfLength.MILLIMETERS),
(5, UnitOfLength.NAUTICAL_MILES, 10126.859142607176, UnitOfLength.YARDS),
(5, UnitOfLength.NAUTICAL_MILES, 30380.57742782153, UnitOfLength.FEET),
(5, UnitOfLength.NAUTICAL_MILES, 364566.9291338583, UnitOfLength.INCHES),
(5, UnitOfLength.YARDS, 0.004572, UnitOfLength.KILOMETERS),
(5, UnitOfLength.YARDS, 4.572, UnitOfLength.METERS),
(5, UnitOfLength.YARDS, 457.2, UnitOfLength.CENTIMETERS),

View File

@ -725,7 +725,7 @@ UNCONVERTED_UNITS_US_SYSTEM = {
SensorDeviceClass.DISTANCE: (
UnitOfLength.FEET,
UnitOfLength.INCHES,
UnitOfLength.NAUTICALMILES,
UnitOfLength.NAUTICAL_MILES,
UnitOfLength.MILES,
UnitOfLength.YARDS,
),