Finish migration from report to report_usage

This commit is contained in:
epenet 2024-11-12 08:03:05 +00:00
parent 22aed92461
commit c7d917f582
4 changed files with 9 additions and 12 deletions

View file

@ -505,15 +505,14 @@ class HomeAssistantHTTP:
self, url_path: str, path: str, cache_headers: bool = True
) -> None:
"""Register a folder or file to serve as a static path."""
frame.report(
frame.report_usage(
"calls hass.http.register_static_path which is deprecated because "
"it does blocking I/O in the event loop, instead "
"call `await hass.http.async_register_static_paths("
f'[StaticPathConfig("{url_path}", "{path}", {cache_headers})])`; '
"This function will be removed in 2025.7",
exclude_integrations={"http"},
error_if_core=False,
error_if_integration=False,
core_behavior=frame.ReportBehavior.LOG,
)
configs = [StaticPathConfig(url_path, path, cache_headers)]
resources = self._make_static_resources(configs)

View file

@ -1191,14 +1191,13 @@ class FlowCancelledError(Exception):
def _report_non_awaited_platform_forwards(entry: ConfigEntry, what: str) -> None:
"""Report non awaited platform forwards."""
report(
report_usage(
f"calls {what} for integration {entry.domain} with "
f"title: {entry.title} and entry_id: {entry.entry_id}, "
f"during setup without awaiting {what}, which can cause "
"the setup lock to be released before the setup is done. "
"This will stop working in Home Assistant 2025.1",
error_if_integration=False,
error_if_core=False,
core_behavior=ReportBehavior.LOG,
)
@ -2321,14 +2320,13 @@ class ConfigEntries:
multiple platforms at once and is more efficient since it
does not require a separate import executor job for each platform.
"""
report(
report_usage(
"calls async_forward_entry_setup for "
f"integration, {entry.domain} with title: {entry.title} "
f"and entry_id: {entry.entry_id}, which is deprecated and "
"will stop working in Home Assistant 2025.6, "
"await async_forward_entry_setups instead",
error_if_core=False,
error_if_integration=False,
core_behavior=ReportBehavior.LOG,
)
if not entry.setup_lock.locked():
async with entry.setup_lock:

View file

@ -224,10 +224,10 @@ def async_track_state_change(
Must be run within the event loop.
"""
frame.report(
frame.report_usage(
"calls `async_track_state_change` instead of `async_track_state_change_event`"
" which is deprecated and will be removed in Home Assistant 2025.5",
error_if_core=False,
core_behavior=frame.ReportBehavior.LOG,
)
if from_state is not None:

View file

@ -39,7 +39,7 @@ def create_eager_task[_T](
# pylint: disable-next=import-outside-toplevel
from homeassistant.helpers import frame
frame.report("attempted to create an asyncio task from a thread")
frame.report_usage("attempted to create an asyncio task from a thread")
raise
return Task(coro, loop=loop, name=name, eager_start=True)