Home Assistant Unofficial Reference 2024.12.1
homeassistant.helpers.frame Namespace Reference

Classes

class  IntegrationFrame
 
class  MissingIntegrationFrame
 
class  ReportBehavior
 

Functions

def _CallableT
 
None _report_integration_domain (HomeAssistant|None hass, str what, str|None breaks_in_ha_version, Integration integration, ReportBehavior core_integration_behavior, ReportBehavior custom_integration_behavior, int level)
 
None _report_integration_frame (str what, str|None breaks_in_ha_version, IntegrationFrame integration_frame, int level=logging.WARNING, bool error=False)
 
FrameType get_current_frame (int depth=0)
 
IntegrationFrame get_integration_frame (set|None exclude_integrations=None)
 
logging.Logger get_integration_logger (str fallback_name)
 
None report (str what, *set[str]|None exclude_integrations=None, bool error_if_core=True, bool error_if_integration=False, int level=logging.WARNING, bool log_custom_component_only=False)
 
None report_non_thread_safe_operation (str what)
 
None report_usage (str what, *str|None breaks_in_ha_version=None, ReportBehavior core_behavior=ReportBehavior.ERROR, ReportBehavior core_integration_behavior=ReportBehavior.LOG, ReportBehavior custom_integration_behavior=ReportBehavior.LOG, set[str]|None exclude_integrations=None, str|None integration_domain=None, int level=logging.WARNING)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 

Detailed Description

Provide frame helper for finding the current frame context.

Function Documentation

◆ _CallableT()

def homeassistant.helpers.frame._CallableT
private

Definition at line 349 of file frame.py.

◆ _report_integration_domain()

None homeassistant.helpers.frame._report_integration_domain ( HomeAssistant | None  hass,
str  what,
str | None  breaks_in_ha_version,
Integration  integration,
ReportBehavior  core_integration_behavior,
ReportBehavior  custom_integration_behavior,
int  level 
)
private
Report incorrect usage in an integration (identified via domain).

Async friendly.

Definition at line 251 of file frame.py.

◆ _report_integration_frame()

None homeassistant.helpers.frame._report_integration_frame ( str  what,
str | None  breaks_in_ha_version,
IntegrationFrame  integration_frame,
int   level = logging.WARNING,
bool   error = False 
)
private
Report incorrect usage in an integration (identified via frame).

Async friendly.

Definition at line 301 of file frame.py.

◆ get_current_frame()

FrameType homeassistant.helpers.frame.get_current_frame ( int   depth = 0)
Return the current frame.

Definition at line 78 of file frame.py.

◆ get_integration_frame()

IntegrationFrame homeassistant.helpers.frame.get_integration_frame ( set | None   exclude_integrations = None)
Return the frame, integration and integration path of the current stack frame.

Definition at line 84 of file frame.py.

◆ get_integration_logger()

logging.Logger homeassistant.helpers.frame.get_integration_logger ( str  fallback_name)
Return a logger by checking the current integration frame.

If Python is unable to access the sources files, the call stack frame
will be missing information, so let's guard by requiring a fallback name.
https://github.com/home-assistant/core/issues/24982

Definition at line 58 of file frame.py.

◆ report()

None homeassistant.helpers.frame.report ( str  what,
*set[str] | None   exclude_integrations = None,
bool   error_if_core = True,
bool   error_if_integration = False,
int   level = logging.WARNING,
bool   log_custom_component_only = False 
)
Report incorrect usage.

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.

Definition at line 136 of file frame.py.

◆ report_non_thread_safe_operation()

None homeassistant.helpers.frame.report_non_thread_safe_operation ( str  what)
Report a non-thread safe operation.

Definition at line 366 of file frame.py.

◆ report_usage()

None homeassistant.helpers.frame.report_usage ( str  what,
*str | None   breaks_in_ha_version = None,
ReportBehavior   core_behavior = ReportBehavior.ERROR,
ReportBehavior   core_integration_behavior = ReportBehavior.LOG,
ReportBehavior   custom_integration_behavior = ReportBehavior.LOG,
set[str] | None   exclude_integrations = None,
str | None   integration_domain = None,
int   level = logging.WARNING 
)
Report incorrect code usage.

:param what: will be wrapped with "Detected that integration 'integration' {what}.
Please create a bug report at https://..."
:param breaks_in_ha_version: if set, the report will be adjusted to specify the
breaking version
:param exclude_integrations: skip specified integration when reviewing the stack.
If no integration is found, the core behavior will be applied
:param integration_domain: fallback for identifying the integration if the
frame is not found

Definition at line 185 of file frame.py.

Variable Documentation

◆ _LOGGER

homeassistant.helpers.frame._LOGGER = logging.getLogger(__name__)
private

Definition at line 26 of file frame.py.