From 44beb350cd4a79ae75ce333fd48433950fb7632d Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 24 Jan 2023 14:11:56 +0100 Subject: [PATCH] Add scrape to strict-typing (#86515) --- .strict-typing | 1 + homeassistant/components/scrape/config_flow.py | 6 +++--- mypy.ini | 10 ++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.strict-typing b/.strict-typing index 8ad4c644110..45f060c6690 100644 --- a/.strict-typing +++ b/.strict-typing @@ -256,6 +256,7 @@ homeassistant.components.ruuvitag_ble.* homeassistant.components.samsungtv.* homeassistant.components.scene.* homeassistant.components.schedule.* +homeassistant.components.scrape.* homeassistant.components.select.* homeassistant.components.senseme.* homeassistant.components.sensibo.* diff --git a/homeassistant/components/scrape/config_flow.py b/homeassistant/components/scrape/config_flow.py index cbd0ed7d525..419dd04f606 100644 --- a/homeassistant/components/scrape/config_flow.py +++ b/homeassistant/components/scrape/config_flow.py @@ -2,7 +2,7 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any +from typing import Any, cast import uuid import voluptuous as vol @@ -172,7 +172,7 @@ async def get_edit_sensor_suggested_values( ) -> dict[str, Any]: """Return suggested values for sensor editing.""" idx: int = handler.flow_state["_idx"] - return handler.options[SENSOR_DOMAIN][idx] + return cast(dict[str, Any], handler.options[SENSOR_DOMAIN][idx]) async def validate_sensor_edit( @@ -284,4 +284,4 @@ class ScrapeConfigFlowHandler(SchemaConfigFlowHandler, domain=DOMAIN): def async_config_entry_title(self, options: Mapping[str, Any]) -> str: """Return config entry title.""" - return options[CONF_RESOURCE] + return cast(str, options[CONF_RESOURCE]) diff --git a/mypy.ini b/mypy.ini index 7212592dcdd..e9cfe18f9ce 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2314,6 +2314,16 @@ disallow_untyped_defs = true warn_return_any = true warn_unreachable = true +[mypy-homeassistant.components.scrape.*] +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +warn_return_any = true +warn_unreachable = true + [mypy-homeassistant.components.select.*] check_untyped_defs = true disallow_incomplete_defs = true