Add check_untyped_defs (#15510)

* Add check_untyped_defs

* Change to regular if-else
This commit is contained in:
Andrey authored and Paulus Schoutsen committed 2018-07-18 00:28:44 +02:00
1 parent 7d7c2104ea
commit 24d2261060
15 files changed
+70 -44

No files matched your search

+2 -1
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)))