1
0
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:
Andrey
2018-07-18 01:28:44 +03:00
committed by Paulus Schoutsen
parent 7d7c2104ea
commit 24d2261060
15 changed files with 70 additions and 44 deletions

View File

@@ -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)))