From e8a5306c23fc6d704e441dd448a30bf8f64ade69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 7 Jul 2019 04:58:33 +0300 Subject: [PATCH] Upgrade mypy to 0.711, drop no longer needed workarounds (#24998) https://mypy-lang.blogspot.com/2019/06/mypy-0711-released.html --- homeassistant/config_entries.py | 3 +-- homeassistant/core.py | 10 ++++------ homeassistant/util/logging.py | 5 ++--- requirements_test.txt | 2 +- requirements_test_all.txt | 2 +- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index f39f30e0f11..bfd8c0f2df7 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -257,8 +257,7 @@ class ConfigEntry: self.title, self.domain) return False # Handler may be a partial - # type ignore: https://github.com/python/typeshed/pull/3077 - while isinstance(handler, functools.partial): # type: ignore + while isinstance(handler, functools.partial): handler = handler.func if self.version == handler.VERSION: diff --git a/homeassistant/core.py b/homeassistant/core.py index 00400c2088a..ef15a4b11a0 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -270,9 +270,8 @@ class HomeAssistant: # Check for partials to properly determine if coroutine function check_target = target - # type ignores: https://github.com/python/typeshed/pull/3077 - while isinstance(check_target, functools.partial): # type: ignore - check_target = check_target.func # type: ignore + while isinstance(check_target, functools.partial): + check_target = check_target.func if asyncio.iscoroutine(check_target): task = self.loop.create_task(target) # type: ignore @@ -947,9 +946,8 @@ class Service: self.func = func self.schema = schema # Properly detect wrapped functions - # type ignores: https://github.com/python/typeshed/pull/3077 - while isinstance(func, functools.partial): # type: ignore - func = func.func # type: ignore + while isinstance(func, functools.partial): + func = func.func self.is_callback = is_callback(func) self.is_coroutinefunction = asyncio.iscoroutinefunction(func) diff --git a/homeassistant/util/logging.py b/homeassistant/util/logging.py index 19a6e6f8caa..a821c9b6fb8 100644 --- a/homeassistant/util/logging.py +++ b/homeassistant/util/logging.py @@ -141,9 +141,8 @@ def catch_log_exception( # Check for partials to properly determine if coroutine function check_func = func - # type ignores: https://github.com/python/typeshed/pull/3077 - while isinstance(check_func, partial): # type: ignore - check_func = check_func.func # type: ignore + while isinstance(check_func, partial): + check_func = check_func.func wrapper_func = None if asyncio.iscoroutinefunction(check_func): diff --git a/requirements_test.txt b/requirements_test.txt index 8e74eefc5ef..69d9007de72 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -7,7 +7,7 @@ coveralls==1.2.0 flake8-docstrings==1.3.0 flake8==3.7.7 mock-open==1.3.1 -mypy==0.710 +mypy==0.711 pydocstyle==3.0.0 pylint==2.3.1 pytest-aiohttp==0.3.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 61c7ad69012..5c44bdf7c17 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -8,7 +8,7 @@ coveralls==1.2.0 flake8-docstrings==1.3.0 flake8==3.7.7 mock-open==1.3.1 -mypy==0.710 +mypy==0.711 pydocstyle==3.0.0 pylint==2.3.1 pytest-aiohttp==0.3.0