Improve type hints in onvif (#87184)

This commit is contained in:
epenet 2023-02-02 22:25:43 +01:00 committed by GitHub
parent 843e3ca9e6
commit 9327947332
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -26,7 +26,7 @@ from homeassistant.const import (
CONF_PORT,
CONF_USERNAME,
)
from homeassistant.core import callback
from homeassistant.core import HomeAssistant, callback
from .const import CONF_DEVICE_ID, DEFAULT_ARGUMENTS, DEFAULT_PORT, DOMAIN, LOGGER
from .device import get_device
@ -45,7 +45,7 @@ def wsdiscovery() -> list[Service]:
return services
async def async_discovery(hass) -> list[dict[str, Any]]:
async def async_discovery(hass: HomeAssistant) -> list[dict[str, Any]]:
"""Return if there are devices that can be discovered."""
LOGGER.debug("Starting ONVIF discovery")
services = await hass.async_add_executor_job(wsdiscovery)

View File

@ -561,7 +561,13 @@ class ONVIFDevice:
LOGGER.error("Error trying to set Imaging settings: %s", err)
def get_device(hass, host, port, username, password) -> ONVIFCamera:
def get_device(
hass: HomeAssistant,
host: str,
port: int,
username: str | None,
password: str | None,
) -> ONVIFCamera:
"""Get ONVIFCamera instance."""
return ONVIFCamera(
host,