From fc5b1c7005710f8b53f62627c9ecdc6b45819e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 21 Jul 2019 00:35:59 +0300 Subject: [PATCH] Mypy config improvements (#25340) * Specify python version So that it type checks against the lowest common denominator version, not the runtime one. * Disallow incomplete definitions --- homeassistant/config_entries.py | 10 +++++++--- mypy.ini | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 71c179035de..f6a541063c5 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -128,7 +128,8 @@ class ConfigEntry: async def async_setup( self, hass: HomeAssistant, *, - integration: Optional[loader.Integration] = None, tries=0) -> None: + integration: Optional[loader.Integration] = None, tries: int = 0) \ + -> None: """Set up an entry.""" if integration is None: integration = await loader.async_get_integration(hass, self.domain) @@ -190,7 +191,9 @@ class ConfigEntry: else: self.state = ENTRY_STATE_SETUP_ERROR - async def async_unload(self, hass, *, integration=None) -> bool: + async def async_unload( + self, hass: HomeAssistant, *, + integration: Optional[loader.Integration] = None) -> bool: """Unload an entry. Returns if unload is possible and was successful. @@ -220,7 +223,8 @@ class ConfigEntry: return False try: - result = await component.async_unload_entry(hass, self) + result = await component.async_unload_entry( # type: ignore + hass, self) assert isinstance(result, bool) diff --git a/mypy.ini b/mypy.ini index da3972ac39b..0732110fd92 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,5 +1,7 @@ [mypy] +python_version = 3.5 check_untyped_defs = true +disallow_incomplete_defs = true disallow_untyped_calls = true follow_imports = silent ignore_missing_imports = true