Make optional arguments to frame.report kwarg only (#125062)

* Make optional arguments to frame.report kwarg only

* Update homeassistant/helpers/frame.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
Erik Montnemery 2024-09-03 17:03:36 +02:00 committed by GitHub
parent 5d072d1030
commit 8759a6a14d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -160,7 +160,7 @@ async def async_resolve_media(
if target_media_player is UNDEFINED:
report(
"calls media_source.async_resolve_media without passing an entity_id",
{DOMAIN},
exclude_integrations={DOMAIN},
)
target_media_player = None

View File

@ -129,15 +129,19 @@ class MissingIntegrationFrame(HomeAssistantError):
def report(
what: str,
exclude_integrations: set | None = None,
*,
exclude_integrations: set[str] | None = None,
error_if_core: bool = True,
error_if_integration: bool = False,
level: int = logging.WARNING,
log_custom_component_only: bool = False,
error_if_integration: bool = False,
) -> None:
"""Report incorrect usage.
Async friendly.
If error_if_core is True, raise instead of log if an integration is not found
when unwinding the stack frame.
If error_if_integration is True, raise instead of log if an integration is found
when unwinding the stack frame.
"""
try:
integration_frame = get_integration_frame(