Fix pylint failures caused by fritz (#49655)
* Fix test failures caused by fritz * Fix typing.Any Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>pull/49657/head
parent
3077363f44
commit
7ecd4f5eed
|
@ -1,8 +1,10 @@
|
|||
"""Support for AVM FRITZ!Box classes."""
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any
|
||||
|
||||
# pylint: disable=import-error
|
||||
from fritzconnection import FritzConnection
|
||||
|
@ -48,7 +50,7 @@ class FritzBoxTools:
|
|||
"""Initialize FritzboxTools class."""
|
||||
self._cancel_scan = None
|
||||
self._device_info = None
|
||||
self._devices: Dict[str, Any] = {}
|
||||
self._devices: dict[str, Any] = {}
|
||||
self._unique_id = None
|
||||
self.connection = None
|
||||
self.fritzhosts = None
|
||||
|
@ -65,7 +67,6 @@ class FritzBoxTools:
|
|||
|
||||
def setup(self):
|
||||
"""Set up FritzboxTools class."""
|
||||
|
||||
self.connection = FritzConnection(
|
||||
address=self.host,
|
||||
port=self.port,
|
||||
|
@ -116,7 +117,7 @@ class FritzBoxTools:
|
|||
return self._device_info
|
||||
|
||||
@property
|
||||
def devices(self) -> Dict[str, Any]:
|
||||
def devices(self) -> dict[str, Any]:
|
||||
"""Return devices."""
|
||||
return self._devices
|
||||
|
||||
|
@ -134,9 +135,8 @@ class FritzBoxTools:
|
|||
"""Retrieve latest information from the FRITZ!Box."""
|
||||
return self.fritzhosts.get_hosts_info()
|
||||
|
||||
def scan_devices(self, now: Optional[datetime] = None) -> None:
|
||||
def scan_devices(self, now: datetime | None) -> None:
|
||||
"""Scan for new devices and return a list of found device ids."""
|
||||
|
||||
_LOGGER.debug("Checking devices for FRITZ!Box router %s", self.host)
|
||||
|
||||
new_device = False
|
||||
|
|
|
@ -118,7 +118,6 @@ class FritzBoxToolsFlowHandler(ConfigFlow):
|
|||
|
||||
async def async_step_confirm(self, user_input=None):
|
||||
"""Handle user-confirmation of discovered node."""
|
||||
|
||||
if user_input is None:
|
||||
return self._show_setup_form_confirm()
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"""Support for FRITZ!Box routers."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Dict
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -42,7 +44,6 @@ PLATFORM_SCHEMA = vol.All(
|
|||
|
||||
async def async_get_scanner(hass: HomeAssistant, config: ConfigType):
|
||||
"""Import legacy FRITZ!Box configuration."""
|
||||
|
||||
_LOGGER.debug("Import legacy FRITZ!Box configuration from YAML")
|
||||
|
||||
hass.async_create_task(
|
||||
|
@ -143,7 +144,7 @@ class FritzBoxTracker(ScannerEntity):
|
|||
return SOURCE_TYPE_ROUTER
|
||||
|
||||
@property
|
||||
def device_info(self) -> Dict[str, any]:
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"connections": {(CONNECTION_NETWORK_MAC, self._mac)},
|
||||
|
@ -168,7 +169,6 @@ class FritzBoxTracker(ScannerEntity):
|
|||
@callback
|
||||
def async_process_update(self) -> None:
|
||||
"""Update device."""
|
||||
|
||||
device = self._router.devices[self._mac]
|
||||
self._active = device.is_connected
|
||||
|
||||
|
|
Loading…
Reference in New Issue