diff --git a/aider/__init__.py b/aider/__init__.py index 4d273da8fec..0b954d5443d 100644 --- a/aider/__init__.py +++ b/aider/__init__.py @@ -1,6 +1,6 @@ from packaging import version -__version__ = "0.88.34.dev" +__version__ = "0.88.35.dev" safe_version = __version__ try: diff --git a/aider/coders/chat_chunks.py b/aider/coders/chat_chunks.py index db4d0c6698d..85407ff0d1c 100644 --- a/aider/coders/chat_chunks.py +++ b/aider/coders/chat_chunks.py @@ -79,7 +79,7 @@ def cacheable_messages(self): return messages[: len(messages) - i] return messages - def format_list(chunk): + def format_list(self, chunk): if type(chunk) is not list: return [] diff --git a/aider/main.py b/aider/main.py index e6b80279bc6..7ec409b3481 100644 --- a/aider/main.py +++ b/aider/main.py @@ -496,51 +496,47 @@ def expand_glob_patterns(patterns, root="."): def custom_tracer(frame, event, arg): - try: - import os + import os - global log_file - if not log_file: - os.makedirs(".aider/logs/", exist_ok=True) - log_file = open(".aider/logs/debug.log", "w", buffering=1) - - # Get the absolute path of the file where the code is executing - filename = os.path.abspath(frame.f_code.co_filename) - - # --- THE FILTERING LOGIC --- - # Only proceed if the file path is INSIDE the project root - if not filename.startswith(PROJECT_ROOT): - return None # Returning None means no local trace function for this scope - - if filename.endswith("repo.py"): - return None - - # If it's your code, trace the call - if event == "call": - func_name = frame.f_code.co_name - line_no = frame.f_lineno - - if func_name not in file_excludelist: - log_file.write( - f"-> CALL: {func_name}() in {os.path.basename(filename)}:{line_no} -" - f" {time.time()}\n" - ) + global log_file + if not log_file: + os.makedirs(".aider/logs/", exist_ok=True) + log_file = open(".aider/logs/debug.log", "w", buffering=1) - if event == "return": - func_name = frame.f_code.co_name - line_no = frame.f_lineno + # Get the absolute path of the file where the code is executing + filename = os.path.abspath(frame.f_code.co_filename) - if func_name not in file_excludelist: - log_file.write( - f"<- RETURN: {func_name}() in {os.path.basename(filename)}:{line_no} -" - f" {time.time()}\n" - ) + # --- THE FILTERING LOGIC --- + # Only proceed if the file path is INSIDE the project root + if not filename.startswith(PROJECT_ROOT): + return None # Returning None means no local trace function for this scope - except Exception: - pass - finally: - # Must return the trace function (or a local one) for subsequent events - return custom_tracer + if filename.endswith("repo.py"): + return None + + # If it's your code, trace the call + if event == "call": + func_name = frame.f_code.co_name + line_no = frame.f_lineno + + if func_name not in file_excludelist: + log_file.write( + f"-> CALL: {func_name}() in {os.path.basename(filename)}:{line_no} -" + f" {time.time()}\n" + ) + + if event == "return": + func_name = frame.f_code.co_name + line_no = frame.f_lineno + + if func_name not in file_excludelist: + log_file.write( + f"<- RETURN: {func_name}() in {os.path.basename(filename)}:{line_no} -" + f" {time.time()}\n" + ) + + # Must return the trace function (or a local one) for subsequent events + return custom_tracer def main(argv=None, input=None, output=None, force_git_root=None, return_coder=False):