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
This commit is contained in:
Ville Skyttä 2019-07-21 00:35:59 +03:00 committed by Paulus Schoutsen
parent 56e4a2aea6
commit fc5b1c7005
2 changed files with 9 additions and 3 deletions

View File

@ -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)

View File

@ -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