1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Remove verisure from mypy ignore list (#64475)

This commit is contained in:
epenet 2022-01-19 22:56:31 +01:00 committed by GitHub
parent 944f2c9745
commit 29ec65f924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 15 deletions

View File

@ -46,7 +46,7 @@ async def async_setup_entry(
class VerisureSmartcam(CoordinatorEntity, Camera):
"""Representation of a Verisure camera."""
coordinator = VerisureDataUpdateCoordinator
coordinator: VerisureDataUpdateCoordinator
def __init__(
self,
@ -63,7 +63,7 @@ class VerisureSmartcam(CoordinatorEntity, Camera):
self.serial_number = serial_number
self._directory_path = directory_path
self._image = None
self._image: str | None = None
self._image_id = None
@property
@ -87,7 +87,7 @@ class VerisureSmartcam(CoordinatorEntity, Camera):
self.check_imagelist()
if not self._image:
LOGGER.debug("No image to display")
return
return None
LOGGER.debug("Trying to open %s", self._image)
with open(self._image, "rb") as file:
return file.read()

View File

@ -1,7 +1,7 @@
"""Config flow for Verisure integration."""
from __future__ import annotations
from typing import Any
from typing import Any, cast
from verisure import (
Error as VerisureError,
@ -110,7 +110,10 @@ class VerisureConfigFlowHandler(ConfigFlow, domain=DOMAIN):
async def async_step_reauth(self, data: dict[str, Any]) -> FlowResult:
"""Handle initiation of re-authentication with Verisure."""
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
self.entry = cast(
ConfigEntry,
self.hass.config_entries.async_get_entry(self.context["entry_id"]),
)
return await self.async_step_reauth_confirm()
async def async_step_reauth_confirm(

View File

@ -25,7 +25,7 @@ class VerisureDataUpdateCoordinator(DataUpdateCoordinator):
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Initialize the Verisure hub."""
self.imageseries = {}
self.imageseries: dict[str, list] = {}
self.entry = entry
self.verisure = Verisure(
@ -52,14 +52,12 @@ class VerisureDataUpdateCoordinator(DataUpdateCoordinator):
return True
async def async_logout(self, _event: Event) -> bool:
async def async_logout(self, _event: Event) -> None:
"""Logout from Verisure."""
try:
await self.hass.async_add_executor_job(self.verisure.logout)
except VerisureError as ex:
LOGGER.error("Could not log out from verisure, %s", ex)
return False
return True
async def _async_update_data(self) -> dict:
"""Fetch data from Verisure."""

View File

@ -70,7 +70,7 @@ class VerisureDoorlock(CoordinatorEntity, LockEntity):
self._attr_unique_id = serial_number
self.serial_number = serial_number
self._state = None
self._state: str | None = None
self._digits = coordinator.entry.options.get(
CONF_LOCK_CODE_DIGITS, DEFAULT_LOCK_CODE_DIGITS
)

View File

@ -42,7 +42,7 @@ class VerisureSmartplug(CoordinatorEntity, SwitchEntity):
self._attr_unique_id = serial_number
self.serial_number = serial_number
self._change_timestamp = 0
self._change_timestamp: float = 0
self._state = False
@property

View File

@ -2239,9 +2239,6 @@ ignore_errors = true
[mypy-homeassistant.components.vera.*]
ignore_errors = true
[mypy-homeassistant.components.verisure.*]
ignore_errors = true
[mypy-homeassistant.components.vizio.*]
ignore_errors = true

View File

@ -88,7 +88,6 @@ IGNORED_MODULES: Final[list[str]] = [
"homeassistant.components.unifi.*",
"homeassistant.components.upnp.*",
"homeassistant.components.vera.*",
"homeassistant.components.verisure.*",
"homeassistant.components.vizio.*",
"homeassistant.components.withings.*",
"homeassistant.components.xbox.*",