mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
fixed up shelve
This commit is contained in:
parent
a9b53569ac
commit
4297e75b9b
1 changed files with 10 additions and 19 deletions
|
@ -1,5 +1,6 @@
|
||||||
import shelve
|
import json
|
||||||
import os
|
import os
|
||||||
|
import shelve
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
@ -55,17 +56,6 @@ class RepoMap:
|
||||||
IDENT_CACHE_FILE = ".aider.ident.cache"
|
IDENT_CACHE_FILE = ".aider.ident.cache"
|
||||||
TAGS_CACHE_FILE = ".aider.tags.cache"
|
TAGS_CACHE_FILE = ".aider.tags.cache"
|
||||||
|
|
||||||
def load_tags_cache(self):
|
|
||||||
if os.path.exists(self.TAGS_CACHE_FILE):
|
|
||||||
with shelve.open(self.TAGS_CACHE_FILE) as db:
|
|
||||||
self.TAGS_CACHE = dict(db)
|
|
||||||
else:
|
|
||||||
self.TAGS_CACHE = dict()
|
|
||||||
|
|
||||||
def save_tags_cache(self):
|
|
||||||
with shelve.open(self.TAGS_CACHE_FILE) as db:
|
|
||||||
db.update(self.TAGS_CACHE)
|
|
||||||
|
|
||||||
def __init__(self, use_ctags=None, root=None, main_model="gpt-4"):
|
def __init__(self, use_ctags=None, root=None, main_model="gpt-4"):
|
||||||
if not root:
|
if not root:
|
||||||
root = os.getcwd()
|
root = os.getcwd()
|
||||||
|
@ -218,16 +208,17 @@ class RepoMap:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def load_tags_cache(self):
|
||||||
|
self.TAGS_CACHE = shelve.open(self.TAGS_CACHE_FILE)
|
||||||
|
|
||||||
|
def save_tags_cache(self):
|
||||||
|
self.TAGS_CACHE.sync()
|
||||||
|
|
||||||
def load_ident_cache(self):
|
def load_ident_cache(self):
|
||||||
if os.path.exists(self.IDENT_CACHE_FILE):
|
self.IDENT_CACHE = shelve.open(self.IDENT_CACHE_FILE)
|
||||||
with shelve.open(self.IDENT_CACHE_FILE) as db:
|
|
||||||
self.IDENT_CACHE = dict(db)
|
|
||||||
else:
|
|
||||||
self.IDENT_CACHE = dict()
|
|
||||||
|
|
||||||
def save_ident_cache(self):
|
def save_ident_cache(self):
|
||||||
with shelve.open(self.IDENT_CACHE_FILE) as db:
|
self.IDENT_CACHE.sync()
|
||||||
db.update(self.IDENT_CACHE)
|
|
||||||
|
|
||||||
def get_name_identifiers(self, fname, uniq=True):
|
def get_name_identifiers(self, fname, uniq=True):
|
||||||
file_mtime = os.path.getmtime(fname)
|
file_mtime = os.path.getmtime(fname)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue