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

Classes

class  DeferredDeprecatedAlias
 
class  DeprecatedAlias
 
class  DeprecatedConstant
 
class  DeprecatedConstantEnum
 
class  EnumWithDeprecatedMembers
 

Functions

def _ObjectT
 
None _print_deprecation_warning (Any obj, str replacement, str description, str verb, str|None breaks_in_ha_version)
 
None _print_deprecation_warning_internal (str obj_name, str module_name, str replacement, str description, str verb, str|None breaks_in_ha_version, *bool log_when_no_integration_is_found)
 
None _print_deprecation_warning_internal_impl (str obj_name, str module_name, str replacement, str description, str verb, str|None breaks_in_ha_version, *bool log_when_no_integration_is_found)
 
Callable[[Callable[_P, _R]], Callable[_P, _R]] _R (str replacement, *str|None breaks_in_ha_version=None)
 
list[str] all_with_deprecated_constants (dict[str, Any] module_globals)
 
Any check_if_deprecated_constant (str name, dict[str, Any] module_globals)
 
list[str] dir_with_deprecated_constants (list[str] module_globals_keys)
 
Any|None get_deprecated (dict[str, Any] config, str new_name, str old_name, Any|None default=None)
 

Variables

string _PREFIX_DEPRECATED = "_DEPRECATED_"
 

Detailed Description

Deprecation helpers for Home Assistant.

Function Documentation

◆ _ObjectT()

def homeassistant.helpers.deprecation._ObjectT
private

Definition at line 14 of file deprecation.py.

◆ _print_deprecation_warning()

None homeassistant.helpers.deprecation._print_deprecation_warning ( Any  obj,
str  replacement,
str  description,
str  verb,
str | None  breaks_in_ha_version 
)
private

Definition at line 141 of file deprecation.py.

◆ _print_deprecation_warning_internal()

None homeassistant.helpers.deprecation._print_deprecation_warning_internal ( str  obj_name,
str  module_name,
str  replacement,
str  description,
str  verb,
str | None  breaks_in_ha_version,
*bool  log_when_no_integration_is_found 
)
private

Definition at line 159 of file deprecation.py.

◆ _print_deprecation_warning_internal_impl()

None homeassistant.helpers.deprecation._print_deprecation_warning_internal_impl ( str  obj_name,
str  module_name,
str  replacement,
str  description,
str  verb,
str | None  breaks_in_ha_version,
*bool  log_when_no_integration_is_found 
)
private

Definition at line 183 of file deprecation.py.

◆ _R()

Callable[[Callable[_P, _R]], Callable[_P, _R]] homeassistant.helpers.deprecation._R ( str  replacement,
*str | None   breaks_in_ha_version = None 
)
private
Mark class as deprecated and provide a replacement class to be used instead.

If the deprecated function was called from a custom integration, ask the user to
report an issue.
Mark function as deprecated and provide a replacement to be used instead.

If the deprecated function was called from a custom integration, ask the user to
report an issue.

Definition at line 91 of file deprecation.py.

◆ all_with_deprecated_constants()

list[str] homeassistant.helpers.deprecation.all_with_deprecated_constants ( dict[str, Any]  module_globals)
Generate a list for __all___ with deprecated constants.

Definition at line 356 of file deprecation.py.

◆ check_if_deprecated_constant()

Any homeassistant.helpers.deprecation.check_if_deprecated_constant ( str  name,
dict[str, Any]  module_globals 
)
Check if the not found name is a deprecated constant.

If it is, print a deprecation warning and return the value of the constant.
Otherwise raise AttributeError.

Definition at line 293 of file deprecation.py.

◆ dir_with_deprecated_constants()

list[str] homeassistant.helpers.deprecation.dir_with_deprecated_constants ( list[str]  module_globals_keys)
Return dir() with deprecated constants.

Definition at line 347 of file deprecation.py.

◆ get_deprecated()

Any | None homeassistant.helpers.deprecation.get_deprecated ( dict[str, Any]  config,
str  new_name,
str  old_name,
Any | None   default = None 
)
Allow an old config name to be deprecated with a replacement.

If the new config isn't found, but the old one is, the old value is used
and a warning is issued to the user.

Definition at line 59 of file deprecation.py.

Variable Documentation

◆ _PREFIX_DEPRECATED

string homeassistant.helpers.deprecation._PREFIX_DEPRECATED = "_DEPRECATED_"
private

Definition at line 290 of file deprecation.py.