-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
6,878 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
"""Base HACS class.""" | ||
import logging | ||
from typing import List, Optional | ||
import attr | ||
|
||
from aiogithubapi.github import AIOGitHubAPI | ||
from aiogithubapi.objects.repository import AIOGitHubAPIRepository | ||
from homeassistant.core import HomeAssistant | ||
|
||
from .enums import HacsStage | ||
from .helpers.functions.logger import getLogger | ||
from .models.core import HacsCore | ||
from .models.frontend import HacsFrontend | ||
from .models.system import HacsSystem | ||
|
||
|
||
class HacsCommon: | ||
"""Common for HACS.""" | ||
|
||
categories: List = [] | ||
default: List = [] | ||
installed: List = [] | ||
skip: List = [] | ||
|
||
|
||
class HacsStatus: | ||
"""HacsStatus.""" | ||
|
||
startup: bool = True | ||
new: bool = False | ||
background_task: bool = False | ||
reloading_data: bool = False | ||
upgrading_all: bool = False | ||
|
||
|
||
@attr.s | ||
class HacsBaseAttributes: | ||
"""Base HACS class.""" | ||
|
||
_default: Optional[AIOGitHubAPIRepository] | ||
_github: Optional[AIOGitHubAPI] | ||
_hass: Optional[HomeAssistant] | ||
_repository: Optional[AIOGitHubAPIRepository] | ||
_stage: HacsStage = HacsStage.SETUP | ||
_common: Optional[HacsCommon] | ||
|
||
core: HacsCore = attr.ib(HacsCore) | ||
common: HacsCommon = attr.ib(HacsCommon) | ||
status: HacsStatus = attr.ib(HacsStatus) | ||
frontend: HacsFrontend = attr.ib(HacsFrontend) | ||
log: logging.Logger = getLogger() | ||
system: HacsSystem = attr.ib(HacsSystem) | ||
repositories: List = [] | ||
|
||
|
||
@attr.s | ||
class HacsBase(HacsBaseAttributes): | ||
"""Base HACS class.""" | ||
|
||
@property | ||
def stage(self) -> HacsStage: | ||
"""Returns a HacsStage object.""" | ||
return self._stage | ||
|
||
@stage.setter | ||
def stage(self, value: HacsStage) -> None: | ||
"""Set the value for the stage property.""" | ||
self._stage = value | ||
|
||
@property | ||
def github(self) -> Optional[AIOGitHubAPI]: | ||
"""Returns a AIOGitHubAPI object.""" | ||
return self._github | ||
|
||
@github.setter | ||
def github(self, value: AIOGitHubAPI) -> None: | ||
"""Set the value for the github property.""" | ||
self._github = value | ||
|
||
@property | ||
def repository(self) -> Optional[AIOGitHubAPIRepository]: | ||
"""Returns a AIOGitHubAPIRepository object representing hacs/integration.""" | ||
return self._repository | ||
|
||
@repository.setter | ||
def repository(self, value: AIOGitHubAPIRepository) -> None: | ||
"""Set the value for the repository property.""" | ||
self._repository = value | ||
|
||
@property | ||
def default(self) -> Optional[AIOGitHubAPIRepository]: | ||
"""Returns a AIOGitHubAPIRepository object representing hacs/default.""" | ||
return self._default | ||
|
||
@default.setter | ||
def default(self, value: AIOGitHubAPIRepository) -> None: | ||
"""Set the value for the default property.""" | ||
self._default = value | ||
|
||
@property | ||
def hass(self) -> Optional[HomeAssistant]: | ||
"""Returns a HomeAssistant object.""" | ||
return self._hass | ||
|
||
@hass.setter | ||
def hass(self, value: HomeAssistant) -> None: | ||
"""Set the value for the default property.""" | ||
self._hass = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.