Annotate more async functions correctly (#31802)

This commit is contained in:
Paulus Schoutsen 2020-02-14 10:00:22 -08:00 committed by GitHub
parent 71a81c443f
commit e019280d94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 18 additions and 3 deletions

View file

@ -26,6 +26,7 @@ class CoolmasterConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
@core.callback
def _async_get_entry(self, data):
supported_modes = [
key for (key, value) in data.items() if key in AVAILABLE_MODES and value

View file

@ -5,7 +5,7 @@ from typing import Optional
from aioesphomeapi import APIClient, APIConnectionError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant import config_entries, core
from homeassistant.helpers import ConfigType
from .entry_data import DATA_KEY, RuntimeEntryData
@ -115,6 +115,7 @@ class EsphomeFlowHandler(config_entries.ConfigFlow):
return await self.async_step_discovery_confirm()
@core.callback
def _async_get_entry(self):
return self.async_create_entry(
title=self._name,

View file

@ -352,6 +352,7 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow):
return self._async_step_pair_show_form(errors)
@callback
def _async_step_pair_show_form(self, errors=None):
return self.async_show_form(
step_id="pair",

View file

@ -11,6 +11,7 @@ from homeassistant.components.light import (
Light,
)
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import callback
import homeassistant.util.color as color_util
from homeassistant.util.color import rgb_hex_to_rgb_list
@ -150,11 +151,13 @@ class MySensorsLight(mysensors.device.MySensorsEntity, Light):
self._values[value_type] = STATE_OFF
self.async_schedule_update_ha_state()
@callback
def _async_update_light(self):
"""Update the controller with values from light child."""
value_type = self.gateway.const.SetReq.V_LIGHT
self._state = self._values[value_type] == STATE_ON
@callback
def _async_update_dimmer(self):
"""Update the controller with values from dimmer child."""
value_type = self.gateway.const.SetReq.V_DIMMER
@ -163,6 +166,7 @@ class MySensorsLight(mysensors.device.MySensorsEntity, Light):
if self._brightness == 0:
self._state = False
@callback
def _async_update_rgb_or_w(self):
"""Update the controller with values from RGB or RGBW child."""
value = self._values[self.value_type]

View file

@ -762,6 +762,7 @@ class SonosEntity(MediaPlayerDevice):
return await self.hass.async_add_executor_job(_get_soco_group)
@callback
def _async_regroup(group):
"""Rebuild internal group layout."""
sonos_group = []

View file

@ -4,7 +4,7 @@ from typing import Optional
from starline import StarlineAuth
import voluptuous as vol
from homeassistant import config_entries
from homeassistant import config_entries, core
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from .const import ( # pylint: disable=unused-import
@ -85,6 +85,7 @@ class StarlineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
return await self._async_authenticate_user(error)
return self._async_form_auth_captcha(error)
@core.callback
def _async_form_auth_app(self, error=None):
"""Authenticate application form."""
errors = {}
@ -106,6 +107,7 @@ class StarlineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
errors=errors,
)
@core.callback
def _async_form_auth_user(self, error=None):
"""Authenticate user form."""
errors = {}
@ -127,6 +129,7 @@ class StarlineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
errors=errors,
)
@core.callback
def _async_form_auth_mfa(self, error=None):
"""Authenticate mfa form."""
errors = {}
@ -146,6 +149,7 @@ class StarlineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
description_placeholders={"phone_number": self._phone_number},
)
@core.callback
def _async_form_auth_captcha(self, error=None):
"""Captcha verification form."""
errors = {}

View file

@ -170,7 +170,7 @@ class PerSecondUPnPIGDSensor(UpnpSensor):
"""Get unit we are measuring in."""
raise NotImplementedError()
def _async_fetch_value(self):
async def _async_fetch_value(self):
"""Fetch a value from the IGD."""
raise NotImplementedError()

View file

@ -775,6 +775,7 @@ class ConfigEntries:
return await entry.async_unload(self.hass, integration=integration)
@callback
def _async_schedule_save(self) -> None:
"""Save the entity registry to a file."""
self._store.async_delay_save(self._data_to_save, SAVE_DELAY)

View file

@ -273,6 +273,7 @@ class EntityComponent:
return processed_conf
@callback
def _async_init_entity_platform(
self,
platform_type: str,

View file

@ -174,6 +174,7 @@ class RestoreStateData:
def async_setup_dump(self, *args: Any) -> None:
"""Set up the restore state listeners."""
@callback
def _async_dump_states(*_: Any) -> None:
self.hass.async_create_task(self.async_dump_states())