Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def wrapper(*args, **kwargs) -> Any:
instance = args[0]
result = None
if hasattr(instance, "check_login_changes"):
instance.check_login_changes()
try:
result = await func(*args, **kwargs)
except AlexapyLoginCloseRequested:
_LOGGER.debug(
"%s.%s: Ignoring attempt to access Alexa after HA shutdown",
func.__module__[func.__module__.find(".") + 1 :],
func.__name__,
)
return None
except AlexapyLoginError as ex:
_LOGGER.debug(
"%s.%s: detected bad login: %s",
func.__module__[func.__module__.find(".") + 1 :],
func.__name__,
EXCEPTION_TEMPLATE.format(type(ex).__name__, ex.args),
)
instance = args[0]
if hasattr(instance, "_login"):
login = instance._login