diff --git a/tests/testing_config/custom_components/test/image_processing.py b/tests/testing_config/custom_components/test/image_processing.py index 343c60a78fef03d00293f6f4f4faacd404850e01..fe22325c3e0830c477feb9ef8df7fd8b4424c50c 100644 --- a/tests/testing_config/custom_components/test/image_processing.py +++ b/tests/testing_config/custom_components/test/image_processing.py @@ -1,11 +1,17 @@ """Provide a mock image processing.""" from homeassistant.components.image_processing import ImageProcessingEntity +from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType async def async_setup_platform( - hass, config, async_add_entities_callback, discovery_info=None -): + hass: HomeAssistant, + config: ConfigType, + async_add_entities_callback: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the test image_processing platform.""" async_add_entities_callback([TestImageProcessing("camera.demo_camera", "Test")]) @@ -13,7 +19,7 @@ async def async_setup_platform( class TestImageProcessing(ImageProcessingEntity): """Test image processing entity.""" - def __init__(self, camera_entity, name): + def __init__(self, camera_entity, name) -> None: """Initialize test image processing.""" self._name = name self._camera = camera_entity diff --git a/tests/testing_config/custom_components/test/light.py b/tests/testing_config/custom_components/test/light.py index 4cd49fec606cb47ec54b91661b1de6d6c5a46df4..6422bb4fccb5d012152a75d2cce2aa8cf897a285 100644 --- a/tests/testing_config/custom_components/test/light.py +++ b/tests/testing_config/custom_components/test/light.py @@ -5,6 +5,9 @@ Call init before using it in your tests to ensure clean test data. from homeassistant.components.light import ColorMode, LightEntity from homeassistant.const import STATE_OFF, STATE_ON +from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from tests.common import MockToggleEntity @@ -13,6 +16,7 @@ ENTITIES = [] def init(empty=False): """Initialize the platform with entities.""" + # pylint: disable-next=global-statement global ENTITIES # noqa: PLW0603 ENTITIES = ( @@ -27,8 +31,11 @@ def init(empty=False): async def async_setup_platform( - hass, config, async_add_entities_callback, discovery_info=None -): + hass: HomeAssistant, + config: ConfigType, + async_add_entities_callback: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Return mock entities.""" async_add_entities_callback(ENTITIES) @@ -64,7 +71,7 @@ class MockLight(MockToggleEntity, LightEntity): state, unique_id=None, supported_color_modes: set[ColorMode] | None = None, - ): + ) -> None: """Initialize the mock light.""" super().__init__(name, state, unique_id) if supported_color_modes is None: diff --git a/tests/testing_config/custom_components/test/lock.py b/tests/testing_config/custom_components/test/lock.py index e97d3f8de224d9a61db6887b2069921858316eab..0c24e1b5b41cfd9fc4ce29db250ed4e7303c8eff 100644 --- a/tests/testing_config/custom_components/test/lock.py +++ b/tests/testing_config/custom_components/test/lock.py @@ -4,6 +4,9 @@ Call init before using it in your tests to ensure clean test data. """ from homeassistant.components.lock import LockEntity, LockEntityFeature +from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from tests.common import MockEntity @@ -12,6 +15,7 @@ ENTITIES = {} def init(empty=False): """Initialize the platform with entities.""" + # pylint: disable-next=global-statement global ENTITIES # noqa: PLW0603 ENTITIES = ( @@ -35,8 +39,11 @@ def init(empty=False): async def async_setup_platform( - hass, config, async_add_entities_callback, discovery_info=None -): + hass: HomeAssistant, + config: ConfigType, + async_add_entities_callback: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Return mock entities.""" async_add_entities_callback(list(ENTITIES.values())) diff --git a/tests/testing_config/custom_components/test/remote.py b/tests/testing_config/custom_components/test/remote.py index 3226c93310c30401ce6499019251273b7d4a61e2..6d3f2ec955de40f35c06c333d7b5241e8aa04ece 100644 --- a/tests/testing_config/custom_components/test/remote.py +++ b/tests/testing_config/custom_components/test/remote.py @@ -5,6 +5,9 @@ Call init before using it in your tests to ensure clean test data. from homeassistant.components.remote import RemoteEntity from homeassistant.const import STATE_OFF, STATE_ON +from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from tests.common import MockToggleEntity @@ -13,6 +16,7 @@ ENTITIES = [] def init(empty=False): """Initialize the platform with entities.""" + # pylint: disable-next=global-statement global ENTITIES # noqa: PLW0603 ENTITIES = ( @@ -27,8 +31,11 @@ def init(empty=False): async def async_setup_platform( - hass, config, async_add_entities_callback, discovery_info=None -): + hass: HomeAssistant, + config: ConfigType, + async_add_entities_callback: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Return mock entities.""" async_add_entities_callback(ENTITIES) diff --git a/tests/testing_config/custom_components/test/switch.py b/tests/testing_config/custom_components/test/switch.py index b06db33746fbc86e31af8722ab170798e5b48690..9099040e2b6109dad6825c89dd42381594421de2 100644 --- a/tests/testing_config/custom_components/test/switch.py +++ b/tests/testing_config/custom_components/test/switch.py @@ -1,8 +1,15 @@ """Stub switch platform for translation tests.""" +from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType + async def async_setup_platform( - hass, config, async_add_entities_callback, discovery_info=None -): + hass: HomeAssistant, + config: ConfigType, + async_add_entities_callback: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Stub setup for translation tests.""" async_add_entities_callback([]) diff --git a/tests/testing_config/custom_components/test/weather.py b/tests/testing_config/custom_components/test/weather.py index b051531b9e8b2bafba9f0c5052f1de7999a87141..cef0584e4e02d146a21884b13c80404a28870132 100644 --- a/tests/testing_config/custom_components/test/weather.py +++ b/tests/testing_config/custom_components/test/weather.py @@ -33,6 +33,7 @@ ENTITIES = [] def init(empty=False): """Initialize the platform with entities.""" + # pylint: disable-next=global-statement global ENTITIES # noqa: PLW0603 ENTITIES = [] if empty else [MockWeather()] diff --git a/tests/testing_config/custom_components/test_embedded/__init__.py b/tests/testing_config/custom_components/test_embedded/__init__.py index b83493817fd7a0b88637715687d920d7188d8db8..b3fe1be4d743649210ac87b07066040d3641c27c 100644 --- a/tests/testing_config/custom_components/test_embedded/__init__.py +++ b/tests/testing_config/custom_components/test_embedded/__init__.py @@ -1,8 +1,11 @@ """Component with embedded platforms.""" +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType + DOMAIN = "test_embedded" -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Mock config.""" return True diff --git a/tests/testing_config/custom_components/test_embedded/switch.py b/tests/testing_config/custom_components/test_embedded/switch.py index 46dac4419a6bb4dc9c53383e51b6f0a9a2d0032a..f287f5ee547ea2d3463fe36b2b0f106becba8d69 100644 --- a/tests/testing_config/custom_components/test_embedded/switch.py +++ b/tests/testing_config/custom_components/test_embedded/switch.py @@ -1,7 +1,14 @@ """Switch platform for the embedded component.""" +from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType + async def async_setup_platform( - hass, config, async_add_entities_callback, discovery_info=None -): + hass: HomeAssistant, + config: ConfigType, + async_add_entities_callback: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Find and return test switches.""" diff --git a/tests/testing_config/custom_components/test_integration_platform/__init__.py b/tests/testing_config/custom_components/test_integration_platform/__init__.py index 220beb053677597c59ca2ead4b9305f97f4065be..8c3929398a192082a7ab16523f3ad4cb5f262f49 100644 --- a/tests/testing_config/custom_components/test_integration_platform/__init__.py +++ b/tests/testing_config/custom_components/test_integration_platform/__init__.py @@ -1,10 +1,13 @@ """Provide a mock package component.""" +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType + from .const import TEST # noqa: F401 DOMAIN = "test_integration_platform" -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Mock a successful setup.""" return True diff --git a/tests/testing_config/custom_components/test_package/__init__.py b/tests/testing_config/custom_components/test_package/__init__.py index 50e132e2c07bdb36235bc78842c62cdf6b4b7eb6..33b04428ba40c88481589f3dd6da690e1a36793a 100644 --- a/tests/testing_config/custom_components/test_package/__init__.py +++ b/tests/testing_config/custom_components/test_package/__init__.py @@ -1,10 +1,13 @@ """Provide a mock package component.""" +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType + from .const import TEST # noqa: F401 DOMAIN = "test_package" -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Mock a successful setup.""" return True diff --git a/tests/testing_config/custom_components/test_package_loaded_executor/__init__.py b/tests/testing_config/custom_components/test_package_loaded_executor/__init__.py index 50e132e2c07bdb36235bc78842c62cdf6b4b7eb6..33b04428ba40c88481589f3dd6da690e1a36793a 100644 --- a/tests/testing_config/custom_components/test_package_loaded_executor/__init__.py +++ b/tests/testing_config/custom_components/test_package_loaded_executor/__init__.py @@ -1,10 +1,13 @@ """Provide a mock package component.""" +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType + from .const import TEST # noqa: F401 DOMAIN = "test_package" -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Mock a successful setup.""" return True diff --git a/tests/testing_config/custom_components/test_package_loaded_loop/__init__.py b/tests/testing_config/custom_components/test_package_loaded_loop/__init__.py index b9080a2048a2667f8c7b8d8618fbe70a76eedf07..28eb409ba2baa54a66511bb193c3e33b478b3e11 100644 --- a/tests/testing_config/custom_components/test_package_loaded_loop/__init__.py +++ b/tests/testing_config/custom_components/test_package_loaded_loop/__init__.py @@ -1,8 +1,11 @@ """Provide a mock package component.""" +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType + from .const import TEST # noqa: F401 -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Mock a successful setup.""" return True diff --git a/tests/testing_config/custom_components/test_package_raises_cancelled_error/__init__.py b/tests/testing_config/custom_components/test_package_raises_cancelled_error/__init__.py index 37d3becb2d33bc1791c4493a8e03c5be0c59cc23..2bdf421c9b0954b768d6ca5097e27aa21b9a497b 100644 --- a/tests/testing_config/custom_components/test_package_raises_cancelled_error/__init__.py +++ b/tests/testing_config/custom_components/test_package_raises_cancelled_error/__init__.py @@ -2,8 +2,11 @@ import asyncio +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType -async def async_setup(hass, config): + +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Mock a successful setup.""" asyncio.current_task().cancel() await asyncio.sleep(0) diff --git a/tests/testing_config/custom_components/test_package_raises_cancelled_error_config_entry/__init__.py b/tests/testing_config/custom_components/test_package_raises_cancelled_error_config_entry/__init__.py index 55ce19865c64bd61c39f899789ce8dd2176c1877..caceba1d1da82ecdc700f52ac89175da9e65451a 100644 --- a/tests/testing_config/custom_components/test_package_raises_cancelled_error_config_entry/__init__.py +++ b/tests/testing_config/custom_components/test_package_raises_cancelled_error_config_entry/__init__.py @@ -2,13 +2,17 @@ import asyncio +from homeassistant.config_entries import ConfigEntry +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType -async def async_setup(hass, config): + +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Mock a successful setup.""" return True -async def async_setup_entry(hass, entry): +async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: """Mock an unsuccessful entry setup.""" asyncio.current_task().cancel() await asyncio.sleep(0) diff --git a/tests/testing_config/custom_components/test_standalone.py b/tests/testing_config/custom_components/test_standalone.py index 0b7ce8033e5dc8b8d959958623ccf60f8900e424..7d4c713d3c2702574af2b91310e1ab1fd18220a5 100644 --- a/tests/testing_config/custom_components/test_standalone.py +++ b/tests/testing_config/custom_components/test_standalone.py @@ -1,8 +1,11 @@ """Provide a mock standalone component.""" +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType + DOMAIN = "test_standalone" -async def async_setup(hass, config): +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Mock a successful setup.""" return True