Add disallow_untyped_calls to mypy check. (#15661)

* Add disallow_untyped_calls to mypy check.

* Fix generator
This commit is contained in:
Andrey authored and Paulus Schoutsen committed 2018-07-31 15:00:17 +01:00
1 parent 951372491c
commit 8ee3b535ef
7 files changed
+29 -18

No files matched your search

+2 -1
View File
@@ -10,6 +10,7 @@ Component design guidelines:
import asyncio
import itertools as it
import logging
from typing import Awaitable
import homeassistant.core as ha
import homeassistant.config as conf_util
@@ -109,7 +110,7 @@ def async_reload_core_config(hass):
@asyncio.coroutine
def async_setup(hass, config):
def async_setup(hass: ha.HomeAssistant, config: dict) -> Awaitable[bool]:
"""Set up general services related to Home Assistant."""
@asyncio.coroutine
def async_handle_turn_service(service):
@@ -6,10 +6,11 @@ https://home-assistant.io/components/persistent_notification/
"""
import asyncio
import logging
from typing import Awaitable
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.core import callback, HomeAssistant
from homeassistant.exceptions import TemplateError
from homeassistant.loader import bind_hass
from homeassistant.helpers import config_validation as cv
@@ -58,7 +59,8 @@ def dismiss(hass, notification_id):
@callback
@bind_hass
def async_create(hass, message, title=None, notification_id=None):
def async_create(hass: HomeAssistant, message: str, title: str = None,
notification_id: str = None) -> None:
"""Generate a notification."""
data = {
key: value for key, value in [
@@ -68,7 +70,8 @@ def async_create(hass, message, title=None, notification_id=None):
] if value is not None
}
hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_CREATE, data))
hass.async_create_task(
hass.services.async_call(DOMAIN, SERVICE_CREATE, data))
@callback
@@ -81,7 +84,7 @@ def async_dismiss(hass, notification_id):
@asyncio.coroutine
def async_setup(hass, config):
def async_setup(hass: HomeAssistant, config: dict) -> Awaitable[bool]:
"""Set up the persistent notification component."""
@callback
def create_service(call):