style: fix whitespace and formatting in repomap.py

This commit is contained in:
Paul Gauthier (aider) 2024-10-29 14:59:55 -07:00
parent 7f027ff6e5
commit 0feed0047c

View file

@ -172,33 +172,36 @@ class RepoMap:
return return
path = Path(self.root) / self.TAGS_CACHE_DIR path = Path(self.root) / self.TAGS_CACHE_DIR
# Try to recreate the cache # Try to recreate the cache
try: try:
# Delete existing cache dir # Delete existing cache dir
if path.exists(): if path.exists():
import shutil import shutil
shutil.rmtree(path) shutil.rmtree(path)
# Try to create new cache # Try to create new cache
new_cache = Cache(path) new_cache = Cache(path)
# Test that it works # Test that it works
test_key = "test" test_key = "test"
new_cache[test_key] = "test" new_cache[test_key] = "test"
_ = new_cache[test_key] _ = new_cache[test_key]
del new_cache[test_key] del new_cache[test_key]
# If we got here, the new cache works # If we got here, the new cache works
self.TAGS_CACHE = new_cache self.TAGS_CACHE = new_cache
return return
except (SQLITE_ERRORS, OSError) as e: except (SQLITE_ERRORS, OSError) as e:
# If anything goes wrong, warn and fall back to dict # If anything goes wrong, warn and fall back to dict
self.io.tool_warning(f"Unable to use tags cache at {path}, falling back to memory cache") self.io.tool_warning(
f"Unable to use tags cache at {path}, falling back to memory cache"
)
if self.verbose: if self.verbose:
self.io.tool_warning(f"Cache error: {str(e)}") self.io.tool_warning(f"Cache error: {str(e)}")
self.TAGS_CACHE = dict() self.TAGS_CACHE = dict()
def load_tags_cache(self): def load_tags_cache(self):