Upgrade mypy (#23586)

* Upgrade mypy to 0.701

* Enable strict equality checks

* Strict equality error fixes

* StateMachine.is_state docstring fix
This commit is contained in:
Ville Skyttä 2019-05-02 21:18:20 +03:00 committed by GitHub
parent b79d71065c
commit f434e24252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 9 deletions

View File

@ -828,8 +828,8 @@ class StateMachine:
"""
return self._states.get(entity_id.lower())
def is_state(self, entity_id: str, state: State) -> bool:
"""Test if entity exists and is specified state.
def is_state(self, entity_id: str, state: str) -> bool:
"""Test if entity exists and is in specified state.
Async friendly.
"""
@ -907,7 +907,7 @@ class StateMachine:
else:
same_state = (old_state.state == new_state and
not force_update)
same_attr = old_state.attributes == attributes
same_attr = old_state.attributes == MappingProxyType(attributes)
last_changed = old_state.last_changed if same_state else None
if same_state and same_attr:

View File

@ -266,12 +266,12 @@ def color_xy_brightness_to_RGB(
vY = xy_closest[1]
brightness = ibrightness / 255.
if brightness == 0:
if brightness == 0.0:
return (0, 0, 0)
Y = brightness
if vY == 0:
if vY == 0.0:
vY += 0.00000000001
X = (Y / vY) * vX
@ -304,7 +304,7 @@ def color_xy_brightness_to_RGB(
def color_hsb_to_RGB(fH: float, fS: float, fB: float) -> Tuple[int, int, int]:
"""Convert a hsb into its rgb representation."""
if fS == 0:
if fS == 0.0:
fV = int(fB * 255)
return fV, fV, fV

View File

@ -117,7 +117,7 @@ def vincenty(point1: Tuple[float, float], point2: Tuple[float, float],
cosLambda = math.cos(Lambda)
sinSigma = math.sqrt((cosU2 * sinLambda) ** 2 +
(cosU1 * sinU2 - sinU1 * cosU2 * cosLambda) ** 2)
if sinSigma == 0:
if sinSigma == 0.0:
return 0.0 # coincident points
cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda
sigma = math.atan2(sinSigma, cosSigma)

View File

@ -4,6 +4,7 @@ disallow_untyped_calls = true
follow_imports = silent
ignore_missing_imports = true
no_implicit_optional = true
strict_equality = true
warn_incomplete_stub = true
warn_redundant_casts = true
warn_return_any = true

View File

@ -7,7 +7,7 @@ coveralls==1.2.0
flake8-docstrings==1.3.0
flake8==3.7.7
mock-open==1.3.1
mypy==0.670
mypy==0.701
pydocstyle==3.0.0
pylint==2.3.1
pytest-aiohttp==0.3.0

View File

@ -8,7 +8,7 @@ coveralls==1.2.0
flake8-docstrings==1.3.0
flake8==3.7.7
mock-open==1.3.1
mypy==0.670
mypy==0.701
pydocstyle==3.0.0
pylint==2.3.1
pytest-aiohttp==0.3.0