diff --git a/aider/sendchat.py b/aider/sendchat.py index b4bd6b489..5025d42dd 100644 --- a/aider/sendchat.py +++ b/aider/sendchat.py @@ -4,7 +4,8 @@ import json import backoff import openai import requests -from diskcache import Cache + +# from diskcache import Cache from openai.error import ( APIConnectionError, APIError, @@ -14,7 +15,8 @@ from openai.error import ( ) CACHE_PATH = "~/.aider.send.cache.v1" -CACHE = Cache(CACHE_PATH) +CACHE = None +# CACHE = Cache(CACHE_PATH) @backoff.on_exception( @@ -53,12 +55,12 @@ def send_with_retries(model, messages, functions, stream): # Generate SHA1 hash of kwargs and append it to chat_completion_call_hashes hash_object = hashlib.sha1(key) - if not stream and key in CACHE: + if not stream and CACHE is not None and key in CACHE: return hash_object, CACHE[key] res = openai.ChatCompletion.create(**kwargs) - if not stream: + if not stream and CACHE is not None: CACHE[key] = res return hash_object, res diff --git a/tests/test_editblock.py b/tests/test_editblock.py index f3f599f24..27d5a60a0 100644 --- a/tests/test_editblock.py +++ b/tests/test_editblock.py @@ -21,7 +21,8 @@ class TestUtils(unittest.TestCase): def tearDown(self): self.patcher.stop() - def test_replace_most_similar_chunk(self): + # fuzzy logic disabled v0.11.2-dev + def __test_replace_most_similar_chunk(self): whole = "This is a sample text.\nAnother line of text.\nYet another line.\n" part = "This is a sample text\n" replace = "This is a replaced text.\n" @@ -30,7 +31,8 @@ class TestUtils(unittest.TestCase): result = eb.replace_most_similar_chunk(whole, part, replace) self.assertEqual(result, expected_output) - def test_replace_most_similar_chunk_not_perfect_match(self): + # fuzzy logic disabled v0.11.2-dev + def __test_replace_most_similar_chunk_not_perfect_match(self): whole = "This is a sample text.\nAnother line of text.\nYet another line.\n" part = "This was a sample text.\nAnother line of txt\n" replace = "This is a replaced text.\nModified line of text.\n" @@ -65,11 +67,11 @@ Here's the change: ```text foo.txt -<<<<<<< ORIGINAL +<<<<<<< HEAD Two ======= Tooooo ->>>>>>> UPDATED +>>>>>>> updated ``` Hope you like it! @@ -84,11 +86,11 @@ Here's the change: foo.txt ```text -<<<<<<< ORIGINAL +<<<<<<< HEAD Two ======= Tooooo ->>>>>>> UPDATED +>>>>>>> updated ``` Hope you like it! @@ -103,7 +105,7 @@ Here's the change: ```text foo.txt -<<<<<<< ORIGINAL +<<<<<<< HEAD Two ======= Tooooo @@ -121,7 +123,7 @@ oops! Here's the change: ```text -<<<<<<< ORIGINAL +<<<<<<< HEAD Two ======= Tooooo @@ -137,34 +139,34 @@ oops! def test_find_original_update_blocks_no_final_newline(self): edit = """ aider/coder.py -<<<<<<< ORIGINAL +<<<<<<< HEAD self.console.print("[red]^C again to quit") ======= self.io.tool_error("^C again to quit") ->>>>>>> UPDATED +>>>>>>> updated aider/coder.py -<<<<<<< ORIGINAL +<<<<<<< HEAD self.io.tool_error("Malformed ORIGINAL/UPDATE blocks, retrying...") self.io.tool_error(err) ======= self.io.tool_error("Malformed ORIGINAL/UPDATE blocks, retrying...") self.io.tool_error(str(err)) ->>>>>>> UPDATED +>>>>>>> updated aider/coder.py -<<<<<<< ORIGINAL +<<<<<<< HEAD self.console.print("[red]Unable to get commit message from gpt-3.5-turbo. Use /commit to try again.\n") ======= self.io.tool_error("Unable to get commit message from gpt-3.5-turbo. Use /commit to try again.") ->>>>>>> UPDATED +>>>>>>> updated aider/coder.py -<<<<<<< ORIGINAL +<<<<<<< HEAD self.console.print("[red]Skipped commmit.") ======= self.io.tool_error("Skipped commmit.") ->>>>>>> UPDATED""" +>>>>>>> updated""" # Should not raise a ValueError list(eb.find_original_update_blocks(edit)) @@ -175,7 +177,7 @@ No problem! Here are the changes to patch `subprocess.check_output` instead of ` ```python tests/test_repomap.py -<<<<<<< ORIGINAL +<<<<<<< HEAD def test_check_for_ctags_failure(self): with patch("subprocess.run") as mock_run: mock_run.side_effect = Exception("ctags not found") @@ -183,9 +185,9 @@ tests/test_repomap.py def test_check_for_ctags_failure(self): with patch("subprocess.check_output") as mock_check_output: mock_check_output.side_effect = Exception("ctags not found") ->>>>>>> UPDATED +>>>>>>> updated -<<<<<<< ORIGINAL +<<<<<<< HEAD def test_check_for_ctags_success(self): with patch("subprocess.run") as mock_run: mock_run.return_value = CompletedProcess(args=["ctags", "--version"], returncode=0, stdout='''{ @@ -205,7 +207,7 @@ tests/test_repomap.py "pattern": "/^ status = main()$/", "kind": "variable" }''' ->>>>>>> UPDATED +>>>>>>> updated ``` These changes replace the `subprocess.run` patches with `subprocess.check_output` patches in both `test_check_for_ctags_failure` and `test_check_for_ctags_success` tests. @@ -284,11 +286,11 @@ These changes replace the `subprocess.run` patches with `subprocess.check_output Do this: {Path(file1).name} -<<<<<<< ORIGINAL +<<<<<<< HEAD two ======= new ->>>>>>> UPDATED +>>>>>>> updated """ coder.partial_response_function_call = dict() @@ -326,11 +328,11 @@ new Do this: {Path(file1).name} -<<<<<<< ORIGINAL +<<<<<<< HEAD two ======= new ->>>>>>> UPDATED +>>>>>>> updated """ coder.partial_response_function_call = dict()