Import anonymize_data in unifiprotect init to avoid it being imported in the event loop (#112052)

Improve anonymize_data in unifiprotect init to avoid it being imported in the event loop
This commit is contained in:
J. Nick Koston 2024-03-02 11:08:22 -10:00 committed by GitHub
parent 546fc1e282
commit 85ec48ff31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,11 @@ import logging
from aiohttp.client_exceptions import ServerDisconnectedError
from pyunifiprotect.exceptions import ClientError, NotAuthorized
# Import the test_util.anonymize module from the pyunifiprotect package
# in __init__ to ensure it gets imported in the executor since the
# diagnostics module will not be imported in the executor.
from pyunifiprotect.test_util.anonymize import anonymize_data # noqa: F401
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import HomeAssistant