Remove callback decorator from coroutine functions (#75626)

* Remove callback decorator from coroutine functions

* Remove some more callback decorators
This commit is contained in:
Martin Hjelmare 2022-07-22 19:09:02 +02:00 committed by GitHub
parent 148f963510
commit c05905ebda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 3 additions and 17 deletions

View File

@ -25,7 +25,7 @@ from homeassistant.const import (
CONF_CLIENT_SECRET,
CONF_UNIT_SYSTEM,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.icon import icon_for_battery_level
@ -279,7 +279,6 @@ class FitbitAuthCallbackView(HomeAssistantView):
self.add_entities = add_entities
self.oauth = oauth
@callback
async def get(self, request: Request) -> str:
"""Finish OAuth callback request."""
hass: HomeAssistant = request.app["hass"]

View File

@ -240,7 +240,6 @@ class FritzBoxTools(update_coordinator.DataUpdateCoordinator):
self.device_conn_type, "GetInfo"
).get("NewEnable")
@callback
async def _async_update_data(self) -> None:
"""Update FritzboxTools data."""
try:

View File

@ -173,7 +173,6 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
if self._keep_alive:
async_track_time_interval(self.hass, self._async_operate, self._keep_alive)
@callback
async def _async_startup(event):
"""Init on startup."""
sensor_state = self.hass.states.get(self._sensor_entity_id)
@ -309,7 +308,6 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
# Get default humidity from super class
return super().max_humidity
@callback
async def _async_sensor_changed(self, entity_id, old_state, new_state):
"""Handle ambient humidity changes."""
if new_state is None:
@ -328,7 +326,6 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
await self._async_operate()
await self.async_update_ha_state()
@callback
async def _async_sensor_not_responding(self, now=None):
"""Handle sensor stale event."""

View File

@ -574,7 +574,6 @@ class Group(Entity):
return group
@staticmethod
@callback
async def async_create_group(
hass: HomeAssistant,
name: str,

View File

@ -328,7 +328,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass, DOMAIN, "motionEye", entry.data[CONF_WEBHOOK_ID], handle_webhook
)
@callback
async def async_update_data() -> dict[str, Any] | None:
try:
return await client.async_get_cameras()

View File

@ -343,7 +343,6 @@ class MQTT:
self.init_client()
@callback
async def async_stop_mqtt(_event: Event):
"""Stop MQTT component."""
await self.async_disconnect()

View File

@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_DEVICE, CONF_PLATFORM, CONF_VALUE_TEMPLATE
from homeassistant.core import HomeAssistant, callback
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
@ -128,7 +128,6 @@ class MQTTTagScanner(MqttDiscoveryDeviceUpdate):
async def subscribe_topics(self) -> None:
"""Subscribe to MQTT topics."""
@callback
async def tag_scanned(msg: ReceiveMessage) -> None:
tag_id = self._value_template(msg.payload, "").strip()
if not tag_id: # No output from template, ignore

View File

@ -22,7 +22,6 @@ _LOGGER = logging.getLogger(__name__)
@singleton(DATA_NETWORK)
@callback
async def async_get_network(hass: HomeAssistant) -> Network:
"""Get network singleton."""
network = Network(hass)

View File

@ -187,7 +187,6 @@ class PhilipsTVDataUpdateCoordinator(DataUpdateCoordinator[None]):
super()._unschedule_refresh()
self._async_notify_stop()
@callback
async def _async_update_data(self):
"""Fetch the latest data from the source."""
try:

View File

@ -106,7 +106,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await async_start_bridge(hass, on_device_data_callback)
@callback
async def stop_bridge(event: Event) -> None:
await async_stop_bridge(hass)

View File

@ -196,7 +196,6 @@ def async_condition_from_config(
raise HomeAssistantError(f"Unhandled condition type {condition_type}")
@callback
async def async_get_condition_capabilities(
hass: HomeAssistant, config: ConfigType
) -> dict[str, vol.Schema]:

View File

@ -27,7 +27,7 @@ from homeassistant.const import (
STATE_OFF,
STATE_ON,
)
from homeassistant.core import Event, HomeAssistant, State, callback
from homeassistant.core import Event, HomeAssistant, State
from homeassistant.helpers import device_registry, entity_registry
from homeassistant.helpers.entityfilter import CONF_ENTITY_GLOBS
from homeassistant.setup import async_setup_component
@ -51,7 +51,6 @@ def set_utc(hass):
hass.config.set_time_zone("UTC")
@callback
async def _async_mock_logbook_platform(hass: HomeAssistant) -> None:
class MockLogbookPlatform:
"""Mock a logbook platform."""