mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Annotate more async functions correctly (#31802)
This commit is contained in:
parent
71a81c443f
commit
e019280d94
@ -26,6 +26,7 @@ class CoolmasterConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
VERSION = 1
|
VERSION = 1
|
||||||
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
|
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
|
||||||
|
|
||||||
|
@core.callback
|
||||||
def _async_get_entry(self, data):
|
def _async_get_entry(self, data):
|
||||||
supported_modes = [
|
supported_modes = [
|
||||||
key for (key, value) in data.items() if key in AVAILABLE_MODES and value
|
key for (key, value) in data.items() if key in AVAILABLE_MODES and value
|
||||||
|
@ -5,7 +5,7 @@ from typing import Optional
|
|||||||
from aioesphomeapi import APIClient, APIConnectionError
|
from aioesphomeapi import APIClient, APIConnectionError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries, core
|
||||||
from homeassistant.helpers import ConfigType
|
from homeassistant.helpers import ConfigType
|
||||||
|
|
||||||
from .entry_data import DATA_KEY, RuntimeEntryData
|
from .entry_data import DATA_KEY, RuntimeEntryData
|
||||||
@ -115,6 +115,7 @@ class EsphomeFlowHandler(config_entries.ConfigFlow):
|
|||||||
|
|
||||||
return await self.async_step_discovery_confirm()
|
return await self.async_step_discovery_confirm()
|
||||||
|
|
||||||
|
@core.callback
|
||||||
def _async_get_entry(self):
|
def _async_get_entry(self):
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=self._name,
|
title=self._name,
|
||||||
|
@ -352,6 +352,7 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow):
|
|||||||
|
|
||||||
return self._async_step_pair_show_form(errors)
|
return self._async_step_pair_show_form(errors)
|
||||||
|
|
||||||
|
@callback
|
||||||
def _async_step_pair_show_form(self, errors=None):
|
def _async_step_pair_show_form(self, errors=None):
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="pair",
|
step_id="pair",
|
||||||
|
@ -11,6 +11,7 @@ from homeassistant.components.light import (
|
|||||||
Light,
|
Light,
|
||||||
)
|
)
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
|
from homeassistant.core import callback
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
from homeassistant.util.color import rgb_hex_to_rgb_list
|
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._values[value_type] = STATE_OFF
|
||||||
self.async_schedule_update_ha_state()
|
self.async_schedule_update_ha_state()
|
||||||
|
|
||||||
|
@callback
|
||||||
def _async_update_light(self):
|
def _async_update_light(self):
|
||||||
"""Update the controller with values from light child."""
|
"""Update the controller with values from light child."""
|
||||||
value_type = self.gateway.const.SetReq.V_LIGHT
|
value_type = self.gateway.const.SetReq.V_LIGHT
|
||||||
self._state = self._values[value_type] == STATE_ON
|
self._state = self._values[value_type] == STATE_ON
|
||||||
|
|
||||||
|
@callback
|
||||||
def _async_update_dimmer(self):
|
def _async_update_dimmer(self):
|
||||||
"""Update the controller with values from dimmer child."""
|
"""Update the controller with values from dimmer child."""
|
||||||
value_type = self.gateway.const.SetReq.V_DIMMER
|
value_type = self.gateway.const.SetReq.V_DIMMER
|
||||||
@ -163,6 +166,7 @@ class MySensorsLight(mysensors.device.MySensorsEntity, Light):
|
|||||||
if self._brightness == 0:
|
if self._brightness == 0:
|
||||||
self._state = False
|
self._state = False
|
||||||
|
|
||||||
|
@callback
|
||||||
def _async_update_rgb_or_w(self):
|
def _async_update_rgb_or_w(self):
|
||||||
"""Update the controller with values from RGB or RGBW child."""
|
"""Update the controller with values from RGB or RGBW child."""
|
||||||
value = self._values[self.value_type]
|
value = self._values[self.value_type]
|
||||||
|
@ -762,6 +762,7 @@ class SonosEntity(MediaPlayerDevice):
|
|||||||
|
|
||||||
return await self.hass.async_add_executor_job(_get_soco_group)
|
return await self.hass.async_add_executor_job(_get_soco_group)
|
||||||
|
|
||||||
|
@callback
|
||||||
def _async_regroup(group):
|
def _async_regroup(group):
|
||||||
"""Rebuild internal group layout."""
|
"""Rebuild internal group layout."""
|
||||||
sonos_group = []
|
sonos_group = []
|
||||||
|
@ -4,7 +4,7 @@ from typing import Optional
|
|||||||
from starline import StarlineAuth
|
from starline import StarlineAuth
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries, core
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||||
|
|
||||||
from .const import ( # pylint: disable=unused-import
|
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 await self._async_authenticate_user(error)
|
||||||
return self._async_form_auth_captcha(error)
|
return self._async_form_auth_captcha(error)
|
||||||
|
|
||||||
|
@core.callback
|
||||||
def _async_form_auth_app(self, error=None):
|
def _async_form_auth_app(self, error=None):
|
||||||
"""Authenticate application form."""
|
"""Authenticate application form."""
|
||||||
errors = {}
|
errors = {}
|
||||||
@ -106,6 +107,7 @@ class StarlineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors=errors,
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@core.callback
|
||||||
def _async_form_auth_user(self, error=None):
|
def _async_form_auth_user(self, error=None):
|
||||||
"""Authenticate user form."""
|
"""Authenticate user form."""
|
||||||
errors = {}
|
errors = {}
|
||||||
@ -127,6 +129,7 @@ class StarlineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors=errors,
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@core.callback
|
||||||
def _async_form_auth_mfa(self, error=None):
|
def _async_form_auth_mfa(self, error=None):
|
||||||
"""Authenticate mfa form."""
|
"""Authenticate mfa form."""
|
||||||
errors = {}
|
errors = {}
|
||||||
@ -146,6 +149,7 @@ class StarlineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
description_placeholders={"phone_number": self._phone_number},
|
description_placeholders={"phone_number": self._phone_number},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@core.callback
|
||||||
def _async_form_auth_captcha(self, error=None):
|
def _async_form_auth_captcha(self, error=None):
|
||||||
"""Captcha verification form."""
|
"""Captcha verification form."""
|
||||||
errors = {}
|
errors = {}
|
||||||
|
@ -170,7 +170,7 @@ class PerSecondUPnPIGDSensor(UpnpSensor):
|
|||||||
"""Get unit we are measuring in."""
|
"""Get unit we are measuring in."""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def _async_fetch_value(self):
|
async def _async_fetch_value(self):
|
||||||
"""Fetch a value from the IGD."""
|
"""Fetch a value from the IGD."""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
@ -775,6 +775,7 @@ class ConfigEntries:
|
|||||||
|
|
||||||
return await entry.async_unload(self.hass, integration=integration)
|
return await entry.async_unload(self.hass, integration=integration)
|
||||||
|
|
||||||
|
@callback
|
||||||
def _async_schedule_save(self) -> None:
|
def _async_schedule_save(self) -> None:
|
||||||
"""Save the entity registry to a file."""
|
"""Save the entity registry to a file."""
|
||||||
self._store.async_delay_save(self._data_to_save, SAVE_DELAY)
|
self._store.async_delay_save(self._data_to_save, SAVE_DELAY)
|
||||||
|
@ -273,6 +273,7 @@ class EntityComponent:
|
|||||||
|
|
||||||
return processed_conf
|
return processed_conf
|
||||||
|
|
||||||
|
@callback
|
||||||
def _async_init_entity_platform(
|
def _async_init_entity_platform(
|
||||||
self,
|
self,
|
||||||
platform_type: str,
|
platform_type: str,
|
||||||
|
@ -174,6 +174,7 @@ class RestoreStateData:
|
|||||||
def async_setup_dump(self, *args: Any) -> None:
|
def async_setup_dump(self, *args: Any) -> None:
|
||||||
"""Set up the restore state listeners."""
|
"""Set up the restore state listeners."""
|
||||||
|
|
||||||
|
@callback
|
||||||
def _async_dump_states(*_: Any) -> None:
|
def _async_dump_states(*_: Any) -> None:
|
||||||
self.hass.async_create_task(self.async_dump_states())
|
self.hass.async_create_task(self.async_dump_states())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user