diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ae135f304074f3..79bf7e87903df1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.6 + rev: v0.1.8 hooks: - id: ruff args: diff --git a/homeassistant/components/androidtv/media_player.py b/homeassistant/components/androidtv/media_player.py index 1fec605d8e1fac..496b4e51e4fe0e 100644 --- a/homeassistant/components/androidtv/media_player.py +++ b/homeassistant/components/androidtv/media_player.py @@ -160,7 +160,7 @@ def adb_decorator( """ def _adb_decorator( - func: _FuncType[_ADBDeviceT, _P, _R] + func: _FuncType[_ADBDeviceT, _P, _R], ) -> _ReturnFuncType[_ADBDeviceT, _P, _R]: """Wrap the provided ADB method and catch exceptions.""" diff --git a/homeassistant/components/braviatv/coordinator.py b/homeassistant/components/braviatv/coordinator.py index 43f911cd3a29ea..59219a34eb78ed 100644 --- a/homeassistant/components/braviatv/coordinator.py +++ b/homeassistant/components/braviatv/coordinator.py @@ -42,7 +42,7 @@ def catch_braviatv_errors( - func: Callable[Concatenate[_BraviaTVCoordinatorT, _P], Awaitable[None]] + func: Callable[Concatenate[_BraviaTVCoordinatorT, _P], Awaitable[None]], ) -> Callable[Concatenate[_BraviaTVCoordinatorT, _P], Coroutine[Any, Any, None]]: """Catch Bravia errors.""" diff --git a/homeassistant/components/calendar/__init__.py b/homeassistant/components/calendar/__init__.py index 5b98d3722200da..41e13b798b68dd 100644 --- a/homeassistant/components/calendar/__init__.py +++ b/homeassistant/components/calendar/__init__.py @@ -429,7 +429,7 @@ def _api_event_dict_factory(obj: Iterable[tuple[str, Any]]) -> dict[str, Any]: def _list_events_dict_factory( - obj: Iterable[tuple[str, Any]] + obj: Iterable[tuple[str, Any]], ) -> dict[str, JsonValueType]: """Convert CalendarEvent dataclass items to dictionary of attributes.""" return { @@ -818,7 +818,7 @@ async def handle_calendar_event_update( def _validate_timespan( - values: dict[str, Any] + values: dict[str, Any], ) -> tuple[datetime.datetime | datetime.date, datetime.datetime | datetime.date]: """Parse a create event service call and convert the args ofr a create event entity call. diff --git a/homeassistant/components/cloud/http_api.py b/homeassistant/components/cloud/http_api.py index c937a415cda5aa..d01b0c29e06347 100644 --- a/homeassistant/components/cloud/http_api.py +++ b/homeassistant/components/cloud/http_api.py @@ -116,7 +116,9 @@ async def async_setup(hass: HomeAssistant) -> None: def _handle_cloud_errors( - handler: Callable[Concatenate[_HassViewT, web.Request, _P], Awaitable[web.Response]] + handler: Callable[ + Concatenate[_HassViewT, web.Request, _P], Awaitable[web.Response] + ], ) -> Callable[ Concatenate[_HassViewT, web.Request, _P], Coroutine[Any, Any, web.Response] ]: diff --git a/homeassistant/components/decora/light.py b/homeassistant/components/decora/light.py index d060b69c3f6928..4a56b72ec661c9 100644 --- a/homeassistant/components/decora/light.py +++ b/homeassistant/components/decora/light.py @@ -60,7 +60,7 @@ def _name_validator(config): def retry( - method: Callable[Concatenate[_DecoraLightT, _P], _R] + method: Callable[Concatenate[_DecoraLightT, _P], _R], ) -> Callable[Concatenate[_DecoraLightT, _P], _R | None]: """Retry bluetooth commands.""" diff --git a/homeassistant/components/device_automation/__init__.py b/homeassistant/components/device_automation/__init__.py index d7641c34316dc1..68d05c19f67763 100644 --- a/homeassistant/components/device_automation/__init__.py +++ b/homeassistant/components/device_automation/__init__.py @@ -358,7 +358,7 @@ def async_validate_entity_schema( def handle_device_errors( - func: Callable[[HomeAssistant, ActiveConnection, dict[str, Any]], Awaitable[None]] + func: Callable[[HomeAssistant, ActiveConnection, dict[str, Any]], Awaitable[None]], ) -> Callable[ [HomeAssistant, ActiveConnection, dict[str, Any]], Coroutine[Any, Any, None] ]: diff --git a/homeassistant/components/dhcp/__init__.py b/homeassistant/components/dhcp/__init__.py index c3705dad3ddbbe..df95e629b8fd20 100644 --- a/homeassistant/components/dhcp/__init__.py +++ b/homeassistant/components/dhcp/__init__.py @@ -489,7 +489,7 @@ def _handle_dhcp_packet(packet: Packet) -> None: def _dhcp_options_as_dict( - dhcp_options: Iterable[tuple[str, int | bytes | None]] + dhcp_options: Iterable[tuple[str, int | bytes | None]], ) -> dict[str, str | int | bytes | None]: """Extract data from packet options as a dict.""" return {option[0]: option[1] for option in dhcp_options if len(option) >= 2} diff --git a/homeassistant/components/dlna_dmr/media_player.py b/homeassistant/components/dlna_dmr/media_player.py index cd2f1ae2f50748..749f2c887eb2fd 100644 --- a/homeassistant/components/dlna_dmr/media_player.py +++ b/homeassistant/components/dlna_dmr/media_player.py @@ -55,7 +55,7 @@ def catch_request_errors( - func: Callable[Concatenate[_DlnaDmrEntityT, _P], Awaitable[_R]] + func: Callable[Concatenate[_DlnaDmrEntityT, _P], Awaitable[_R]], ) -> Callable[Concatenate[_DlnaDmrEntityT, _P], Coroutine[Any, Any, _R | None]]: """Catch UpnpError errors.""" diff --git a/homeassistant/components/dlna_dms/dms.py b/homeassistant/components/dlna_dms/dms.py index 6352d98da3cced..62ff2be7d5b54d 100644 --- a/homeassistant/components/dlna_dms/dms.py +++ b/homeassistant/components/dlna_dms/dms.py @@ -124,7 +124,7 @@ class ActionError(DlnaDmsDeviceError): def catch_request_errors( - func: Callable[[_DlnaDmsDeviceMethod, str], Coroutine[Any, Any, _R]] + func: Callable[[_DlnaDmsDeviceMethod, str], Coroutine[Any, Any, _R]], ) -> Callable[[_DlnaDmsDeviceMethod, str], Coroutine[Any, Any, _R]]: """Catch UpnpError errors.""" diff --git a/homeassistant/components/duotecno/entity.py b/homeassistant/components/duotecno/entity.py index d38d52a0d2691c..8d905979bfeec4 100644 --- a/homeassistant/components/duotecno/entity.py +++ b/homeassistant/components/duotecno/entity.py @@ -47,7 +47,7 @@ async def _on_update(self) -> None: def api_call( - func: Callable[Concatenate[_T, _P], Awaitable[None]] + func: Callable[Concatenate[_T, _P], Awaitable[None]], ) -> Callable[Concatenate[_T, _P], Coroutine[Any, Any, None]]: """Catch command exceptions.""" diff --git a/homeassistant/components/dynalite/convert_config.py b/homeassistant/components/dynalite/convert_config.py index 4abc02c05659ff..25d18dd92e8928 100644 --- a/homeassistant/components/dynalite/convert_config.py +++ b/homeassistant/components/dynalite/convert_config.py @@ -138,7 +138,7 @@ def convert_template(config: dict[str, Any]) -> dict[str, Any]: def convert_config( - config: dict[str, Any] | MappingProxyType[str, Any] + config: dict[str, Any] | MappingProxyType[str, Any], ) -> dict[str, Any]: """Convert a config dict by replacing component consts with library consts.""" my_map = { diff --git a/homeassistant/components/esphome/entity.py b/homeassistant/components/esphome/entity.py index dc5a4ff0968d6a..1def6d37e028f0 100644 --- a/homeassistant/components/esphome/entity.py +++ b/homeassistant/components/esphome/entity.py @@ -92,7 +92,7 @@ def async_list_entities(infos: list[EntityInfo]) -> None: def esphome_state_property( - func: Callable[[_EntityT], _R] + func: Callable[[_EntityT], _R], ) -> Callable[[_EntityT], _R | None]: """Wrap a state property of an esphome entity. diff --git a/homeassistant/components/evil_genius_labs/util.py b/homeassistant/components/evil_genius_labs/util.py index b0e01c1f3291df..eb2caf59d9d19c 100644 --- a/homeassistant/components/evil_genius_labs/util.py +++ b/homeassistant/components/evil_genius_labs/util.py @@ -13,7 +13,7 @@ def update_when_done( - func: Callable[Concatenate[_EvilGeniusEntityT, _P], Awaitable[_R]] + func: Callable[Concatenate[_EvilGeniusEntityT, _P], Awaitable[_R]], ) -> Callable[Concatenate[_EvilGeniusEntityT, _P], Coroutine[Any, Any, _R]]: """Decorate function to trigger update when function is done.""" diff --git a/homeassistant/components/google_generative_ai_conversation/config_flow.py b/homeassistant/components/google_generative_ai_conversation/config_flow.py index 94639177a42f64..fea023c604e71c 100644 --- a/homeassistant/components/google_generative_ai_conversation/config_flow.py +++ b/homeassistant/components/google_generative_ai_conversation/config_flow.py @@ -129,7 +129,7 @@ async def async_step_init( def google_generative_ai_config_option_schema( - options: MappingProxyType[str, Any] + options: MappingProxyType[str, Any], ) -> dict: """Return a schema for Google Generative AI completion options.""" if not options: diff --git a/homeassistant/components/group/sensor.py b/homeassistant/components/group/sensor.py index 10030ab647fec2..c35c96d38aaa18 100644 --- a/homeassistant/components/group/sensor.py +++ b/homeassistant/components/group/sensor.py @@ -154,7 +154,7 @@ def async_create_preview_sensor( def calc_min( - sensor_values: list[tuple[str, float, State]] + sensor_values: list[tuple[str, float, State]], ) -> tuple[dict[str, str | None], float | None]: """Calculate min value.""" val: float | None = None @@ -170,7 +170,7 @@ def calc_min( def calc_max( - sensor_values: list[tuple[str, float, State]] + sensor_values: list[tuple[str, float, State]], ) -> tuple[dict[str, str | None], float | None]: """Calculate max value.""" val: float | None = None @@ -186,7 +186,7 @@ def calc_max( def calc_mean( - sensor_values: list[tuple[str, float, State]] + sensor_values: list[tuple[str, float, State]], ) -> tuple[dict[str, str | None], float | None]: """Calculate mean value.""" result = (sensor_value for _, sensor_value, _ in sensor_values) @@ -196,7 +196,7 @@ def calc_mean( def calc_median( - sensor_values: list[tuple[str, float, State]] + sensor_values: list[tuple[str, float, State]], ) -> tuple[dict[str, str | None], float | None]: """Calculate median value.""" result = (sensor_value for _, sensor_value, _ in sensor_values) @@ -206,7 +206,7 @@ def calc_median( def calc_last( - sensor_values: list[tuple[str, float, State]] + sensor_values: list[tuple[str, float, State]], ) -> tuple[dict[str, str | None], float | None]: """Calculate last value.""" last_updated: datetime | None = None @@ -223,7 +223,7 @@ def calc_last( def calc_range( - sensor_values: list[tuple[str, float, State]] + sensor_values: list[tuple[str, float, State]], ) -> tuple[dict[str, str | None], float]: """Calculate range value.""" max_result = max((sensor_value for _, sensor_value, _ in sensor_values)) @@ -234,7 +234,7 @@ def calc_range( def calc_sum( - sensor_values: list[tuple[str, float, State]] + sensor_values: list[tuple[str, float, State]], ) -> tuple[dict[str, str | None], float]: """Calculate a sum of values.""" result = 0.0 @@ -245,7 +245,7 @@ def calc_sum( def calc_product( - sensor_values: list[tuple[str, float, State]] + sensor_values: list[tuple[str, float, State]], ) -> tuple[dict[str, str | None], float]: """Calculate a product of values.""" result = 1.0 diff --git a/homeassistant/components/guardian/__init__.py b/homeassistant/components/guardian/__init__.py index 1cb55204240b4e..4a394692dd847b 100644 --- a/homeassistant/components/guardian/__init__.py +++ b/homeassistant/components/guardian/__init__.py @@ -171,7 +171,7 @@ async def async_init_coordinator( @callback def call_with_data( - func: Callable[[ServiceCall, GuardianData], Coroutine[Any, Any, None]] + func: Callable[[ServiceCall, GuardianData], Coroutine[Any, Any, None]], ) -> Callable[[ServiceCall], Coroutine[Any, Any, None]]: """Hydrate a service call with the appropriate GuardianData object.""" diff --git a/homeassistant/components/hassio/addon_manager.py b/homeassistant/components/hassio/addon_manager.py index 22265f49912f03..7f9299fa2b10b7 100644 --- a/homeassistant/components/hassio/addon_manager.py +++ b/homeassistant/components/hassio/addon_manager.py @@ -43,7 +43,7 @@ def api_error( """Handle HassioAPIError and raise a specific AddonError.""" def handle_hassio_api_error( - func: _FuncType[_AddonManagerT, _P, _R] + func: _FuncType[_AddonManagerT, _P, _R], ) -> _ReturnFuncType[_AddonManagerT, _P, _R]: """Handle a HassioAPIError.""" diff --git a/homeassistant/components/hive/__init__.py b/homeassistant/components/hive/__init__.py index ba060caa43a278..1a386d3b2719d5 100644 --- a/homeassistant/components/hive/__init__.py +++ b/homeassistant/components/hive/__init__.py @@ -131,7 +131,7 @@ async def async_remove_config_entry_device( def refresh_system( - func: Callable[Concatenate[_HiveEntityT, _P], Awaitable[Any]] + func: Callable[Concatenate[_HiveEntityT, _P], Awaitable[Any]], ) -> Callable[Concatenate[_HiveEntityT, _P], Coroutine[Any, Any, None]]: """Force update all entities after state change.""" diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index 0920530524de80..cd90c4acf60bde 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -152,7 +152,7 @@ def _has_all_unique_names_and_ports( - bridges: list[dict[str, Any]] + bridges: list[dict[str, Any]], ) -> list[dict[str, Any]]: """Validate that each homekit bridge configured has a unique name.""" names = [bridge[CONF_NAME] for bridge in bridges] diff --git a/homeassistant/components/homewizard/helpers.py b/homeassistant/components/homewizard/helpers.py index 4f12a4f9726d97..4c3ae76a3272de 100644 --- a/homeassistant/components/homewizard/helpers.py +++ b/homeassistant/components/homewizard/helpers.py @@ -16,7 +16,7 @@ def homewizard_exception_handler( - func: Callable[Concatenate[_HomeWizardEntityT, _P], Coroutine[Any, Any, Any]] + func: Callable[Concatenate[_HomeWizardEntityT, _P], Coroutine[Any, Any, Any]], ) -> Callable[Concatenate[_HomeWizardEntityT, _P], Coroutine[Any, Any, None]]: """Decorate HomeWizard Energy calls to handle HomeWizardEnergy exceptions. diff --git a/homeassistant/components/http/ban.py b/homeassistant/components/http/ban.py index c56dd6c343b16c..62569495ba70f7 100644 --- a/homeassistant/components/http/ban.py +++ b/homeassistant/components/http/ban.py @@ -84,7 +84,7 @@ async def ban_middleware( def log_invalid_auth( - func: Callable[Concatenate[_HassViewT, Request, _P], Awaitable[Response]] + func: Callable[Concatenate[_HassViewT, Request, _P], Awaitable[Response]], ) -> Callable[Concatenate[_HassViewT, Request, _P], Coroutine[Any, Any, Response]]: """Decorate function to handle invalid auth or failed login attempts.""" diff --git a/homeassistant/components/http/decorators.py b/homeassistant/components/http/decorators.py index ce5b1b18c06411..4d8ac5c2df5367 100644 --- a/homeassistant/components/http/decorators.py +++ b/homeassistant/components/http/decorators.py @@ -45,7 +45,7 @@ def require_admin( """Home Assistant API decorator to require user to be an admin.""" def decorator_require_admin( - func: _FuncType[_HomeAssistantViewT, _P] + func: _FuncType[_HomeAssistantViewT, _P], ) -> _FuncType[_HomeAssistantViewT, _P]: """Wrap the provided with_admin function.""" diff --git a/homeassistant/components/iaqualink/__init__.py b/homeassistant/components/iaqualink/__init__.py index fceb0d72213751..062548666c4895 100644 --- a/homeassistant/components/iaqualink/__init__.py +++ b/homeassistant/components/iaqualink/__init__.py @@ -185,7 +185,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: def refresh_system( - func: Callable[Concatenate[_AqualinkEntityT, _P], Awaitable[Any]] + func: Callable[Concatenate[_AqualinkEntityT, _P], Awaitable[Any]], ) -> Callable[Concatenate[_AqualinkEntityT, _P], Coroutine[Any, Any, None]]: """Force update all entities after state change.""" diff --git a/homeassistant/components/iqvia/__init__.py b/homeassistant/components/iqvia/__init__.py index def58d602012a2..aa5528cc06ab76 100644 --- a/homeassistant/components/iqvia/__init__.py +++ b/homeassistant/components/iqvia/__init__.py @@ -57,7 +57,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: client.disable_request_retries() async def async_get_data_from_api( - api_coro: Callable[..., Coroutine[Any, Any, dict[str, Any]]] + api_coro: Callable[..., Coroutine[Any, Any, dict[str, Any]]], ) -> dict[str, Any]: """Get data from a particular API coroutine.""" try: diff --git a/homeassistant/components/kodi/media_player.py b/homeassistant/components/kodi/media_player.py index 32ecbbed6260a2..89f0a992ff1def 100644 --- a/homeassistant/components/kodi/media_player.py +++ b/homeassistant/components/kodi/media_player.py @@ -231,7 +231,7 @@ async def async_setup_entry( def cmd( - func: Callable[Concatenate[_KodiEntityT, _P], Awaitable[Any]] + func: Callable[Concatenate[_KodiEntityT, _P], Awaitable[Any]], ) -> Callable[Concatenate[_KodiEntityT, _P], Coroutine[Any, Any, None]]: """Catch command exceptions.""" diff --git a/homeassistant/components/lametric/helpers.py b/homeassistant/components/lametric/helpers.py index 884e6c451bc9f9..3a3014a369e22c 100644 --- a/homeassistant/components/lametric/helpers.py +++ b/homeassistant/components/lametric/helpers.py @@ -19,7 +19,7 @@ def lametric_exception_handler( - func: Callable[Concatenate[_LaMetricEntityT, _P], Coroutine[Any, Any, Any]] + func: Callable[Concatenate[_LaMetricEntityT, _P], Coroutine[Any, Any, Any]], ) -> Callable[Concatenate[_LaMetricEntityT, _P], Coroutine[Any, Any, None]]: """Decorate LaMetric calls to handle LaMetric exceptions. diff --git a/homeassistant/components/lutron_caseta/__init__.py b/homeassistant/components/lutron_caseta/__init__.py index 41369046d51986..0788af76aca2f2 100644 --- a/homeassistant/components/lutron_caseta/__init__.py +++ b/homeassistant/components/lutron_caseta/__init__.py @@ -322,7 +322,7 @@ def _async_setup_keypads( @callback def _async_build_trigger_schemas( - keypad_button_names_to_leap: dict[int, dict[str, int]] + keypad_button_names_to_leap: dict[int, dict[str, int]], ) -> dict[int, vol.Schema]: """Build device trigger schemas.""" diff --git a/homeassistant/components/motioneye/__init__.py b/homeassistant/components/motioneye/__init__.py index 59fc41df9b0661..37519a236ab135 100644 --- a/homeassistant/components/motioneye/__init__.py +++ b/homeassistant/components/motioneye/__init__.py @@ -111,7 +111,7 @@ def get_motioneye_device_identifier( def split_motioneye_device_identifier( - identifier: tuple[str, str] + identifier: tuple[str, str], ) -> tuple[str, str, int] | None: """Get the identifiers for a motionEye device.""" if len(identifier) != 2 or identifier[0] != DOMAIN or "_" not in identifier[1]: diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index ded9073ac57f06..412664ceedf79f 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -1135,7 +1135,7 @@ def _cleanup_discovery_on_remove(self) -> None: def device_info_from_specifications( - specifications: dict[str, Any] | None + specifications: dict[str, Any] | None, ) -> DeviceInfo | None: """Return a device description for device registry.""" if not specifications: diff --git a/homeassistant/components/nina/coordinator.py b/homeassistant/components/nina/coordinator.py index eb5c7a7e506bc7..b2c97503442fe8 100644 --- a/homeassistant/components/nina/coordinator.py +++ b/homeassistant/components/nina/coordinator.py @@ -66,7 +66,7 @@ async def _async_update_data(self) -> dict[str, list[NinaWarningData]]: @staticmethod def _remove_duplicate_warnings( - warnings: dict[str, list[Any]] + warnings: dict[str, list[Any]], ) -> dict[str, list[Any]]: """Remove warnings with the same title and expires timestamp in a region.""" all_filtered_warnings: dict[str, list[Any]] = {} diff --git a/homeassistant/components/openhome/media_player.py b/homeassistant/components/openhome/media_player.py index 51d7774a2fb865..a4a16c6713ca12 100644 --- a/homeassistant/components/openhome/media_player.py +++ b/homeassistant/components/openhome/media_player.py @@ -79,7 +79,7 @@ def catch_request_errors() -> ( """Catch asyncio.TimeoutError, aiohttp.ClientError, UpnpError errors.""" def call_wrapper( - func: _FuncType[_OpenhomeDeviceT, _P, _R] + func: _FuncType[_OpenhomeDeviceT, _P, _R], ) -> _ReturnFuncType[_OpenhomeDeviceT, _P, _R]: """Call wrapper for decorator.""" diff --git a/homeassistant/components/otbr/util.py b/homeassistant/components/otbr/util.py index 067282108f101b..85e97209a449a0 100644 --- a/homeassistant/components/otbr/util.py +++ b/homeassistant/components/otbr/util.py @@ -49,7 +49,7 @@ def _handle_otbr_error( - func: Callable[Concatenate[OTBRData, _P], Coroutine[Any, Any, _R]] + func: Callable[Concatenate[OTBRData, _P], Coroutine[Any, Any, _R]], ) -> Callable[Concatenate[OTBRData, _P], Coroutine[Any, Any, _R]]: """Handle OTBR errors.""" diff --git a/homeassistant/components/overkiz/alarm_control_panel.py b/homeassistant/components/overkiz/alarm_control_panel.py index fcd94ae5bcde7d..e2555308e3435a 100644 --- a/homeassistant/components/overkiz/alarm_control_panel.py +++ b/homeassistant/components/overkiz/alarm_control_panel.py @@ -95,7 +95,7 @@ def _state_tsk_alarm_controller(select_state: Callable[[str], OverkizStateType]) def _state_stateful_alarm_controller( - select_state: Callable[[str], OverkizStateType] + select_state: Callable[[str], OverkizStateType], ) -> str: """Return the state of the device.""" if state := cast(str, select_state(OverkizState.CORE_ACTIVE_ZONES)): @@ -118,7 +118,7 @@ def _state_stateful_alarm_controller( def _state_myfox_alarm_controller( - select_state: Callable[[str], OverkizStateType] + select_state: Callable[[str], OverkizStateType], ) -> str: """Return the state of the device.""" if ( @@ -141,7 +141,7 @@ def _state_myfox_alarm_controller( def _state_alarm_panel_controller( - select_state: Callable[[str], OverkizStateType] + select_state: Callable[[str], OverkizStateType], ) -> str: """Return the state of the device.""" return MAP_ARM_TYPE[ diff --git a/homeassistant/components/plex/media_player.py b/homeassistant/components/plex/media_player.py index 3e6875f98b9edb..3e817b4ea1a52b 100644 --- a/homeassistant/components/plex/media_player.py +++ b/homeassistant/components/plex/media_player.py @@ -53,7 +53,7 @@ def needs_session( - func: Callable[Concatenate[_PlexMediaPlayerT, _P], _R] + func: Callable[Concatenate[_PlexMediaPlayerT, _P], _R], ) -> Callable[Concatenate[_PlexMediaPlayerT, _P], _R | None]: """Ensure session is available for certain attributes.""" diff --git a/homeassistant/components/plugwise/util.py b/homeassistant/components/plugwise/util.py index 2abb1051d7420a..4f8d4c8d8fe289 100644 --- a/homeassistant/components/plugwise/util.py +++ b/homeassistant/components/plugwise/util.py @@ -14,7 +14,7 @@ def plugwise_command( - func: Callable[Concatenate[_PlugwiseEntityT, _P], Awaitable[_R]] + func: Callable[Concatenate[_PlugwiseEntityT, _P], Awaitable[_R]], ) -> Callable[Concatenate[_PlugwiseEntityT, _P], Coroutine[Any, Any, _R]]: """Decorate Plugwise calls that send commands/make changes to the device. diff --git a/homeassistant/components/rainmachine/__init__.py b/homeassistant/components/rainmachine/__init__.py index fde9b945e5312e..411691ca9f50ba 100644 --- a/homeassistant/components/rainmachine/__init__.py +++ b/homeassistant/components/rainmachine/__init__.py @@ -335,7 +335,7 @@ def call_with_controller( """Hydrate a service call with the appropriate controller.""" def decorator( - func: Callable[[ServiceCall, Controller], Coroutine[Any, Any, None]] + func: Callable[[ServiceCall, Controller], Coroutine[Any, Any, None]], ) -> Callable[[ServiceCall], Coroutine[Any, Any, None]]: """Define the decorator.""" diff --git a/homeassistant/components/rainmachine/switch.py b/homeassistant/components/rainmachine/switch.py index 361f8b2583bb1e..0150f4cb6000a2 100644 --- a/homeassistant/components/rainmachine/switch.py +++ b/homeassistant/components/rainmachine/switch.py @@ -117,7 +117,7 @@ def raise_on_request_error( - func: Callable[Concatenate[_T, _P], Awaitable[None]] + func: Callable[Concatenate[_T, _P], Awaitable[None]], ) -> Callable[Concatenate[_T, _P], Coroutine[Any, Any, None]]: """Define a decorator to raise on a request error.""" diff --git a/homeassistant/components/recorder/statistics.py b/homeassistant/components/recorder/statistics.py index 78c475753a2a11..ad6cdd31e2c0af 100644 --- a/homeassistant/components/recorder/statistics.py +++ b/homeassistant/components/recorder/statistics.py @@ -782,7 +782,7 @@ def _statistic_by_id_from_metadata( def _flatten_list_statistic_ids_metadata_result( - result: dict[str, dict[str, Any]] + result: dict[str, dict[str, Any]], ) -> list[dict]: """Return a flat dict of metadata.""" return [ diff --git a/homeassistant/components/recorder/util.py b/homeassistant/components/recorder/util.py index 2d518d8874bde2..4a1bf940b244ad 100644 --- a/homeassistant/components/recorder/util.py +++ b/homeassistant/components/recorder/util.py @@ -658,7 +658,7 @@ def database_job_retry_wrapper( """ def decorator( - job: _WrappedFuncType[_RecorderT, _P] + job: _WrappedFuncType[_RecorderT, _P], ) -> _WrappedFuncType[_RecorderT, _P]: @functools.wraps(job) def wrapper(instance: _RecorderT, *args: _P.args, **kwargs: _P.kwargs) -> None: diff --git a/homeassistant/components/renault/renault_vehicle.py b/homeassistant/components/renault/renault_vehicle.py index 6dd0dc2611eb77..e44a50d57a1af9 100644 --- a/homeassistant/components/renault/renault_vehicle.py +++ b/homeassistant/components/renault/renault_vehicle.py @@ -26,7 +26,7 @@ def with_error_wrapping( - func: Callable[Concatenate[RenaultVehicleProxy, _P], Awaitable[_T]] + func: Callable[Concatenate[RenaultVehicleProxy, _P], Awaitable[_T]], ) -> Callable[Concatenate[RenaultVehicleProxy, _P], Coroutine[Any, Any, _T]]: """Catch Renault errors.""" diff --git a/homeassistant/components/rfxtrx/__init__.py b/homeassistant/components/rfxtrx/__init__.py index 3ce45e5610eb49..cfacc62774403a 100644 --- a/homeassistant/components/rfxtrx/__init__.py +++ b/homeassistant/components/rfxtrx/__init__.py @@ -147,7 +147,7 @@ def _create_rfx(config: Mapping[str, Any]) -> rfxtrxmod.Connect: def _get_device_lookup( - devices: dict[str, dict[str, Any]] + devices: dict[str, dict[str, Any]], ) -> dict[DeviceTuple, dict[str, Any]]: """Get a lookup structure for devices.""" lookup = {} @@ -440,7 +440,7 @@ def get_device_id( def get_device_tuple_from_identifiers( - identifiers: set[tuple[str, str]] + identifiers: set[tuple[str, str]], ) -> DeviceTuple | None: """Calculate the device tuple from a device entry.""" identifier = next((x for x in identifiers if x[0] == DOMAIN and len(x) == 4), None) diff --git a/homeassistant/components/roku/helpers.py b/homeassistant/components/roku/helpers.py index 60392d89f1d274..60a3cbeec304e4 100644 --- a/homeassistant/components/roku/helpers.py +++ b/homeassistant/components/roku/helpers.py @@ -32,7 +32,7 @@ def roku_exception_handler( """Decorate Roku calls to handle Roku exceptions.""" def decorator( - func: _FuncType[_RokuEntityT, _P] + func: _FuncType[_RokuEntityT, _P], ) -> _ReturnFuncType[_RokuEntityT, _P]: @wraps(func) async def wrapper( diff --git a/homeassistant/components/sabnzbd/__init__.py b/homeassistant/components/sabnzbd/__init__.py index b1d118e6f75e95..7d0437da03393d 100644 --- a/homeassistant/components/sabnzbd/__init__.py +++ b/homeassistant/components/sabnzbd/__init__.py @@ -191,7 +191,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: @callback def extract_api( - func: Callable[[ServiceCall, SabnzbdApiData], Coroutine[Any, Any, None]] + func: Callable[[ServiceCall, SabnzbdApiData], Coroutine[Any, Any, None]], ) -> Callable[[ServiceCall], Coroutine[Any, Any, None]]: """Define a decorator to get the correct api for a service call.""" diff --git a/homeassistant/components/sensibo/entity.py b/homeassistant/components/sensibo/entity.py index f9056fa6624801..5a755a7730cc7c 100644 --- a/homeassistant/components/sensibo/entity.py +++ b/homeassistant/components/sensibo/entity.py @@ -19,7 +19,7 @@ def async_handle_api_call( - function: Callable[Concatenate[_T, _P], Coroutine[Any, Any, Any]] + function: Callable[Concatenate[_T, _P], Coroutine[Any, Any, Any]], ) -> Callable[Concatenate[_T, _P], Coroutine[Any, Any, Any]]: """Decorate api calls.""" diff --git a/homeassistant/components/sfr_box/button.py b/homeassistant/components/sfr_box/button.py index 80f7d6d51e4b5c..56c5335e9082eb 100644 --- a/homeassistant/components/sfr_box/button.py +++ b/homeassistant/components/sfr_box/button.py @@ -30,7 +30,7 @@ def with_error_wrapping( - func: Callable[Concatenate[SFRBoxButton, _P], Awaitable[_T]] + func: Callable[Concatenate[SFRBoxButton, _P], Awaitable[_T]], ) -> Callable[Concatenate[SFRBoxButton, _P], Coroutine[Any, Any, _T]]: """Catch SFR errors.""" diff --git a/homeassistant/components/simplisafe/__init__.py b/homeassistant/components/simplisafe/__init__.py index b1bd2c8e9d60da..772b6f9cbf6e38 100644 --- a/homeassistant/components/simplisafe/__init__.py +++ b/homeassistant/components/simplisafe/__init__.py @@ -337,7 +337,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: @callback def extract_system( - func: Callable[[ServiceCall, SystemType], Coroutine[Any, Any, None]] + func: Callable[[ServiceCall, SystemType], Coroutine[Any, Any, None]], ) -> Callable[[ServiceCall], Coroutine[Any, Any, None]]: """Define a decorator to get the correct system for a service call.""" diff --git a/homeassistant/components/sonos/diagnostics.py b/homeassistant/components/sonos/diagnostics.py index 96ffeb1df2ad1c..21e440673d6053 100644 --- a/homeassistant/components/sonos/diagnostics.py +++ b/homeassistant/components/sonos/diagnostics.py @@ -112,7 +112,7 @@ async def async_generate_speaker_info( payload: dict[str, Any] = {} def get_contents( - item: int | float | str | dict[str, Any] + item: int | float | str | dict[str, Any], ) -> int | float | str | dict[str, Any]: if isinstance(item, (int, float, str)): return item diff --git a/homeassistant/components/synology_dsm/config_flow.py b/homeassistant/components/synology_dsm/config_flow.py index 36eb37b7882c9f..ef2fc3dc12812d 100644 --- a/homeassistant/components/synology_dsm/config_flow.py +++ b/homeassistant/components/synology_dsm/config_flow.py @@ -84,7 +84,7 @@ def _user_schema_with_defaults(user_input: dict[str, Any]) -> vol.Schema: def _ordered_shared_schema( - schema_input: dict[str, Any] + schema_input: dict[str, Any], ) -> dict[vol.Required | vol.Optional, Any]: return { vol.Required(CONF_USERNAME, default=schema_input.get(CONF_USERNAME, "")): str, diff --git a/homeassistant/components/tplink/entity.py b/homeassistant/components/tplink/entity.py index afb341b47edea8..2df9a85608300f 100644 --- a/homeassistant/components/tplink/entity.py +++ b/homeassistant/components/tplink/entity.py @@ -18,7 +18,7 @@ def async_refresh_after( - func: Callable[Concatenate[_T, _P], Awaitable[None]] + func: Callable[Concatenate[_T, _P], Awaitable[None]], ) -> Callable[Concatenate[_T, _P], Coroutine[Any, Any, None]]: """Define a wrapper to refresh after.""" diff --git a/homeassistant/components/tradfri/base_class.py b/homeassistant/components/tradfri/base_class.py index 416eb175d31df1..abb35df62aa89f 100644 --- a/homeassistant/components/tradfri/base_class.py +++ b/homeassistant/components/tradfri/base_class.py @@ -19,7 +19,7 @@ def handle_error( - func: Callable[[Command | list[Command]], Any] + func: Callable[[Command | list[Command]], Any], ) -> Callable[[Command | list[Command]], Coroutine[Any, Any, None]]: """Handle tradfri api call error.""" diff --git a/homeassistant/components/velbus/diagnostics.py b/homeassistant/components/velbus/diagnostics.py index f6015abd1f833d..5b991fa35fba3a 100644 --- a/homeassistant/components/velbus/diagnostics.py +++ b/homeassistant/components/velbus/diagnostics.py @@ -48,7 +48,7 @@ def _build_module_diagnostics_info(module: VelbusModule) -> dict[str, Any]: def _build_channels_diagnostics_info( - channels: dict[str, VelbusChannel] + channels: dict[str, VelbusChannel], ) -> dict[str, Any]: """Build diagnostics info for all channels.""" data: dict[str, Any] = {} diff --git a/homeassistant/components/velbus/entity.py b/homeassistant/components/velbus/entity.py index 45220e1a9b477e..1a99f796eb24d8 100644 --- a/homeassistant/components/velbus/entity.py +++ b/homeassistant/components/velbus/entity.py @@ -48,7 +48,7 @@ async def _on_update(self) -> None: def api_call( - func: Callable[Concatenate[_T, _P], Awaitable[None]] + func: Callable[Concatenate[_T, _P], Awaitable[None]], ) -> Callable[Concatenate[_T, _P], Coroutine[Any, Any, None]]: """Catch command exceptions.""" diff --git a/homeassistant/components/vera/config_flow.py b/homeassistant/components/vera/config_flow.py index c300f599faaca9..00b45e00b11087 100644 --- a/homeassistant/components/vera/config_flow.py +++ b/homeassistant/components/vera/config_flow.py @@ -44,7 +44,7 @@ def new_options(lights: list[int], exclude: list[int]) -> dict[str, list[int]]: def options_schema( - options: Mapping[str, Any] | None = None + options: Mapping[str, Any] | None = None, ) -> dict[vol.Optional, type[str]]: """Return options schema.""" options = options or {} diff --git a/homeassistant/components/vlc_telnet/media_player.py b/homeassistant/components/vlc_telnet/media_player.py index ef1df676a2dde2..b84676776f56e4 100644 --- a/homeassistant/components/vlc_telnet/media_player.py +++ b/homeassistant/components/vlc_telnet/media_player.py @@ -45,7 +45,7 @@ async def async_setup_entry( def catch_vlc_errors( - func: Callable[Concatenate[_VlcDeviceT, _P], Awaitable[None]] + func: Callable[Concatenate[_VlcDeviceT, _P], Awaitable[None]], ) -> Callable[Concatenate[_VlcDeviceT, _P], Coroutine[Any, Any, None]]: """Catch VLC errors.""" diff --git a/homeassistant/components/wallbox/coordinator.py b/homeassistant/components/wallbox/coordinator.py index b3c5a9b4910a85..96d66bb439598d 100644 --- a/homeassistant/components/wallbox/coordinator.py +++ b/homeassistant/components/wallbox/coordinator.py @@ -68,7 +68,7 @@ def _require_authentication( - func: Callable[Concatenate[_WallboxCoordinatorT, _P], Any] + func: Callable[Concatenate[_WallboxCoordinatorT, _P], Any], ) -> Callable[Concatenate[_WallboxCoordinatorT, _P], Any]: """Authenticate with decorator using Wallbox API.""" diff --git a/homeassistant/components/webostv/media_player.py b/homeassistant/components/webostv/media_player.py index 61bef8c693cf68..f12b1c08c60b37 100644 --- a/homeassistant/components/webostv/media_player.py +++ b/homeassistant/components/webostv/media_player.py @@ -84,7 +84,7 @@ async def async_setup_entry( def cmd( - func: Callable[Concatenate[_T, _P], Awaitable[None]] + func: Callable[Concatenate[_T, _P], Awaitable[None]], ) -> Callable[Concatenate[_T, _P], Coroutine[Any, Any, None]]: """Catch command exceptions.""" diff --git a/homeassistant/components/websocket_api/commands.py b/homeassistant/components/websocket_api/commands.py index cb90b46e182b12..dfd04aa001a574 100644 --- a/homeassistant/components/websocket_api/commands.py +++ b/homeassistant/components/websocket_api/commands.py @@ -650,7 +650,7 @@ def _template_listener( def _serialize_entity_sources( - entity_infos: dict[str, entity.EntityInfo] + entity_infos: dict[str, entity.EntityInfo], ) -> dict[str, Any]: """Prepare a websocket response from a dict of entity sources.""" return { diff --git a/homeassistant/components/wled/helpers.py b/homeassistant/components/wled/helpers.py index 85dcf9ca800f75..b4b5ee4c892237 100644 --- a/homeassistant/components/wled/helpers.py +++ b/homeassistant/components/wled/helpers.py @@ -15,7 +15,7 @@ def wled_exception_handler( - func: Callable[Concatenate[_WLEDEntityT, _P], Coroutine[Any, Any, Any]] + func: Callable[Concatenate[_WLEDEntityT, _P], Coroutine[Any, Any, Any]], ) -> Callable[Concatenate[_WLEDEntityT, _P], Coroutine[Any, Any, None]]: """Decorate WLED calls to handle WLED exceptions. diff --git a/homeassistant/components/zeroconf/__init__.py b/homeassistant/components/zeroconf/__init__.py index 5cf068e2d70af1..a20924b268ab08 100644 --- a/homeassistant/components/zeroconf/__init__.py +++ b/homeassistant/components/zeroconf/__init__.py @@ -248,7 +248,7 @@ async def _async_zeroconf_hass_stop(_event: Event) -> None: def _build_homekit_model_lookups( - homekit_models: dict[str, HomeKitDiscoveredIntegration] + homekit_models: dict[str, HomeKitDiscoveredIntegration], ) -> tuple[ dict[str, HomeKitDiscoveredIntegration], dict[re.Pattern, HomeKitDiscoveredIntegration], diff --git a/homeassistant/components/zwave_js/helpers.py b/homeassistant/components/zwave_js/helpers.py index 65c77f8ab2d87b..a211832039b839 100644 --- a/homeassistant/components/zwave_js/helpers.py +++ b/homeassistant/components/zwave_js/helpers.py @@ -457,7 +457,7 @@ def remove_keys_with_empty_values(config: ConfigType) -> ConfigType: def check_type_schema_map( - schema_map: dict[str, vol.Schema] + schema_map: dict[str, vol.Schema], ) -> Callable[[ConfigType], ConfigType]: """Check type specific schema against config.""" diff --git a/homeassistant/components/zwave_js/services.py b/homeassistant/components/zwave_js/services.py index 12c1ed242afbfb..9b4f9827c1dbe1 100644 --- a/homeassistant/components/zwave_js/services.py +++ b/homeassistant/components/zwave_js/services.py @@ -49,7 +49,7 @@ def parameter_name_does_not_need_bitmask( - val: dict[str, int | str | list[str]] + val: dict[str, int | str | list[str]], ) -> dict[str, int | str | list[str]]: """Validate that if a parameter name is provided, bitmask is not as well.""" if ( diff --git a/homeassistant/config.py b/homeassistant/config.py index 95dd42737a0657..d5b6864c937992 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -155,7 +155,7 @@ class IntegrationConfigInfo: def _no_duplicate_auth_provider( - configs: Sequence[dict[str, Any]] + configs: Sequence[dict[str, Any]], ) -> Sequence[dict[str, Any]]: """No duplicate auth provider config allowed in a list. @@ -176,7 +176,7 @@ def _no_duplicate_auth_provider( def _no_duplicate_auth_mfa_module( - configs: Sequence[dict[str, Any]] + configs: Sequence[dict[str, Any]], ) -> Sequence[dict[str, Any]]: """No duplicate auth mfa module item allowed in a list. diff --git a/homeassistant/helpers/entityfilter.py b/homeassistant/helpers/entityfilter.py index 1a449ec15f0f36..dd61357f53eb00 100644 --- a/homeassistant/helpers/entityfilter.py +++ b/homeassistant/helpers/entityfilter.py @@ -93,7 +93,7 @@ def convert_filter(config: dict[str, list[str]]) -> EntityFilter: def convert_include_exclude_filter( - config: dict[str, dict[str, list[str]]] + config: dict[str, dict[str, list[str]]], ) -> EntityFilter: """Convert the include exclude filter schema into a filter.""" include = config[CONF_INCLUDE] diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py index 1de7a6c6a43b04..02add8ff0121a3 100644 --- a/homeassistant/helpers/event.py +++ b/homeassistant/helpers/event.py @@ -136,7 +136,7 @@ class EventStateChangedData(TypedDict): def threaded_listener_factory( - async_factory: Callable[Concatenate[HomeAssistant, _P], Any] + async_factory: Callable[Concatenate[HomeAssistant, _P], Any], ) -> Callable[Concatenate[HomeAssistant, _P], CALLBACK_TYPE]: """Convert an async event helper to a threaded one.""" diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py index 2ada25bd4cd129..b7a81c3fb194cf 100644 --- a/homeassistant/helpers/service.py +++ b/homeassistant/helpers/service.py @@ -998,7 +998,7 @@ def verify_domain_control( """Ensure permission to access any entity under domain in service call.""" def decorator( - service_handler: Callable[[ServiceCall], Any] + service_handler: Callable[[ServiceCall], Any], ) -> Callable[[ServiceCall], Any]: """Decorate.""" if not asyncio.iscoroutinefunction(service_handler): diff --git a/homeassistant/helpers/translation.py b/homeassistant/helpers/translation.py index d6a31085cfbeab..eac5cdb0a3fcf6 100644 --- a/homeassistant/helpers/translation.py +++ b/homeassistant/helpers/translation.py @@ -67,7 +67,7 @@ def component_translation_path( def load_translations_files( - translation_files: dict[str, str] + translation_files: dict[str, str], ) -> dict[str, dict[str, Any]]: """Load and parse translation.json files.""" loaded = {} diff --git a/homeassistant/util/logging.py b/homeassistant/util/logging.py index 300b9ced616b32..0f86cde50fe506 100644 --- a/homeassistant/util/logging.py +++ b/homeassistant/util/logging.py @@ -189,7 +189,7 @@ async def coro_wrapper(*args: *_Ts) -> _T | None: def async_create_catching_coro( - target: Coroutine[Any, Any, _T] + target: Coroutine[Any, Any, _T], ) -> Coroutine[Any, Any, _T | None]: """Wrap a coroutine to catch and log exceptions. diff --git a/pyproject.toml b/pyproject.toml index 304d2844cad955..f92baa712882f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -582,7 +582,6 @@ select = [ "G", # flake8-logging-format "I", # isort "ICN001", # import concentions; {name} should be imported as {asname} - "ISC001", # Implicitly concatenated string literals on one line "N804", # First argument of a class method should be named cls "N805", # First argument of a method should be named self "N815", # Variable {name} in class scope should not be mixedCase @@ -658,6 +657,21 @@ ignore = [ # Ignored due to performance: https://github.com/charliermarsh/ruff/issues/2923 "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` + # May conflict with the formatter, https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", ] [tool.ruff.flake8-import-conventions.extend-aliases] diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index c797db4b7a38c3..a02eed66ffa50e 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -1,5 +1,5 @@ # Automatically generated from .pre-commit-config.yaml by gen_requirements_all.py, do not edit codespell==2.2.2 -ruff==0.1.6 +ruff==0.1.8 yamllint==1.32.0 diff --git a/tests/common.py b/tests/common.py index c402f2aa661b17..b07788dc3d73a3 100644 --- a/tests/common.py +++ b/tests/common.py @@ -1225,7 +1225,7 @@ def _handle(self, attr: str) -> Any: @contextmanager def mock_storage( - data: dict[str, Any] | None = None + data: dict[str, Any] | None = None, ) -> Generator[dict[str, Any], None, None]: """Mock storage. diff --git a/tests/components/cast/test_media_player.py b/tests/components/cast/test_media_player.py index 2af5e67f845c50..55e4d8d5c65ac3 100644 --- a/tests/components/cast/test_media_player.py +++ b/tests/components/cast/test_media_player.py @@ -2285,7 +2285,6 @@ async def test_cast_platform_play_media_local_media( quick_play_mock.assert_called() app_data = quick_play_mock.call_args[0][2] # No authSig appended - assert ( - app_data["media_id"] - == f"{network.get_url(hass)}/api/hls/bla/master_playlist.m3u8?token=bla" - ) + assert app_data[ + "media_id" + ] == f"{network.get_url(hass)}/api/hls/bla/master_playlist.m3u8?token=bla" diff --git a/tests/components/esphome/conftest.py b/tests/components/esphome/conftest.py index d31eb70a0b4e85..3b37902fb3dfa0 100644 --- a/tests/components/esphome/conftest.py +++ b/tests/components/esphome/conftest.py @@ -320,7 +320,7 @@ async def mock_bluetooth_entry( """Set up an ESPHome entry with bluetooth.""" async def _mock_bluetooth_entry( - bluetooth_proxy_feature_flags: BluetoothProxyFeature + bluetooth_proxy_feature_flags: BluetoothProxyFeature, ) -> MockESPHomeDevice: return await _mock_generic_device_entry( hass, @@ -348,7 +348,7 @@ async def mock_bluetooth_entry_with_raw_adv(mock_bluetooth_entry) -> MockESPHome @pytest.fixture async def mock_bluetooth_entry_with_legacy_adv( - mock_bluetooth_entry + mock_bluetooth_entry, ) -> MockESPHomeDevice: """Set up an ESPHome entry with bluetooth with legacy advertisements.""" return await mock_bluetooth_entry( diff --git a/tests/components/fronius/__init__.py b/tests/components/fronius/__init__.py index c64972b7904950..1255ba79388046 100644 --- a/tests/components/fronius/__init__.py +++ b/tests/components/fronius/__init__.py @@ -37,7 +37,7 @@ async def setup_fronius_integration( def _load_and_patch_fixture( - override_data: dict[str, list[tuple[list[str], Any]]] + override_data: dict[str, list[tuple[list[str], Any]]], ) -> Callable[[str, str | None], str]: """Return a fixture loader that patches values at nested keys for a given filename.""" diff --git a/tests/components/google/conftest.py b/tests/components/google/conftest.py index 3b2ed6d24e19aa..4196604b5d4d6c 100644 --- a/tests/components/google/conftest.py +++ b/tests/components/google/conftest.py @@ -260,7 +260,7 @@ def _put_result( @pytest.fixture def mock_events_list_items( - mock_events_list: Callable[[dict[str, Any]], None] + mock_events_list: Callable[[dict[str, Any]], None], ) -> Callable[[list[dict[str, Any]]], None]: """Fixture to construct an API response containing event items.""" diff --git a/tests/components/homekit_controller/test_climate.py b/tests/components/homekit_controller/test_climate.py index c3882553ea0294..e4fe754013a8e5 100644 --- a/tests/components/homekit_controller/test_climate.py +++ b/tests/components/homekit_controller/test_climate.py @@ -277,7 +277,7 @@ async def test_climate_change_thermostat_temperature_range(hass: HomeAssistant) async def test_climate_change_thermostat_temperature_range_iphone( - hass: HomeAssistant + hass: HomeAssistant, ) -> None: """Test that we can set all three set points at once (iPhone heat_cool mode support).""" helper = await setup_test_component(hass, create_thermostat_service) @@ -312,7 +312,7 @@ async def test_climate_change_thermostat_temperature_range_iphone( async def test_climate_cannot_set_thermostat_temp_range_in_wrong_mode( - hass: HomeAssistant + hass: HomeAssistant, ) -> None: """Test that we cannot set range values when not in heat_cool mode.""" helper = await setup_test_component(hass, create_thermostat_service) @@ -371,7 +371,7 @@ def create_thermostat_single_set_point_auto(accessory): async def test_climate_check_min_max_values_per_mode_sspa_device( - hass: HomeAssistant + hass: HomeAssistant, ) -> None: """Test appropriate min/max values for each mode on sspa devices.""" helper = await setup_test_component(hass, create_thermostat_single_set_point_auto) diff --git a/tests/components/homekit_controller/test_fan.py b/tests/components/homekit_controller/test_fan.py index 7afadadcd98787..938f09c453ef0a 100644 --- a/tests/components/homekit_controller/test_fan.py +++ b/tests/components/homekit_controller/test_fan.py @@ -749,7 +749,7 @@ async def test_v2_oscillate_read(hass: HomeAssistant) -> None: async def test_v2_set_percentage_non_standard_rotation_range( - hass: HomeAssistant + hass: HomeAssistant, ) -> None: """Test that we set fan speed with a non-standard rotation range.""" helper = await setup_test_component( diff --git a/tests/components/hydrawise/conftest.py b/tests/components/hydrawise/conftest.py index 1f89278581232c..8e22fbe84f7b2c 100644 --- a/tests/components/hydrawise/conftest.py +++ b/tests/components/hydrawise/conftest.py @@ -116,7 +116,7 @@ def mock_config_entry() -> MockConfigEntry: @pytest.fixture async def mock_added_config_entry( - mock_add_config_entry: Callable[[], Awaitable[MockConfigEntry]] + mock_add_config_entry: Callable[[], Awaitable[MockConfigEntry]], ) -> MockConfigEntry: """Mock ConfigEntry that's been added to HA.""" return await mock_add_config_entry() diff --git a/tests/components/improv_ble/test_config_flow.py b/tests/components/improv_ble/test_config_flow.py index f0c77c9bce3a06..e333071b0bdabc 100644 --- a/tests/components/improv_ble/test_config_flow.py +++ b/tests/components/improv_ble/test_config_flow.py @@ -302,7 +302,7 @@ async def _test_common_success_w_authorize( """Test bluetooth and user flow success paths.""" async def subscribe_state_updates( - state_callback: Callable[[State], None] + state_callback: Callable[[State], None], ) -> Callable[[], None]: state_callback(State.AUTHORIZED) return lambda: None @@ -612,7 +612,7 @@ async def test_provision_not_authorized(hass: HomeAssistant, exc, error) -> None """Test bluetooth flow with error.""" async def subscribe_state_updates( - state_callback: Callable[[State], None] + state_callback: Callable[[State], None], ) -> Callable[[], None]: state_callback(State.AUTHORIZED) return lambda: None diff --git a/tests/components/picnic/conftest.py b/tests/components/picnic/conftest.py index 1ca6413fc42b13..5bb84c7a1c1dbd 100644 --- a/tests/components/picnic/conftest.py +++ b/tests/components/picnic/conftest.py @@ -58,7 +58,7 @@ async def init_integration( @pytest.fixture async def get_items( - hass_ws_client: WebSocketGenerator + hass_ws_client: WebSocketGenerator, ) -> Callable[[], Awaitable[dict[str, str]]]: """Fixture to fetch items from the todo websocket.""" diff --git a/tests/components/rainbird/test_calendar.py b/tests/components/rainbird/test_calendar.py index 922ec7b0a5a4d1..44baf09fd55de0 100644 --- a/tests/components/rainbird/test_calendar.py +++ b/tests/components/rainbird/test_calendar.py @@ -115,7 +115,7 @@ def mock_insert_schedule_response( @pytest.fixture(name="get_events") def get_events_fixture( - hass_client: Callable[..., Awaitable[ClientSession]] + hass_client: Callable[..., Awaitable[ClientSession]], ) -> GetEventsFn: """Fetch calendar events from the HTTP API.""" diff --git a/tests/components/recorder/test_history.py b/tests/components/recorder/test_history.py index 21016a65cc2ed9..21af6b011829e4 100644 --- a/tests/components/recorder/test_history.py +++ b/tests/components/recorder/test_history.py @@ -118,7 +118,7 @@ def _add_db_entries( def test_get_full_significant_states_with_session_entity_no_matches( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test getting states at a specific point in time for entities that never have been recorded.""" hass = hass_recorder() @@ -246,7 +246,7 @@ def set_state(state): def test_state_changes_during_period_descending( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test state change during period descending.""" hass = hass_recorder() @@ -410,7 +410,7 @@ def set_state(state): def test_ensure_state_can_be_copied( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Ensure a state can pass though copy(). @@ -455,7 +455,7 @@ def test_get_significant_states(hass_recorder: Callable[..., HomeAssistant]) -> def test_get_significant_states_minimal_response( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned. @@ -554,7 +554,7 @@ def test_get_significant_states_with_initial( def test_get_significant_states_without_initial( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned. @@ -588,7 +588,7 @@ def test_get_significant_states_without_initial( def test_get_significant_states_entity_id( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned for one entity.""" hass = hass_recorder() @@ -604,7 +604,7 @@ def test_get_significant_states_entity_id( def test_get_significant_states_multiple_entity_ids( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned for one entity.""" hass = hass_recorder() @@ -626,7 +626,7 @@ def test_get_significant_states_multiple_entity_ids( def test_get_significant_states_are_ordered( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test order of results from get_significant_states. @@ -644,7 +644,7 @@ def test_get_significant_states_are_ordered( def test_get_significant_states_only( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test significant states when significant_states_only is set.""" hass = hass_recorder() @@ -1082,7 +1082,7 @@ def _fetch_db_states() -> list[States]: def test_state_changes_during_period_multiple_entities_single_test( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test state change during period with multiple entities in the same test. @@ -1141,7 +1141,7 @@ def _get_entries(): def test_get_significant_states_without_entity_ids_raises( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test at least one entity id is required for get_significant_states.""" hass = hass_recorder() @@ -1151,7 +1151,7 @@ def test_get_significant_states_without_entity_ids_raises( def test_state_changes_during_period_without_entity_ids_raises( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test at least one entity id is required for state_changes_during_period.""" hass = hass_recorder() @@ -1161,7 +1161,7 @@ def test_state_changes_during_period_without_entity_ids_raises( def test_get_significant_states_with_filters_raises( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test passing filters is no longer supported.""" hass = hass_recorder() @@ -1173,7 +1173,7 @@ def test_get_significant_states_with_filters_raises( def test_get_significant_states_with_non_existent_entity_ids_returns_empty( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test get_significant_states returns an empty dict when entities not in the db.""" hass = hass_recorder() @@ -1182,7 +1182,7 @@ def test_get_significant_states_with_non_existent_entity_ids_returns_empty( def test_state_changes_during_period_with_non_existent_entity_ids_returns_empty( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test state_changes_during_period returns an empty dict when entities not in the db.""" hass = hass_recorder() @@ -1193,7 +1193,7 @@ def test_state_changes_during_period_with_non_existent_entity_ids_returns_empty( def test_get_last_state_changes_with_non_existent_entity_ids_returns_empty( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test get_last_state_changes returns an empty dict when entities not in the db.""" hass = hass_recorder() diff --git a/tests/components/recorder/test_history_db_schema_30.py b/tests/components/recorder/test_history_db_schema_30.py index 0ed6061de98235..4f75dc15b15032 100644 --- a/tests/components/recorder/test_history_db_schema_30.py +++ b/tests/components/recorder/test_history_db_schema_30.py @@ -37,7 +37,7 @@ def db_schema_30(): def test_get_full_significant_states_with_session_entity_no_matches( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test getting states at a specific point in time for entities that never have been recorded.""" hass = hass_recorder() @@ -152,7 +152,7 @@ def set_state(state): def test_state_changes_during_period_descending( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test state change during period descending.""" hass = hass_recorder() @@ -240,7 +240,7 @@ def set_state(state): def test_ensure_state_can_be_copied( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Ensure a state can pass though copy(). @@ -293,7 +293,7 @@ def test_get_significant_states(hass_recorder: Callable[..., HomeAssistant]) -> def test_get_significant_states_minimal_response( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned. @@ -362,7 +362,7 @@ def test_get_significant_states_minimal_response( def test_get_significant_states_with_initial( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned. @@ -399,7 +399,7 @@ def test_get_significant_states_with_initial( def test_get_significant_states_without_initial( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned. @@ -435,7 +435,7 @@ def test_get_significant_states_without_initial( def test_get_significant_states_entity_id( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned for one entity.""" hass = hass_recorder() @@ -453,7 +453,7 @@ def test_get_significant_states_entity_id( def test_get_significant_states_multiple_entity_ids( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned for one entity.""" hass = hass_recorder() @@ -480,7 +480,7 @@ def test_get_significant_states_multiple_entity_ids( def test_get_significant_states_are_ordered( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test order of results from get_significant_states. @@ -501,7 +501,7 @@ def test_get_significant_states_are_ordered( def test_get_significant_states_only( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test significant states when significant_states_only is set.""" hass = hass_recorder() @@ -644,7 +644,7 @@ def set_state(entity_id, state, **kwargs): def test_state_changes_during_period_multiple_entities_single_test( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test state change during period with multiple entities in the same test. @@ -669,7 +669,7 @@ def test_state_changes_during_period_multiple_entities_single_test( def test_get_significant_states_without_entity_ids_raises( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test at least one entity id is required for get_significant_states.""" hass = hass_recorder() @@ -679,7 +679,7 @@ def test_get_significant_states_without_entity_ids_raises( def test_state_changes_during_period_without_entity_ids_raises( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test at least one entity id is required for state_changes_during_period.""" hass = hass_recorder() @@ -689,7 +689,7 @@ def test_state_changes_during_period_without_entity_ids_raises( def test_get_significant_states_with_filters_raises( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test passing filters is no longer supported.""" hass = hass_recorder() @@ -701,7 +701,7 @@ def test_get_significant_states_with_filters_raises( def test_get_significant_states_with_non_existent_entity_ids_returns_empty( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test get_significant_states returns an empty dict when entities not in the db.""" hass = hass_recorder() @@ -710,7 +710,7 @@ def test_get_significant_states_with_non_existent_entity_ids_returns_empty( def test_state_changes_during_period_with_non_existent_entity_ids_returns_empty( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test state_changes_during_period returns an empty dict when entities not in the db.""" hass = hass_recorder() @@ -721,7 +721,7 @@ def test_state_changes_during_period_with_non_existent_entity_ids_returns_empty( def test_get_last_state_changes_with_non_existent_entity_ids_returns_empty( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test get_last_state_changes returns an empty dict when entities not in the db.""" hass = hass_recorder() diff --git a/tests/components/recorder/test_history_db_schema_32.py b/tests/components/recorder/test_history_db_schema_32.py index 5b721cd4c87ed3..477c13d61669ca 100644 --- a/tests/components/recorder/test_history_db_schema_32.py +++ b/tests/components/recorder/test_history_db_schema_32.py @@ -37,7 +37,7 @@ def db_schema_32(): def test_get_full_significant_states_with_session_entity_no_matches( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test getting states at a specific point in time for entities that never have been recorded.""" hass = hass_recorder() @@ -152,7 +152,7 @@ def set_state(state): def test_state_changes_during_period_descending( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test state change during period descending.""" hass = hass_recorder() @@ -239,7 +239,7 @@ def set_state(state): def test_ensure_state_can_be_copied( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Ensure a state can pass though copy(). @@ -292,7 +292,7 @@ def test_get_significant_states(hass_recorder: Callable[..., HomeAssistant]) -> def test_get_significant_states_minimal_response( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned. @@ -389,7 +389,7 @@ def test_get_significant_states_with_initial( def test_get_significant_states_without_initial( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned. @@ -425,7 +425,7 @@ def test_get_significant_states_without_initial( def test_get_significant_states_entity_id( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned for one entity.""" hass = hass_recorder() @@ -443,7 +443,7 @@ def test_get_significant_states_entity_id( def test_get_significant_states_multiple_entity_ids( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that only significant states are returned for one entity.""" hass = hass_recorder() @@ -470,7 +470,7 @@ def test_get_significant_states_multiple_entity_ids( def test_get_significant_states_are_ordered( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test order of results from get_significant_states. @@ -491,7 +491,7 @@ def test_get_significant_states_are_ordered( def test_get_significant_states_only( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test significant states when significant_states_only is set.""" hass = hass_recorder() @@ -634,7 +634,7 @@ def set_state(entity_id, state, **kwargs): def test_state_changes_during_period_multiple_entities_single_test( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test state change during period with multiple entities in the same test. @@ -659,7 +659,7 @@ def test_state_changes_during_period_multiple_entities_single_test( def test_get_significant_states_without_entity_ids_raises( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test at least one entity id is required for get_significant_states.""" hass = hass_recorder() @@ -669,7 +669,7 @@ def test_get_significant_states_without_entity_ids_raises( def test_state_changes_during_period_without_entity_ids_raises( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test at least one entity id is required for state_changes_during_period.""" hass = hass_recorder() @@ -679,7 +679,7 @@ def test_state_changes_during_period_without_entity_ids_raises( def test_get_significant_states_with_filters_raises( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test passing filters is no longer supported.""" hass = hass_recorder() @@ -691,7 +691,7 @@ def test_get_significant_states_with_filters_raises( def test_get_significant_states_with_non_existent_entity_ids_returns_empty( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test get_significant_states returns an empty dict when entities not in the db.""" hass = hass_recorder() @@ -700,7 +700,7 @@ def test_get_significant_states_with_non_existent_entity_ids_returns_empty( def test_state_changes_during_period_with_non_existent_entity_ids_returns_empty( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test state_changes_during_period returns an empty dict when entities not in the db.""" hass = hass_recorder() @@ -711,7 +711,7 @@ def test_state_changes_during_period_with_non_existent_entity_ids_returns_empty( def test_get_last_state_changes_with_non_existent_entity_ids_returns_empty( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test get_last_state_changes returns an empty dict when entities not in the db.""" hass = hass_recorder() diff --git a/tests/components/recorder/test_init.py b/tests/components/recorder/test_init.py index 0dfbb6005c43f6..a9a12d72c415fd 100644 --- a/tests/components/recorder/test_init.py +++ b/tests/components/recorder/test_init.py @@ -537,7 +537,7 @@ def event_listener(event): def test_saving_state_with_commit_interval_zero( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving a state with a commit interval of zero.""" hass = hass_recorder({"commit_interval": 0}) @@ -594,7 +594,7 @@ def test_setup_without_migration(hass_recorder: Callable[..., HomeAssistant]) -> def test_saving_state_include_domains( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving and restoring a state.""" hass = hass_recorder({"include": {"domains": "test2"}}) @@ -604,7 +604,7 @@ def test_saving_state_include_domains( def test_saving_state_include_domains_globs( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving and restoring a state.""" hass = hass_recorder( @@ -627,7 +627,7 @@ def test_saving_state_include_domains_globs( def test_saving_state_incl_entities( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving and restoring a state.""" hass = hass_recorder({"include": {"entities": "test2.recorder"}}) @@ -688,7 +688,7 @@ def _get_events(hass: HomeAssistant, event_types: list[str]) -> list[Event]: def test_saving_state_exclude_domains( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving and restoring a state.""" hass = hass_recorder({"exclude": {"domains": "test"}}) @@ -698,7 +698,7 @@ def test_saving_state_exclude_domains( def test_saving_state_exclude_domains_globs( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving and restoring a state.""" hass = hass_recorder( @@ -712,7 +712,7 @@ def test_saving_state_exclude_domains_globs( def test_saving_state_exclude_entities( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving and restoring a state.""" hass = hass_recorder({"exclude": {"entities": "test.recorder"}}) @@ -722,7 +722,7 @@ def test_saving_state_exclude_entities( def test_saving_state_exclude_domain_include_entity( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving and restoring a state.""" hass = hass_recorder( @@ -733,7 +733,7 @@ def test_saving_state_exclude_domain_include_entity( def test_saving_state_exclude_domain_glob_include_entity( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving and restoring a state.""" hass = hass_recorder( @@ -749,7 +749,7 @@ def test_saving_state_exclude_domain_glob_include_entity( def test_saving_state_include_domain_exclude_entity( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving and restoring a state.""" hass = hass_recorder( @@ -762,7 +762,7 @@ def test_saving_state_include_domain_exclude_entity( def test_saving_state_include_domain_glob_exclude_entity( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving and restoring a state.""" hass = hass_recorder( @@ -780,7 +780,7 @@ def test_saving_state_include_domain_glob_exclude_entity( def test_saving_state_and_removing_entity( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test saving the state of a removed entity.""" hass = hass_recorder() @@ -1025,7 +1025,7 @@ def test_auto_purge(hass_recorder: Callable[..., HomeAssistant]) -> None: @pytest.mark.parametrize("enable_nightly_purge", [True]) def test_auto_purge_auto_repack_on_second_sunday( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test periodic purge scheduling does a repack on the 2nd sunday.""" hass = hass_recorder() @@ -1065,7 +1065,7 @@ def test_auto_purge_auto_repack_on_second_sunday( @pytest.mark.parametrize("enable_nightly_purge", [True]) def test_auto_purge_auto_repack_disabled_on_second_sunday( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test periodic purge scheduling does not auto repack on the 2nd sunday if disabled.""" hass = hass_recorder({CONF_AUTO_REPACK: False}) @@ -1105,7 +1105,7 @@ def test_auto_purge_auto_repack_disabled_on_second_sunday( @pytest.mark.parametrize("enable_nightly_purge", [True]) def test_auto_purge_no_auto_repack_on_not_second_sunday( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test periodic purge scheduling does not do a repack unless its the 2nd sunday.""" hass = hass_recorder() @@ -1431,7 +1431,7 @@ def test_has_services(hass_recorder: Callable[..., HomeAssistant]) -> None: def test_service_disable_events_not_recording( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that events are not recorded when recorder is disabled using service.""" hass = hass_recorder() @@ -1515,7 +1515,7 @@ def event_listener(event): def test_service_disable_states_not_recording( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test that state changes are not recorded when recorder is disabled using service.""" hass = hass_recorder() diff --git a/tests/components/recorder/test_statistics.py b/tests/components/recorder/test_statistics.py index 03dc7b84caa570..69b7f9316f7b98 100644 --- a/tests/components/recorder/test_statistics.py +++ b/tests/components/recorder/test_statistics.py @@ -432,7 +432,7 @@ def rename_entry(): def test_statistics_during_period_set_back_compat( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test statistics_during_period can handle a list instead of a set.""" hass = hass_recorder() diff --git a/tests/components/recorder/test_util.py b/tests/components/recorder/test_util.py index 0a30895adc98d5..66daced2ca8148 100644 --- a/tests/components/recorder/test_util.py +++ b/tests/components/recorder/test_util.py @@ -883,7 +883,7 @@ def test_build_mysqldb_conv() -> None: @patch("homeassistant.components.recorder.util.QUERY_RETRY_WAIT", 0) def test_execute_stmt_lambda_element( - hass_recorder: Callable[..., HomeAssistant] + hass_recorder: Callable[..., HomeAssistant], ) -> None: """Test executing with execute_stmt_lambda_element.""" hass = hass_recorder() diff --git a/tests/components/samsungtv/conftest.py b/tests/components/samsungtv/conftest.py index 874697bf777c1c..6754faf2da6e18 100644 --- a/tests/components/samsungtv/conftest.py +++ b/tests/components/samsungtv/conftest.py @@ -233,7 +233,7 @@ def remotews_fixture() -> Mock: remotews.app_list_data = None async def _start_listening( - ws_event_callback: Callable[[str, Any], Awaitable[None] | None] | None = None + ws_event_callback: Callable[[str, Any], Awaitable[None] | None] | None = None, ): remotews.ws_event_callback = ws_event_callback @@ -272,7 +272,7 @@ def remoteencws_fixture() -> Mock: remoteencws.__aexit__ = AsyncMock() def _start_listening( - ws_event_callback: Callable[[str, Any], Awaitable[None] | None] | None = None + ws_event_callback: Callable[[str, Any], Awaitable[None] | None] | None = None, ): remoteencws.ws_event_callback = ws_event_callback diff --git a/tests/components/zha/test_cluster_handlers.py b/tests/components/zha/test_cluster_handlers.py index 24162296cd504a..e3d5741acd83f1 100644 --- a/tests/components/zha/test_cluster_handlers.py +++ b/tests/components/zha/test_cluster_handlers.py @@ -731,7 +731,7 @@ async def test_zll_device_groups( mock.MagicMock(), ) async def test_cluster_no_ep_attribute( - zha_device_mock: Callable[..., ZHADevice] + zha_device_mock: Callable[..., ZHADevice], ) -> None: """Test cluster handlers for clusters without ep_attribute.""" diff --git a/tests/conftest.py b/tests/conftest.py index 696a5a2ed1599b..ea4ddd23d28888 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -973,7 +973,7 @@ async def _mqtt_mock_entry( mock_mqtt_instance = None async def _setup_mqtt_entry( - setup_entry: Callable[[HomeAssistant, ConfigEntry], Coroutine[Any, Any, bool]] + setup_entry: Callable[[HomeAssistant, ConfigEntry], Coroutine[Any, Any, bool]], ) -> MagicMock: """Set up the MQTT config entry.""" assert await setup_entry(hass, entry) diff --git a/tests/helpers/test_deprecation.py b/tests/helpers/test_deprecation.py index 6816c7701aadcd..cb90d8e2bed405 100644 --- a/tests/helpers/test_deprecation.py +++ b/tests/helpers/test_deprecation.py @@ -325,7 +325,7 @@ def test_check_if_deprecated_constant( def test_test_check_if_deprecated_constant_invalid( - caplog: pytest.LogCaptureFixture + caplog: pytest.LogCaptureFixture, ) -> None: """Test check_if_deprecated_constant will raise an attribute error and create an log entry on an invalid deprecation type.""" module_name = "homeassistant.components.hue.light"