mirror of
https://github.com/home-assistant/core.git
synced 2025-04-29 03:37:51 +00:00
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:
parent
56e4a2aea6
commit
fc5b1c7005
@ -128,7 +128,8 @@ class ConfigEntry:
|
|||||||
|
|
||||||
async def async_setup(
|
async def async_setup(
|
||||||
self, hass: HomeAssistant, *,
|
self, hass: HomeAssistant, *,
|
||||||
integration: Optional[loader.Integration] = None, tries=0) -> None:
|
integration: Optional[loader.Integration] = None, tries: int = 0) \
|
||||||
|
-> None:
|
||||||
"""Set up an entry."""
|
"""Set up an entry."""
|
||||||
if integration is None:
|
if integration is None:
|
||||||
integration = await loader.async_get_integration(hass, self.domain)
|
integration = await loader.async_get_integration(hass, self.domain)
|
||||||
@ -190,7 +191,9 @@ class ConfigEntry:
|
|||||||
else:
|
else:
|
||||||
self.state = ENTRY_STATE_SETUP_ERROR
|
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.
|
"""Unload an entry.
|
||||||
|
|
||||||
Returns if unload is possible and was successful.
|
Returns if unload is possible and was successful.
|
||||||
@ -220,7 +223,8 @@ class ConfigEntry:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = await component.async_unload_entry(hass, self)
|
result = await component.async_unload_entry( # type: ignore
|
||||||
|
hass, self)
|
||||||
|
|
||||||
assert isinstance(result, bool)
|
assert isinstance(result, bool)
|
||||||
|
|
||||||
|
2
mypy.ini
2
mypy.ini
@ -1,5 +1,7 @@
|
|||||||
[mypy]
|
[mypy]
|
||||||
|
python_version = 3.5
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
|
disallow_incomplete_defs = true
|
||||||
disallow_untyped_calls = true
|
disallow_untyped_calls = true
|
||||||
follow_imports = silent
|
follow_imports = silent
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user