diff --git a/.core_files.yaml b/.core_files.yaml index b07dc04cd15..318a4387510 100644 --- a/.core_files.yaml +++ b/.core_files.yaml @@ -102,7 +102,7 @@ components: &components # Testing related files that affect the whole test/linting suite tests: &tests - codecov.yaml - - pylint/* + - pylint/** - requirements_test_pre_commit.txt - requirements_test.txt - tests/auth/** diff --git a/homeassistant/components/fjaraskupan/config_flow.py b/homeassistant/components/fjaraskupan/config_flow.py index 4d4d1882dcd..da0a7f1dd2b 100644 --- a/homeassistant/components/fjaraskupan/config_flow.py +++ b/homeassistant/components/fjaraskupan/config_flow.py @@ -9,6 +9,7 @@ from bleak.backends.device import BLEDevice from bleak.backends.scanner import AdvertisementData from fjaraskupan import UUID_SERVICE, device_filter +from homeassistant.core import HomeAssistant from homeassistant.helpers.config_entry_flow import register_discovery_flow from .const import DOMAIN @@ -16,7 +17,7 @@ from .const import DOMAIN CONST_WAIT_TIME = 5.0 -async def _async_has_devices(hass) -> bool: +async def _async_has_devices(hass: HomeAssistant) -> bool: """Return if there are devices that can be discovered.""" event = asyncio.Event() diff --git a/homeassistant/components/gree/config_flow.py b/homeassistant/components/gree/config_flow.py index bf6fc7cc334..d317fe6d873 100644 --- a/homeassistant/components/gree/config_flow.py +++ b/homeassistant/components/gree/config_flow.py @@ -1,12 +1,13 @@ """Config flow for Gree.""" from greeclimate.discovery import Discovery +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_entry_flow from .const import DISCOVERY_TIMEOUT, DOMAIN -async def _async_has_devices(hass) -> bool: +async def _async_has_devices(hass: HomeAssistant) -> bool: """Return if there are devices that can be discovered.""" gree_discovery = Discovery(DISCOVERY_TIMEOUT) devices = await gree_discovery.scan(wait_for=DISCOVERY_TIMEOUT) diff --git a/homeassistant/components/hisense_aehw4a1/config_flow.py b/homeassistant/components/hisense_aehw4a1/config_flow.py index 06eebb45948..8fd651d1782 100644 --- a/homeassistant/components/hisense_aehw4a1/config_flow.py +++ b/homeassistant/components/hisense_aehw4a1/config_flow.py @@ -1,12 +1,13 @@ """Config flow for Hisense AEH-W4A1 integration.""" from pyaehw4a1.aehw4a1 import AehW4a1 +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_entry_flow from .const import DOMAIN -async def _async_has_devices(hass): +async def _async_has_devices(hass: HomeAssistant) -> bool: """Return if there are devices that can be discovered.""" aehw4a1_ip_addresses = await AehW4a1().discovery() return len(aehw4a1_ip_addresses) > 0 diff --git a/homeassistant/components/ios/config_flow.py b/homeassistant/components/ios/config_flow.py index fc15cd833bc..47959e34074 100644 --- a/homeassistant/components/ios/config_flow.py +++ b/homeassistant/components/ios/config_flow.py @@ -3,4 +3,6 @@ from homeassistant.helpers import config_entry_flow from .const import DOMAIN -config_entry_flow.register_discovery_flow(DOMAIN, "Home Assistant iOS", lambda *_: True) +config_entry_flow.register_discovery_flow( + DOMAIN, "Home Assistant iOS", lambda hass: True +) diff --git a/homeassistant/components/izone/config_flow.py b/homeassistant/components/izone/config_flow.py index 83a77e12579..bc4fb8ceddc 100644 --- a/homeassistant/components/izone/config_flow.py +++ b/homeassistant/components/izone/config_flow.py @@ -6,7 +6,7 @@ import logging from async_timeout import timeout -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import config_entry_flow from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -16,7 +16,7 @@ from .discovery import async_start_discovery_service, async_stop_discovery_servi _LOGGER = logging.getLogger(__name__) -async def _async_has_devices(hass): +async def _async_has_devices(hass: HomeAssistant) -> bool: controller_ready = asyncio.Event() diff --git a/homeassistant/components/kulersky/config_flow.py b/homeassistant/components/kulersky/config_flow.py index f56688e919a..1f9c67b9aa1 100644 --- a/homeassistant/components/kulersky/config_flow.py +++ b/homeassistant/components/kulersky/config_flow.py @@ -3,6 +3,7 @@ import logging import pykulersky +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_entry_flow from .const import DOMAIN @@ -10,7 +11,7 @@ from .const import DOMAIN _LOGGER = logging.getLogger(__name__) -async def _async_has_devices(hass) -> bool: +async def _async_has_devices(hass: HomeAssistant) -> bool: """Return if there are devices that can be discovered.""" # Check if there are any devices that can be discovered in the network. try: diff --git a/homeassistant/components/lifx/config_flow.py b/homeassistant/components/lifx/config_flow.py index 1713683b720..c48bee9e4e7 100644 --- a/homeassistant/components/lifx/config_flow.py +++ b/homeassistant/components/lifx/config_flow.py @@ -1,12 +1,13 @@ """Config flow flow LIFX.""" import aiolifx +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_entry_flow from .const import DOMAIN -async def _async_has_devices(hass): +async def _async_has_devices(hass: HomeAssistant) -> bool: """Return if there are devices that can be discovered.""" lifx_ip_addresses = await aiolifx.LifxScan(hass.loop).scan() return len(lifx_ip_addresses) > 0 diff --git a/homeassistant/components/zerproc/config_flow.py b/homeassistant/components/zerproc/config_flow.py index fdf17c14e5a..e68c51cd7eb 100644 --- a/homeassistant/components/zerproc/config_flow.py +++ b/homeassistant/components/zerproc/config_flow.py @@ -3,6 +3,7 @@ import logging import pyzerproc +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_entry_flow from .const import DOMAIN @@ -10,7 +11,7 @@ from .const import DOMAIN _LOGGER = logging.getLogger(__name__) -async def _async_has_devices(hass) -> bool: +async def _async_has_devices(hass: HomeAssistant) -> bool: """Return if there are devices that can be discovered.""" try: devices = await pyzerproc.discover() diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index 1264fa2c1df..cb90499b6ca 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -44,6 +44,8 @@ _MODULE_FILTERS: dict[str, re.Pattern] = { "device_tracker": re.compile(r"^homeassistant\.components\.\w+\.(device_tracker)$"), # diagnostics matches only in the package root (diagnostics.py) "diagnostics": re.compile(r"^homeassistant\.components\.\w+\.(diagnostics)$"), + # config_flow matches only in the package root (config_flow.py) + "config_flow": re.compile(r"^homeassistant\.components\.\w+\.(config_flow)$") } _METHOD_MATCH: list[TypeHintMatch] = [ @@ -192,6 +194,14 @@ _METHOD_MATCH: list[TypeHintMatch] = [ }, return_type=UNDEFINED, ), + TypeHintMatch( + module_filter=_MODULE_FILTERS["config_flow"], + function_name="_async_has_devices", + arg_types={ + 0: "HomeAssistant", + }, + return_type="bool", + ), ]