mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 10:59:40 +00:00
More typing (#15449)
## Description: More typing improvements. Switch to using `mypy.ini` for flexibility Add `warn_return_any` check except in `homeassistant.util.yaml` that does typing hacks. Fix some type annotations as resulting from this check and ignore others were fixing is hard. ## Checklist: - [x] The code change is tested and works locally. - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
This commit is contained in:
@@ -26,7 +26,7 @@ SLOW_SETUP_WARNING = 10
|
||||
def setup_component(hass: core.HomeAssistant, domain: str,
|
||||
config: Optional[Dict] = None) -> bool:
|
||||
"""Set up a component and all its dependencies."""
|
||||
return run_coroutine_threadsafe(
|
||||
return run_coroutine_threadsafe( # type: ignore
|
||||
async_setup_component(hass, domain, config), loop=hass.loop).result()
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ async def async_setup_component(hass: core.HomeAssistant, domain: str,
|
||||
setup_tasks = hass.data.get(DATA_SETUP)
|
||||
|
||||
if setup_tasks is not None and domain in setup_tasks:
|
||||
return await setup_tasks[domain]
|
||||
return await setup_tasks[domain] # type: ignore
|
||||
|
||||
if config is None:
|
||||
config = {}
|
||||
@@ -53,7 +53,7 @@ async def async_setup_component(hass: core.HomeAssistant, domain: str,
|
||||
task = setup_tasks[domain] = hass.async_create_task(
|
||||
_async_setup_component(hass, domain, config))
|
||||
|
||||
return await task
|
||||
return await task # type: ignore
|
||||
|
||||
|
||||
async def _async_process_dependencies(hass, config, name, dependencies):
|
||||
|
||||
Reference in New Issue
Block a user