fix: init map_processing_time to 0 in __init__; move time import to top of file

This commit is contained in:
Paul Gauthier (aider) 2024-08-17 06:24:23 -07:00
parent 6ca1a2eb57
commit 88dc1c63fd

View file

@ -3,6 +3,7 @@ import math
import os import os
import random import random
import sys import sys
import time
import warnings import warnings
from collections import Counter, defaultdict, namedtuple from collections import Counter, defaultdict, namedtuple
from importlib import resources from importlib import resources
@ -65,6 +66,7 @@ class RepoMap:
self.tree_cache = {} self.tree_cache = {}
self.tree_context_cache = {} self.tree_context_cache = {}
self.map_cache = {} self.map_cache = {}
self.map_processing_time = 0
def token_count(self, text): def token_count(self, text):
len_text = len(text) len_text = len(text)
@ -422,8 +424,6 @@ class RepoMap:
return self.map_cache[cache_key] return self.map_cache[cache_key]
# If not in cache, generate the map # If not in cache, generate the map
import time
start_time = time.time() start_time = time.time()
result = self.get_ranked_tags_map_uncached( result = self.get_ranked_tags_map_uncached(
chat_fnames, other_fnames, max_map_tokens, mentioned_fnames, mentioned_idents chat_fnames, other_fnames, max_map_tokens, mentioned_fnames, mentioned_idents