diff --git a/aider/coders/__init__.py b/aider/coders/__init__.py index e577a0f77..34fd5c7fc 100644 --- a/aider/coders/__init__.py +++ b/aider/coders/__init__.py @@ -1,5 +1,5 @@ -from .base import Coder -from .editblock import EditBlockCoder -from .wholefile import WholeFileCoder +from .base_coder import Coder +from .editblock_coder import EditBlockCoder +from .wholefile_coder import WholeFileCoder __all__ = [Coder, EditBlockCoder, WholeFileCoder] diff --git a/aider/coders/base.py b/aider/coders/base_coder.py similarity index 100% rename from aider/coders/base.py rename to aider/coders/base_coder.py diff --git a/aider/coders/editblock.py b/aider/coders/editblock_coder.py similarity index 99% rename from aider/coders/editblock.py rename to aider/coders/editblock_coder.py index 7de5e1ba4..575779b87 100644 --- a/aider/coders/editblock.py +++ b/aider/coders/editblock_coder.py @@ -4,7 +4,7 @@ import re from difflib import SequenceMatcher from pathlib import Path -from .base import Coder +from .base_coder import Coder from .editblock_prompts import EditBlockPrompts diff --git a/aider/coders/wholefile.py b/aider/coders/wholefile_coder.py similarity index 99% rename from aider/coders/wholefile.py rename to aider/coders/wholefile_coder.py index c8c9ca625..a3f512b3b 100644 --- a/aider/coders/wholefile.py +++ b/aider/coders/wholefile_coder.py @@ -3,7 +3,7 @@ from pathlib import Path from aider import diffs -from .base import Coder +from .base_coder import Coder from .wholefile_prompts import WholeFilePrompts diff --git a/tests/test_coder.py b/tests/test_coder.py index 3ccca462a..95afec175 100644 --- a/tests/test_coder.py +++ b/tests/test_coder.py @@ -11,7 +11,7 @@ from aider.coders import Coder class TestCoder(unittest.TestCase): def setUp(self): - self.patcher = patch("aider.coders.base.check_model_availability") + self.patcher = patch("aider.coders.base_coder.check_model_availability") self.mock_check = self.patcher.start() self.mock_check.return_value = True @@ -121,7 +121,7 @@ class TestCoder(unittest.TestCase): # Assert that the returned message is the expected one self.assertEqual(result, 'a good "commit message"') - @patch("aider.coders.base.openai.ChatCompletion.create") + @patch("aider.coders.base_coder.openai.ChatCompletion.create") @patch("builtins.print") def test_send_with_retries_rate_limit_error(self, mock_print, mock_chat_completion_create): # Mock the IO object @@ -143,7 +143,7 @@ class TestCoder(unittest.TestCase): # Assert that print was called once mock_print.assert_called_once() - @patch("aider.coders.base.openai.ChatCompletion.create") + @patch("aider.coders.base_coder.openai.ChatCompletion.create") @patch("builtins.print") def test_send_with_retries_connection_error(self, mock_print, mock_chat_completion_create): # Mock the IO object diff --git a/tests/test_editblock.py b/tests/test_editblock.py index 9c0f7b1e3..1c140223b 100644 --- a/tests/test_editblock.py +++ b/tests/test_editblock.py @@ -2,7 +2,7 @@ import unittest -from aider.coders import editblock +from aider.coders import editblock_coder as eb class TestUtils(unittest.TestCase): @@ -12,7 +12,7 @@ class TestUtils(unittest.TestCase): replace = "This is a replaced text." expected_output = "This is a replaced text..\nAnother line of text.\nYet another line.\n" - result = editblock.replace_most_similar_chunk(whole, part, replace) + result = eb.replace_most_similar_chunk(whole, part, replace) self.assertEqual(result, expected_output) def test_replace_most_similar_chunk_not_perfect_match(self): @@ -21,7 +21,7 @@ class TestUtils(unittest.TestCase): replace = "This is a replaced text.\nModified line of text." expected_output = "This is a replaced text.\nModified line of text.\nYet another line." - result = editblock.replace_most_similar_chunk(whole, part, replace) + result = eb.replace_most_similar_chunk(whole, part, replace) self.assertEqual(result, expected_output) def test_strip_quoted_wrapping(self): @@ -29,19 +29,19 @@ class TestUtils(unittest.TestCase): "filename.ext\n```\nWe just want this content\nNot the filename and triple quotes\n```" ) expected_output = "We just want this content\nNot the filename and triple quotes\n" - result = editblock.strip_quoted_wrapping(input_text, "filename.ext") + result = eb.strip_quoted_wrapping(input_text, "filename.ext") self.assertEqual(result, expected_output) def test_strip_quoted_wrapping_no_filename(self): input_text = "```\nWe just want this content\nNot the triple quotes\n```" expected_output = "We just want this content\nNot the triple quotes\n" - result = editblock.strip_quoted_wrapping(input_text) + result = eb.strip_quoted_wrapping(input_text) self.assertEqual(result, expected_output) def test_strip_quoted_wrapping_no_wrapping(self): input_text = "We just want this content\nNot the triple quotes\n" expected_output = "We just want this content\nNot the triple quotes\n" - result = editblock.strip_quoted_wrapping(input_text) + result = eb.strip_quoted_wrapping(input_text) self.assertEqual(result, expected_output) def test_find_original_update_blocks(self): @@ -60,7 +60,7 @@ Tooooo Hope you like it! """ - edits = list(editblock.find_original_update_blocks(edit)) + edits = list(eb.find_original_update_blocks(edit)) self.assertEqual(edits, [("foo.txt", "Two\n", "Tooooo\n")]) def test_find_original_update_blocks_quote_below_filename(self): @@ -79,7 +79,7 @@ Tooooo Hope you like it! """ - edits = list(editblock.find_original_update_blocks(edit)) + edits = list(eb.find_original_update_blocks(edit)) self.assertEqual(edits, [("foo.txt", "Two\n", "Tooooo\n")]) def test_find_original_update_blocks_unclosed(self): @@ -98,7 +98,7 @@ oops! """ with self.assertRaises(ValueError) as cm: - list(editblock.find_original_update_blocks(edit)) + list(eb.find_original_update_blocks(edit)) self.assertIn("Incomplete", str(cm.exception)) def test_find_original_update_blocks_missing_filename(self): @@ -116,7 +116,7 @@ oops! """ with self.assertRaises(ValueError) as cm: - list(editblock.find_original_update_blocks(edit)) + list(eb.find_original_update_blocks(edit)) self.assertIn("filename", str(cm.exception)) def test_find_original_update_blocks_no_final_newline(self): @@ -152,7 +152,7 @@ aider/coder.py >>>>>>> UPDATED""" # Should not raise a ValueError - list(editblock.find_original_update_blocks(edit)) + list(eb.find_original_update_blocks(edit)) def test_incomplete_edit_block_missing_filename(self): edit = """ @@ -195,7 +195,7 @@ tests/test_repomap.py 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. """ - edit_blocks = list(editblock.find_original_update_blocks(edit)) + edit_blocks = list(eb.find_original_update_blocks(edit)) self.assertEqual(len(edit_blocks), 2) # 2 edits self.assertEqual(edit_blocks[0][0], "tests/test_repomap.py") self.assertEqual(edit_blocks[1][0], "tests/test_repomap.py") @@ -206,7 +206,7 @@ These changes replace the `subprocess.run` patches with `subprocess.check_output replace = "new_line1\nnew_line2" expected_output = " new_line1\n new_line2\n line3\n" - result = editblock.replace_part_with_missing_leading_whitespace(whole, part, replace) + result = eb.replace_part_with_missing_leading_whitespace(whole, part, replace) self.assertEqual(result, expected_output) diff --git a/tests/test_main.py b/tests/test_main.py index a684fe368..cf4e82e38 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -18,7 +18,7 @@ class TestMain(TestCase): self.original_cwd = os.getcwd() self.tempdir = tempfile.mkdtemp() os.chdir(self.tempdir) - self.patcher = patch("aider.coders.base.check_model_availability") + self.patcher = patch("aider.coders.base_coder.check_model_availability") self.mock_check = self.patcher.start() self.mock_check.return_value = True