mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Adjust get_scanner pylint checks (#77944)
This commit is contained in:
parent
9fa30af8de
commit
f71313ee1e
@ -31,7 +31,9 @@ PLATFORM_SCHEMA: Final = BASE_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(
|
||||||
|
hass: HomeAssistant, config: ConfigType
|
||||||
|
) -> ActiontecDeviceScanner | None:
|
||||||
"""Validate the configuration and return an Actiontec scanner."""
|
"""Validate the configuration and return an Actiontec scanner."""
|
||||||
scanner = ActiontecDeviceScanner(config[DOMAIN])
|
scanner = ActiontecDeviceScanner(config[DOMAIN])
|
||||||
return scanner if scanner.success_init else None
|
return scanner if scanner.success_init else None
|
||||||
|
@ -24,7 +24,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> ArrisDeviceScanner:
|
||||||
"""Return the Arris device scanner."""
|
"""Return the Arris device scanner."""
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
url = f"http://{conf[CONF_HOST]}"
|
url = f"http://{conf[CONF_HOST]}"
|
||||||
|
@ -34,7 +34,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> ArubaDeviceScanner | None:
|
||||||
"""Validate the configuration and return a Aruba scanner."""
|
"""Validate the configuration and return a Aruba scanner."""
|
||||||
scanner = ArubaDeviceScanner(config[DOMAIN])
|
scanner = ArubaDeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> BboxDeviceScanner | None:
|
||||||
"""Validate the configuration and return a Bbox scanner."""
|
"""Validate the configuration and return a Bbox scanner."""
|
||||||
scanner = BboxDeviceScanner(config[DOMAIN])
|
scanner = BboxDeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -25,7 +25,9 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(
|
||||||
|
hass: HomeAssistant, config: ConfigType
|
||||||
|
) -> BTHomeHub5DeviceScanner | None:
|
||||||
"""Return a BT Home Hub 5 scanner if successful."""
|
"""Return a BT Home Hub 5 scanner if successful."""
|
||||||
scanner = BTHomeHub5DeviceScanner(config[DOMAIN])
|
scanner = BTHomeHub5DeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> BTSmartHubScanner | None:
|
||||||
"""Return a BT Smart Hub scanner if successful."""
|
"""Return a BT Smart Hub scanner if successful."""
|
||||||
info = config[DOMAIN]
|
info = config[DOMAIN]
|
||||||
smarthub_client = BTSmartHub(
|
smarthub_client = BTSmartHub(
|
||||||
|
@ -31,7 +31,7 @@ PLATFORM_SCHEMA = vol.All(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> CiscoDeviceScanner | None:
|
||||||
"""Validate the configuration and return a Cisco scanner."""
|
"""Validate the configuration and return a Cisco scanner."""
|
||||||
scanner = CiscoDeviceScanner(config[DOMAIN])
|
scanner = CiscoDeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> CiscoMEDeviceScanner | None:
|
||||||
"""Validate the configuration and return a Cisco ME scanner."""
|
"""Validate the configuration and return a Cisco ME scanner."""
|
||||||
|
|
||||||
config = config[DOMAIN]
|
config = config[DOMAIN]
|
||||||
|
@ -32,7 +32,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> CPPMDeviceScanner | None:
|
||||||
"""Initialize Scanner."""
|
"""Initialize Scanner."""
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
|
@ -46,7 +46,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DdWrtDeviceScanner | None:
|
||||||
"""Validate the configuration and return a DD-WRT scanner."""
|
"""Validate the configuration and return a DD-WRT scanner."""
|
||||||
try:
|
try:
|
||||||
return DdWrtDeviceScanner(config[DOMAIN])
|
return DdWrtDeviceScanner(config[DOMAIN])
|
||||||
|
@ -35,7 +35,7 @@ PLATFORM_SCHEMA = BASE_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> FortiOSDeviceScanner | None:
|
||||||
"""Validate the configuration and return a FortiOSDeviceScanner."""
|
"""Validate the configuration and return a FortiOSDeviceScanner."""
|
||||||
host = config[DOMAIN][CONF_HOST]
|
host = config[DOMAIN][CONF_HOST]
|
||||||
verify_ssl = config[DOMAIN][CONF_VERIFY_SSL]
|
verify_ssl = config[DOMAIN][CONF_VERIFY_SSL]
|
||||||
|
@ -32,7 +32,9 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(_hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(
|
||||||
|
_hass: HomeAssistant, config: ConfigType
|
||||||
|
) -> HitronCODADeviceScanner | None:
|
||||||
"""Validate the configuration and return a Hitron CODA-4582U scanner."""
|
"""Validate the configuration and return a Hitron CODA-4582U scanner."""
|
||||||
scanner = HitronCODADeviceScanner(config[DOMAIN])
|
scanner = HitronCODADeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -24,7 +24,9 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend({vol.Required(CONF_HOST): cv.string})
|
PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend({vol.Required(CONF_HOST): cv.string})
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(
|
||||||
|
hass: HomeAssistant, config: ConfigType
|
||||||
|
) -> LinksysSmartWifiDeviceScanner | None:
|
||||||
"""Validate the configuration and return a Linksys AP scanner."""
|
"""Validate the configuration and return a Linksys AP scanner."""
|
||||||
try:
|
try:
|
||||||
return LinksysSmartWifiDeviceScanner(config[DOMAIN])
|
return LinksysSmartWifiDeviceScanner(config[DOMAIN])
|
||||||
|
@ -38,7 +38,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> LuciDeviceScanner | None:
|
||||||
"""Validate the configuration and return a Luci scanner."""
|
"""Validate the configuration and return a Luci scanner."""
|
||||||
scanner = LuciDeviceScanner(config[DOMAIN])
|
scanner = LuciDeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Device tracker support for OPNSense routers."""
|
"""Device tracker support for OPNSense routers."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import DeviceScanner
|
from homeassistant.components.device_tracker import DeviceScanner
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
@ -6,7 +8,9 @@ from homeassistant.helpers.typing import ConfigType
|
|||||||
from . import CONF_TRACKER_INTERFACE, OPNSENSE_DATA
|
from . import CONF_TRACKER_INTERFACE, OPNSENSE_DATA
|
||||||
|
|
||||||
|
|
||||||
async def async_get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner:
|
async def async_get_scanner(
|
||||||
|
hass: HomeAssistant, config: ConfigType
|
||||||
|
) -> OPNSenseDeviceScanner:
|
||||||
"""Configure the OPNSense device_tracker."""
|
"""Configure the OPNSense device_tracker."""
|
||||||
interface_client = hass.data[OPNSENSE_DATA]["interfaces"]
|
interface_client = hass.data[OPNSENSE_DATA]["interfaces"]
|
||||||
scanner = OPNSenseDeviceScanner(
|
scanner = OPNSenseDeviceScanner(
|
||||||
|
@ -30,7 +30,9 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(
|
||||||
|
hass: HomeAssistant, config: ConfigType
|
||||||
|
) -> QuantumGatewayDeviceScanner | None:
|
||||||
"""Validate the configuration and return a Quantum Gateway scanner."""
|
"""Validate the configuration and return a Quantum Gateway scanner."""
|
||||||
scanner = QuantumGatewayDeviceScanner(config[DOMAIN])
|
scanner = QuantumGatewayDeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend({vol.Optional(CONF_HOST): cv.str
|
|||||||
|
|
||||||
async def async_get_scanner(
|
async def async_get_scanner(
|
||||||
hass: HomeAssistant, config: ConfigType
|
hass: HomeAssistant, config: ConfigType
|
||||||
) -> DeviceScanner | None:
|
) -> SkyHubDeviceScanner | None:
|
||||||
"""Return a Sky Hub scanner if successful."""
|
"""Return a Sky Hub scanner if successful."""
|
||||||
host = config[DOMAIN].get(CONF_HOST, "192.168.1.254")
|
host = config[DOMAIN].get(CONF_HOST, "192.168.1.254")
|
||||||
websession = async_get_clientsession(hass)
|
websession = async_get_clientsession(hass)
|
||||||
@ -33,8 +33,7 @@ async def async_get_scanner(
|
|||||||
_LOGGER.debug("Initialising Sky Hub")
|
_LOGGER.debug("Initialising Sky Hub")
|
||||||
await hub.async_connect()
|
await hub.async_connect()
|
||||||
if hub.success_init:
|
if hub.success_init:
|
||||||
scanner = SkyHubDeviceScanner(hub)
|
return SkyHubDeviceScanner(hub)
|
||||||
return scanner
|
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> SnmpScanner | None:
|
||||||
"""Validate the configuration and return an SNMP scanner."""
|
"""Validate the configuration and return an SNMP scanner."""
|
||||||
scanner = SnmpScanner(config[DOMAIN])
|
scanner = SnmpScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -26,7 +26,9 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(
|
||||||
|
hass: HomeAssistant, config: ConfigType
|
||||||
|
) -> SwisscomDeviceScanner | None:
|
||||||
"""Return the Swisscom device scanner."""
|
"""Return the Swisscom device scanner."""
|
||||||
scanner = SwisscomDeviceScanner(config[DOMAIN])
|
scanner = SwisscomDeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -70,7 +70,9 @@ ATTRIBUTE_ALIAS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(
|
||||||
|
hass: HomeAssistant, config: ConfigType
|
||||||
|
) -> SynologySrmDeviceScanner | None:
|
||||||
"""Validate the configuration and return Synology SRM scanner."""
|
"""Validate the configuration and return Synology SRM scanner."""
|
||||||
scanner = SynologySrmDeviceScanner(config[DOMAIN])
|
scanner = SynologySrmDeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ PLATFORM_SCHEMA = BASE_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> TadoDeviceScanner | None:
|
||||||
"""Return a Tado scanner."""
|
"""Return a Tado scanner."""
|
||||||
scanner = TadoDeviceScanner(hass, config[DOMAIN])
|
scanner = TadoDeviceScanner(hass, config[DOMAIN])
|
||||||
return scanner if scanner.success_init else None
|
return scanner if scanner.success_init else None
|
||||||
|
@ -38,7 +38,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> ThomsonDeviceScanner | None:
|
||||||
"""Validate the configuration and return a THOMSON scanner."""
|
"""Validate the configuration and return a THOMSON scanner."""
|
||||||
scanner = ThomsonDeviceScanner(config[DOMAIN])
|
scanner = ThomsonDeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> TomatoDeviceScanner:
|
||||||
"""Validate the configuration and returns a Tomato scanner."""
|
"""Validate the configuration and returns a Tomato scanner."""
|
||||||
return TomatoDeviceScanner(config[DOMAIN])
|
return TomatoDeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> UnifiDeviceScanner | None:
|
||||||
"""Validate the configuration and return a Unifi direct scanner."""
|
"""Validate the configuration and return a Unifi direct scanner."""
|
||||||
scanner = UnifiDeviceScanner(config[DOMAIN])
|
scanner = UnifiDeviceScanner(config[DOMAIN])
|
||||||
if not scanner.connected:
|
if not scanner.connected:
|
||||||
|
@ -32,7 +32,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
|
|
||||||
async def async_get_scanner(
|
async def async_get_scanner(
|
||||||
hass: HomeAssistant, config: ConfigType
|
hass: HomeAssistant, config: ConfigType
|
||||||
) -> DeviceScanner | None:
|
) -> UPCDeviceScanner | None:
|
||||||
"""Return the UPC device scanner."""
|
"""Return the UPC device scanner."""
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
session = async_get_clientsession(hass)
|
session = async_get_clientsession(hass)
|
||||||
|
@ -28,7 +28,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(hass: HomeAssistant, config: ConfigType) -> XiaomiDeviceScanner | None:
|
||||||
"""Validate the configuration and return a Xiaomi Device Scanner."""
|
"""Validate the configuration and return a Xiaomi Device Scanner."""
|
||||||
scanner = XiaomiDeviceScanner(config[DOMAIN])
|
scanner = XiaomiDeviceScanner(config[DOMAIN])
|
||||||
|
|
||||||
|
@ -26,7 +26,9 @@ PLATFORM_SCHEMA = BASE_PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
|
def get_scanner(
|
||||||
|
hass: HomeAssistant, config: ConfigType
|
||||||
|
) -> XiaomiMiioDeviceScanner | None:
|
||||||
"""Return a Xiaomi MiIO device scanner."""
|
"""Return a Xiaomi MiIO device scanner."""
|
||||||
scanner = None
|
scanner = None
|
||||||
host = config[DOMAIN][CONF_HOST]
|
host = config[DOMAIN][CONF_HOST]
|
||||||
|
@ -327,7 +327,8 @@ _FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = {
|
|||||||
0: "HomeAssistant",
|
0: "HomeAssistant",
|
||||||
1: "ConfigType",
|
1: "ConfigType",
|
||||||
},
|
},
|
||||||
return_type=["DeviceScanner", "DeviceScanner | None"],
|
return_type=["DeviceScanner", None],
|
||||||
|
check_return_type_inheritance=True,
|
||||||
has_async_counterpart=True,
|
has_async_counterpart=True,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user