mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Add missing type annotations to Notion (#52599)
This commit is contained in:
parent
50d56fd755
commit
f44a13970a
@ -208,7 +208,7 @@ class NotionEntity(CoordinatorEntity):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self):
|
def _handle_coordinator_update(self) -> None:
|
||||||
"""Respond to a DataUpdateCoordinator update."""
|
"""Respond to a DataUpdateCoordinator update."""
|
||||||
if self._task_id in self.coordinator.data["tasks"]:
|
if self._task_id in self.coordinator.data["tasks"]:
|
||||||
self.hass.async_create_task(self._async_update_bridge_id())
|
self.hass.async_create_task(self._async_update_bridge_id())
|
||||||
@ -216,7 +216,7 @@ class NotionEntity(CoordinatorEntity):
|
|||||||
|
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Handle entity which will be added."""
|
"""Handle entity which will be added."""
|
||||||
await super().async_added_to_hass()
|
await super().async_added_to_hass()
|
||||||
self._async_update_from_latest_data()
|
self._async_update_from_latest_data()
|
||||||
|
@ -44,7 +44,7 @@ BINARY_SENSOR_TYPES = {
|
|||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
):
|
) -> None:
|
||||||
"""Set up Notion sensors based on a config entry."""
|
"""Set up Notion sensors based on a config entry."""
|
||||||
coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id]
|
coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id]
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
"""Config flow to configure the Notion integration."""
|
"""Config flow to configure the Notion integration."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from aionotion import async_get_client
|
from aionotion import async_get_client
|
||||||
from aionotion.errors import NotionError
|
from aionotion.errors import NotionError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||||
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
from homeassistant.helpers import aiohttp_client
|
from homeassistant.helpers import aiohttp_client
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -15,19 +18,21 @@ class NotionFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self) -> None:
|
||||||
"""Initialize the config flow."""
|
"""Initialize the config flow."""
|
||||||
self.data_schema = vol.Schema(
|
self.data_schema = vol.Schema(
|
||||||
{vol.Required(CONF_USERNAME): str, vol.Required(CONF_PASSWORD): str}
|
{vol.Required(CONF_USERNAME): str, vol.Required(CONF_PASSWORD): str}
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _show_form(self, errors=None):
|
async def _show_form(self, errors: dict[str, str] | None = None) -> FlowResult:
|
||||||
"""Show the form to the user."""
|
"""Show the form to the user."""
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user", data_schema=self.data_schema, errors=errors or {}
|
step_id="user", data_schema=self.data_schema, errors=errors or {}
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_user(self, user_input=None):
|
async def async_step_user(
|
||||||
|
self, user_input: dict[str, str] | None = None
|
||||||
|
) -> FlowResult:
|
||||||
"""Handle the start of the config flow."""
|
"""Handle the start of the config flow."""
|
||||||
if not user_input:
|
if not user_input:
|
||||||
return await self._show_form()
|
return await self._show_form()
|
||||||
|
@ -14,7 +14,7 @@ SENSOR_TYPES = {SENSOR_TEMPERATURE: ("Temperature", "temperature", TEMP_CELSIUS)
|
|||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
):
|
) -> None:
|
||||||
"""Set up Notion sensors based on a config entry."""
|
"""Set up Notion sensors based on a config entry."""
|
||||||
coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id]
|
coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user