From ff00c1864d59b3700294acf0d63aef6cc99e2ef1 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 10 Apr 2024 12:32:51 +0200 Subject: [PATCH] Add HacsBase.__init__ (#3566) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add HacsBase.__init__ * Address review comments --------- Co-authored-by: Joakim Sørensen --- custom_components/hacs/base.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 76c7785cd20..fff0ef89644 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -355,9 +355,6 @@ def removed_repository(self, repository_full_name: str) -> RemovedRepository: class HacsBase: """Base HACS class.""" - common = HacsCommon() - configuration = HacsConfiguration() - core = HacsCore() data: HacsData | None = None data_client: HacsDataClient | None = None frontend_version: str | None = None @@ -365,18 +362,24 @@ class HacsBase: githubapi: GitHubAPI | None = None hass: HomeAssistant | None = None integration: Integration | None = None - log: logging.Logger = LOGGER queue: QueueManager | None = None - recuring_tasks = [] - repositories: HacsRepositories = HacsRepositories() repository: AIOGitHubAPIRepository | None = None session: ClientSession | None = None stage: HacsStage | None = None - status = HacsStatus() - system = HacsSystem() validation: ValidationManager | None = None version: AwesomeVersion | None = None + def __init__(self) -> None: + """Initialize.""" + self.common = HacsCommon() + self.configuration = HacsConfiguration() + self.core = HacsCore() + self.log = LOGGER + self.recuring_tasks: list[Callable[[], None]] = [] + self.repositories = HacsRepositories() + self.status = HacsStatus() + self.system = HacsSystem() + @property def integration_dir(self) -> pathlib.Path: """Return the HACS integration dir."""