From 291af0b0e28942dfe20c59d257b3f9480038fc67 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Mon, 4 Oct 2021 11:37:24 +0200 Subject: [PATCH] chore(cache): do not create cache file until we need it This is required to be able to skip caching for some commands. --- ggshield/config.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/ggshield/config.py b/ggshield/config.py index 727e36af32..722189ac7b 100644 --- a/ggshield/config.py +++ b/ggshield/config.py @@ -224,18 +224,8 @@ def __setattr__(self, name: str, value: Any) -> None: else: super().__setattr__(name, value) - def create_empty_cache(self) -> None: - # Creates a new file - try: - with open(self.CACHE_FILENAME, "w"): - pass - except PermissionError: - # Hotfix: for the time being we skip cache handling if permission denied - pass - def load_cache(self) -> bool: if not os.path.isfile(self.CACHE_FILENAME): - self.create_empty_cache() return True _cache: dict = {} @@ -286,9 +276,6 @@ def to_dict(self) -> Dict[str, Any]: return _cache def save(self) -> bool: - if not os.path.isfile(self.CACHE_FILENAME): - return False - try: f = open(self.CACHE_FILENAME, "w") except PermissionError: