1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Upgrade mypy to 0.720, turn on unreachability warnings (#25157)

* Upgrade mypy to 0.720

* Turn on mypy unreachability warnings, address raised issues
This commit is contained in:
Ville Skyttä
2019-07-17 01:11:38 +03:00
committed by Paulus Schoutsen
parent 20301ae888
commit 56841da2d3
14 changed files with 34 additions and 24 deletions

View File

@@ -91,7 +91,8 @@ class UnitSystem:
raise TypeError(
'{} is not a numeric value.'.format(str(temperature)))
return temperature_util.convert(temperature,
# type ignore: https://github.com/python/mypy/issues/7207
return temperature_util.convert(temperature, # type: ignore
from_unit, self.temperature_unit)
def length(self, length: Optional[float], from_unit: str) -> float:
@@ -99,7 +100,8 @@ class UnitSystem:
if not isinstance(length, Number):
raise TypeError('{} is not a numeric value.'.format(str(length)))
return distance_util.convert(length, from_unit,
# type ignore: https://github.com/python/mypy/issues/7207
return distance_util.convert(length, from_unit, # type: ignore
self.length_unit)
def pressure(self, pressure: Optional[float], from_unit: str) -> float:
@@ -107,7 +109,8 @@ class UnitSystem:
if not isinstance(pressure, Number):
raise TypeError('{} is not a numeric value.'.format(str(pressure)))
return pressure_util.convert(pressure, from_unit,
# type ignore: https://github.com/python/mypy/issues/7207
return pressure_util.convert(pressure, from_unit, # type: ignore
self.pressure_unit)
def volume(self, volume: Optional[float], from_unit: str) -> float:
@@ -115,7 +118,9 @@ class UnitSystem:
if not isinstance(volume, Number):
raise TypeError('{} is not a numeric value.'.format(str(volume)))
return volume_util.convert(volume, from_unit, self.volume_unit)
# type ignore: https://github.com/python/mypy/issues/7207
return volume_util.convert(volume, from_unit, # type: ignore
self.volume_unit)
def as_dict(self) -> dict:
"""Convert the unit system to a dictionary."""