diff --git a/.strict-typing b/.strict-typing index 9f91b5ab699b51e92f0ab370defccb58dc9b29dc..4b0d03ef095b55f009fb2aa7c9d8c78b00a0828c 100644 --- a/.strict-typing +++ b/.strict-typing @@ -354,6 +354,7 @@ homeassistant.components.samsungtv.* homeassistant.components.scene.* homeassistant.components.schedule.* homeassistant.components.scrape.* +homeassistant.components.search.* homeassistant.components.select.* homeassistant.components.sensibo.* homeassistant.components.sensirion_ble.* diff --git a/homeassistant/components/search/__init__.py b/homeassistant/components/search/__init__.py index ac9a13850d6329081c697b59af3b30f2cb5407a3..7dd7d952e9516873c5d0506f3066ded94734b7ec 100644 --- a/homeassistant/components/search/__init__.py +++ b/homeassistant/components/search/__init__.py @@ -111,7 +111,7 @@ class Searcher: self._to_resolve: deque[tuple[str, str]] = deque() @callback - def async_search(self, item_type, item_id): + def async_search(self, item_type: str, item_id: str) -> dict[str, set[str]]: """Find results.""" _LOGGER.debug("Searching for %s/%s", item_type, item_id) self.results[item_type].add(item_id) @@ -140,7 +140,7 @@ class Searcher: return {key: val for key, val in self.results.items() if val} @callback - def _add_or_resolve(self, item_type, item_id): + def _add_or_resolve(self, item_type: str, item_id: str) -> None: """Add an item to explore.""" if item_id in self.results[item_type]: return @@ -151,7 +151,7 @@ class Searcher: self._to_resolve.append((item_type, item_id)) @callback - def _resolve_area(self, area_id) -> None: + def _resolve_area(self, area_id: str) -> None: """Resolve an area.""" for device in dr.async_entries_for_area(self._device_reg, area_id): self._add_or_resolve("device", device.id) @@ -166,7 +166,7 @@ class Searcher: self._add_or_resolve("entity", entity_id) @callback - def _resolve_automation(self, automation_entity_id) -> None: + def _resolve_automation(self, automation_entity_id: str) -> None: """Resolve an automation. Will only be called if automation is an entry point. @@ -188,7 +188,7 @@ class Searcher: self._add_or_resolve("automation_blueprint", blueprint) @callback - def _resolve_automation_blueprint(self, blueprint_path) -> None: + def _resolve_automation_blueprint(self, blueprint_path: str) -> None: """Resolve an automation blueprint. Will only be called if blueprint is an entry point. @@ -199,7 +199,7 @@ class Searcher: self._add_or_resolve("automation", entity_id) @callback - def _resolve_config_entry(self, config_entry_id) -> None: + def _resolve_config_entry(self, config_entry_id: str) -> None: """Resolve a config entry. Will only be called if config entry is an entry point. @@ -215,7 +215,7 @@ class Searcher: self._add_or_resolve("entity", entity_entry.entity_id) @callback - def _resolve_device(self, device_id) -> None: + def _resolve_device(self, device_id: str) -> None: """Resolve a device.""" device_entry = self._device_reg.async_get(device_id) # Unlikely entry doesn't exist, but let's guard for bad data. @@ -239,7 +239,7 @@ class Searcher: self._add_or_resolve("entity", entity_id) @callback - def _resolve_entity(self, entity_id) -> None: + def _resolve_entity(self, entity_id: str) -> None: """Resolve an entity.""" # Extra: Find automations and scripts that reference this entity. @@ -277,7 +277,7 @@ class Searcher: self._add_or_resolve(domain, entity_id) @callback - def _resolve_group(self, group_entity_id) -> None: + def _resolve_group(self, group_entity_id: str) -> None: """Resolve a group. Will only be called if group is an entry point. @@ -286,7 +286,7 @@ class Searcher: self._add_or_resolve("entity", entity_id) @callback - def _resolve_person(self, person_entity_id) -> None: + def _resolve_person(self, person_entity_id: str) -> None: """Resolve a person. Will only be called if person is an entry point. @@ -295,7 +295,7 @@ class Searcher: self._add_or_resolve("entity", entity) @callback - def _resolve_scene(self, scene_entity_id) -> None: + def _resolve_scene(self, scene_entity_id: str) -> None: """Resolve a scene. Will only be called if scene is an entry point. @@ -304,7 +304,7 @@ class Searcher: self._add_or_resolve("entity", entity) @callback - def _resolve_script(self, script_entity_id) -> None: + def _resolve_script(self, script_entity_id: str) -> None: """Resolve a script. Will only be called if script is an entry point. @@ -322,7 +322,7 @@ class Searcher: self._add_or_resolve("script_blueprint", blueprint) @callback - def _resolve_script_blueprint(self, blueprint_path) -> None: + def _resolve_script_blueprint(self, blueprint_path: str) -> None: """Resolve a script blueprint. Will only be called if blueprint is an entry point. diff --git a/mypy.ini b/mypy.ini index c72aba4e62f8bc9010e9055c631d5822dd955b58..b92bac5e1f71b9dd048a84064a85a880cabc307a 100644 --- a/mypy.ini +++ b/mypy.ini @@ -3301,6 +3301,16 @@ disallow_untyped_defs = true warn_return_any = true warn_unreachable = true +[mypy-homeassistant.components.search.*] +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