From b4ae25f42ca78ec671354972f53871e4d5b66972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Fri, 3 Sep 2021 19:19:54 +0200 Subject: [PATCH] No etag for default files (#2208) --- custom_components/hacs/base.py | 6 +----- custom_components/hacs/hacsbase/data.py | 4 ---- tests/conftest.py | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/custom_components/hacs/base.py b/custom_components/hacs/base.py index 9870a2e62cf..54d5759a157 100644 --- a/custom_components/hacs/base.py +++ b/custom_components/hacs/base.py @@ -138,7 +138,6 @@ class HacsSystem: class HacsBase: """Base HACS class.""" - _etag_hacs_default = {} _repositories = [] _repositories_by_full_name = {} _repositories_by_id = {} @@ -230,9 +229,6 @@ async def async_can_update(self) -> int: async def async_github_get_hacs_default_file(self, filename: str) -> dict[str, Any]: """Get the content of a default file.""" response = await self.githubapi.repos.contents.get( - repository=REPOSITORY_HACS_DEFAULT, - path=filename, - **{"etag": self._etag_hacs_default.get(filename)}, + repository=REPOSITORY_HACS_DEFAULT, path=filename ) - self._etag_hacs_default[filename] = response.etag return json.loads(decode_content(response.data.content)) diff --git a/custom_components/hacs/hacsbase/data.py b/custom_components/hacs/hacsbase/data.py index 9973e42db48..f8cb4b58de6 100644 --- a/custom_components/hacs/hacsbase/data.py +++ b/custom_components/hacs/hacsbase/data.py @@ -55,7 +55,6 @@ async def async_write(self): "onboarding_done": self.hacs.configuration.onboarding_done, "archived_repositories": self.hacs.common.archived_repositories, "renamed_repositories": self.hacs.common.renamed_repositories, - "etag_hacs_default": self.hacs._etag_hacs_default, # pylint: disable=protected-access }, ) await self._async_store_content_and_repos() @@ -134,9 +133,6 @@ async def restore(self): self.hacs.configuration.onboarding_done = hacs.get("onboarding_done", False) self.hacs.common.archived_repositories = hacs.get("archived_repositories", []) self.hacs.common.renamed_repositories = hacs.get("renamed_repositories", {}) - self.hacs._etag_hacs_default = hacs.get( # pylint: disable=protected-access - "etag_hacs_default", {} - ) # Repositories hass = self.hacs.hass diff --git a/tests/conftest.py b/tests/conftest.py index 2f9f56b1b12..cba825056ca 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -92,7 +92,6 @@ def exc_handle(loop, context): def hacs(hass): """Fixture to provide a HACS object.""" hacs_obj = Hacs() - hacs_obj._etag_hacs_default = {} hacs_obj._repositories = [] hacs_obj._repositories_by_full_name = {} hacs_obj._repositories_by_id = {}