mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
fix: Remove unused get_last_modified
method from Coder
class
This commit is contained in:
parent
8a4409dd05
commit
d7279a1129
2 changed files with 0 additions and 29 deletions
|
@ -1558,12 +1558,6 @@ class Coder:
|
||||||
files = [self.abs_root_path(path) for path in files]
|
files = [self.abs_root_path(path) for path in files]
|
||||||
return files
|
return files
|
||||||
|
|
||||||
def get_last_modified(self):
|
|
||||||
files = [Path(fn) for fn in self.get_all_abs_files() if Path(fn).exists()]
|
|
||||||
if not files:
|
|
||||||
return 0
|
|
||||||
return max(path.stat().st_mtime for path in files)
|
|
||||||
|
|
||||||
def get_addable_relative_files(self):
|
def get_addable_relative_files(self):
|
||||||
all_files = set(self.get_all_relative_files())
|
all_files = set(self.get_all_relative_files())
|
||||||
inchat_files = set(self.get_inchat_relative_files())
|
inchat_files = set(self.get_inchat_relative_files())
|
||||||
|
|
|
@ -95,29 +95,6 @@ class TestCoder(unittest.TestCase):
|
||||||
self.assertTrue(coder.allowed_to_edit("added.txt"))
|
self.assertTrue(coder.allowed_to_edit("added.txt"))
|
||||||
self.assertTrue(coder.need_commit_before_edits)
|
self.assertTrue(coder.need_commit_before_edits)
|
||||||
|
|
||||||
def test_get_last_modified(self):
|
|
||||||
# Mock the IO object
|
|
||||||
mock_io = MagicMock()
|
|
||||||
|
|
||||||
with GitTemporaryDirectory():
|
|
||||||
repo = git.Repo(Path.cwd())
|
|
||||||
fname = Path("new.txt")
|
|
||||||
fname.touch()
|
|
||||||
repo.git.add(str(fname))
|
|
||||||
repo.git.commit("-m", "new")
|
|
||||||
|
|
||||||
# Initialize the Coder object with the mocked IO and mocked repo
|
|
||||||
coder = Coder.create(self.GPT35, None, mock_io)
|
|
||||||
|
|
||||||
mod = coder.get_last_modified()
|
|
||||||
|
|
||||||
fname.write_text("hi")
|
|
||||||
mod_newer = coder.get_last_modified()
|
|
||||||
self.assertLess(mod, mod_newer)
|
|
||||||
|
|
||||||
fname.unlink()
|
|
||||||
self.assertEqual(coder.get_last_modified(), 0)
|
|
||||||
|
|
||||||
def test_get_files_content(self):
|
def test_get_files_content(self):
|
||||||
tempdir = Path(tempfile.mkdtemp())
|
tempdir = Path(tempfile.mkdtemp())
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue