mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Remove duplicated code in unit conversion util (#144912)
This commit is contained in:
parent
9428127021
commit
6b35b069b2
@ -151,8 +151,8 @@ class BaseUnitConverter:
|
||||
cls, from_unit: str | None, to_unit: str | None
|
||||
) -> float:
|
||||
"""Get floored base10 log ratio between units of measurement."""
|
||||
from_ratio, to_ratio = cls._get_from_to_ratio(from_unit, to_unit)
|
||||
return floor(max(0, log10(from_ratio / to_ratio)))
|
||||
ratio = cls.get_unit_ratio(from_unit, to_unit)
|
||||
return floor(max(0, log10(ratio)))
|
||||
|
||||
@classmethod
|
||||
@lru_cache
|
||||
|
Loading…
x
Reference in New Issue
Block a user