Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
blacklist = await self.data_repo.get_contents("blacklist")
repositories = await self.get_repositories()
for item in json.loads(blacklist.content):
if item not in self.common.blacklist:
self.common.blacklist.append(item)
for category in repositories:
for repo in repositories[category]:
if repo in self.common.blacklist:
continue
if self.is_known(repo):
continue
try:
await self.register_repository(repo, category)
except (AIOGitHubException, AIOGitHubRatelimit):
pass
try:
repository = hacs().get_by_name("hacs/integration")
if repository is None:
await hacs().register_repository("hacs/integration", "integration")
repository = hacs().get_by_name("hacs/integration")
if repository is None:
raise AIOGitHubException("Unknown error")
repository.status.installed = True
repository.versions.installed = VERSION
repository.status.new = False
hacs.repo = repository.repository_object
hacs.data_repo = await hacs().github.get_repo("hacs/default")
except (
AIOGitHubException,
AIOGitHubRatelimit,
AIOGitHubAuthentication,
) as exception:
hacs.logger.critical(f"[{exception}] - Could not load HACS!")
return False
return True
"""Load HACS repositroy."""
try:
repository = hacs().get_by_name("hacs/integration")
if repository is None:
await hacs().register_repository("hacs/integration", "integration")
repository = hacs().get_by_name("hacs/integration")
if repository is None:
raise AIOGitHubException("Unknown error")
repository.status.installed = True
repository.versions.installed = VERSION
repository.status.new = False
hacs.repo = repository.repository_object
hacs.data_repo = await hacs().github.get_repo("hacs/default")
except (
AIOGitHubException,
AIOGitHubRatelimit,
AIOGitHubAuthentication,
) as exception:
hacs.logger.critical(f"[{exception}] - Could not load HACS!")
return False
return True
try:
repository = hacs().get_by_name("hacs/integration")
if repository is None:
await hacs().register_repository("hacs/integration", "integration")
repository = hacs().get_by_name("hacs/integration")
if repository is None:
raise AIOGitHubException("Unknown error")
repository.status.installed = True
repository.versions.installed = VERSION
repository.status.new = False
hacs.repo = repository.repository_object
hacs.data_repo = await hacs().github.get_repo("hacs/default")
except (
AIOGitHubException,
AIOGitHubRatelimit,
AIOGitHubAuthentication,
) as exception:
hacs.logger.critical(f"[{exception}] - Could not load HACS!")
return False
return True