mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Add check_untyped_defs (#15510)
* Add check_untyped_defs * Change to regular if-else
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Unit system helper class and methods."""
|
||||
|
||||
import logging
|
||||
from typing import Optional
|
||||
from numbers import Number
|
||||
|
||||
from homeassistant.const import (
|
||||
@@ -99,7 +100,7 @@ class UnitSystem(object):
|
||||
return temperature_util.convert(temperature,
|
||||
from_unit, self.temperature_unit)
|
||||
|
||||
def length(self, length: float, from_unit: str) -> float:
|
||||
def length(self, length: Optional[float], from_unit: str) -> float:
|
||||
"""Convert the given length to this unit system."""
|
||||
if not isinstance(length, Number):
|
||||
raise TypeError('{} is not a numeric value.'.format(str(length)))
|
||||
|
||||
Reference in New Issue
Block a user