Skip to content

Commit

Permalink
Some typing related fixes (home-assistant#15899)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
scop authored and vrih committed Sep 29, 2018
1 parent 513a03f commit a643d37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions homeassistant/data_entry_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -49,7 +49,7 @@ def async_progress(self) -> List[Dict]:
'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(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a643d37

Please sign in to comment.