Some typing related fixes (#15899)
* Fix FlowManager.async_init handler type It's not a Callable, but typically a key pointing to one in a dict. * Mark pip_kwargs return type hint as Any-valued dict install_package takes other than str args too.
This commit is contained in:
parent
ef61c0c3a4
commit
dc01b17260
2 changed files with 4 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
|||
import logging
|
||||
import uuid
|
||||
import voluptuous as vol
|
||||
from typing import Dict, Any, Callable, List, Optional # noqa pylint: disable=unused-import
|
||||
from typing import Dict, Any, Callable, Hashable, List, Optional # noqa pylint: disable=unused-import
|
||||
from .core import callback, HomeAssistant
|
||||
from .exceptions import HomeAssistantError
|
||||
|
||||
|
@ -49,7 +49,7 @@ class FlowManager:
|
|||
'source': flow.source,
|
||||
} for flow in self._progress.values()]
|
||||
|
||||
async def async_init(self, handler: Callable, *, context: Dict = None,
|
||||
async def async_init(self, handler: Hashable, *, context: Dict = None,
|
||||
data: Any = None) -> Any:
|
||||
"""Start a configuration flow."""
|
||||
flow = await self._async_create_flow(
|
||||
|
|
|
@ -3,7 +3,7 @@ import asyncio
|
|||
from functools import partial
|
||||
import logging
|
||||
import os
|
||||
from typing import List, Dict, Optional
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
import homeassistant.util.package as pkg_util
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -37,7 +37,7 @@ async def async_process_requirements(hass: HomeAssistant, name: str,
|
|||
return True
|
||||
|
||||
|
||||
def pip_kwargs(config_dir: Optional[str]) -> Dict[str, str]:
|
||||
def pip_kwargs(config_dir: Optional[str]) -> Dict[str, Any]:
|
||||
"""Return keyword arguments for PIP install."""
|
||||
kwargs = {
|
||||
'constraints': os.path.join(os.path.dirname(__file__), CONSTRAINT_FILE)
|
||||
|
|
Loading…
Add table
Reference in a new issue