Adjust diagnostics return types (#85525)
* Adjust diagnostics return types * Replace dict with Mapping
This commit is contained in:
parent
9927bb3330
commit
1deb4c68f3
2 changed files with 9 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
|||
"""The Diagnostics integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable, Coroutine
|
||||
from collections.abc import Callable, Coroutine, Mapping
|
||||
from dataclasses import dataclass, field
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
|
@ -38,10 +38,11 @@ class DiagnosticsPlatformData:
|
|||
"""Diagnostic platform data."""
|
||||
|
||||
config_entry_diagnostics: Callable[
|
||||
[HomeAssistant, ConfigEntry], Coroutine[Any, Any, Any]
|
||||
[HomeAssistant, ConfigEntry], Coroutine[Any, Any, Mapping[str, Any]]
|
||||
] | None
|
||||
device_diagnostics: Callable[
|
||||
[HomeAssistant, ConfigEntry, DeviceEntry], Coroutine[Any, Any, Any]
|
||||
[HomeAssistant, ConfigEntry, DeviceEntry],
|
||||
Coroutine[Any, Any, Mapping[str, Any]],
|
||||
] | None
|
||||
|
||||
|
||||
|
@ -72,12 +73,12 @@ class DiagnosticsProtocol(Protocol):
|
|||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry
|
||||
) -> Any:
|
||||
) -> Mapping[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry, device: DeviceEntry
|
||||
) -> Any:
|
||||
) -> Mapping[str, Any]:
|
||||
"""Return diagnostics for a device."""
|
||||
|
||||
|
||||
|
@ -148,7 +149,7 @@ def handle_get(
|
|||
|
||||
async def _async_get_json_file_response(
|
||||
hass: HomeAssistant,
|
||||
data: Any,
|
||||
data: Mapping[str, Any],
|
||||
filename: str,
|
||||
domain: str,
|
||||
d_id: str,
|
||||
|
|
|
@ -375,7 +375,7 @@ _FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = {
|
|||
0: "HomeAssistant",
|
||||
1: "ConfigEntry",
|
||||
},
|
||||
return_type=_Special.UNDEFINED,
|
||||
return_type="Mapping[str, Any]",
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="async_get_device_diagnostics",
|
||||
|
@ -384,7 +384,7 @@ _FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = {
|
|||
1: "ConfigEntry",
|
||||
2: "DeviceEntry",
|
||||
},
|
||||
return_type=_Special.UNDEFINED,
|
||||
return_type="Mapping[str, Any]",
|
||||
),
|
||||
],
|
||||
"notify": [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue