Add hints to get_service in integrations (1/2) (#86692)

This commit is contained in:
epenet 2023-01-26 16:56:57 +01:00 committed by GitHub
parent 0d579f6ac3
commit 2bef69c6a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 143 additions and 17 deletions

View file

@ -1,4 +1,6 @@
"""Flock platform for notify component."""
from __future__ import annotations
import asyncio
from http import HTTPStatus
import logging
@ -8,8 +10,10 @@ import voluptuous as vol
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
_LOGGER = logging.getLogger(__name__)
_RESOURCE = "https://api.flock.com/hooks/sendMessage/"
@ -17,7 +21,11 @@ _RESOURCE = "https://api.flock.com/hooks/sendMessage/"
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_ACCESS_TOKEN): cv.string})
async def async_get_service(hass, config, discovery_info=None):
async def async_get_service(
hass: HomeAssistant,
config: ConfigType,
discovery_info: DiscoveryInfoType | None = None,
) -> FlockNotificationService:
"""Get the Flock notification service."""
access_token = config.get(CONF_ACCESS_TOKEN)
url = f"{_RESOURCE}{access_token}"