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:
Ville Skyttä authored and Paulus Schoutsen committed 2018-08-09 22:53:12 +02:00
1 parent ef61c0c3a4
commit dc01b17260
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -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(
+2 -2
View File
@@ -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)