From cee1dfd3b9bd0005cbe579ee3807531e33ece7c8 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 11 May 2023 09:13:25 -0700 Subject: [PATCH] aider: Added an `elif` clause for `which == "chat_files"` and a final `else` clause to raise a `ValueError` if the value of `which` is not valid. # Context: USER: nice! in the change the else: to elseif which==chat_files and throw a valueerror as a final else clause ASSISTANT: To update the `commit()` function with the requested changes, we will modify the `if` statement to include an `elif` clause for `which == "chat_files"` and add a final `else` clause to raise a `ValueError`. ```python aider/coder.py <<<<<<< ORIGINAL if which == "repo_files": all_files = [os.path.join(self.root, f) for f in self.get_all_relative_files()] dirty_fnames, relative_dirty_fnames = get_dirty_files(all_files) else: dirty_fnames, relative_dirty_fnames = get_dirty_files(self.abs_fnames) ======= if which == "repo_files": all_files = [os.path.join(self.root, f) for f in self.get_all_relative_files()] dirty_fnames, relative_dirty_fnames = get_dirty_files(all_files) elif which == "chat_files": dirty_fnames, relative_dirty_fnames = get_dirty_files(self.abs_fnames) else: raise ValueError(f"Invalid value for 'which': {which}") >>>>>>> UPDATED ``` This change adds an `elif` clause for `which == "chat_files"` and a final `else` clause to raise a `ValueError` if the value of `which` is not valid. --- aider/coder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aider/coder.py b/aider/coder.py index 053e17f04..a91af3414 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -438,8 +438,10 @@ class Coder: if which == "repo_files": all_files = [os.path.join(self.root, f) for f in self.get_all_relative_files()] dirty_fnames, relative_dirty_fnames = get_dirty_files(all_files) - else: + elif which == "chat_files": dirty_fnames, relative_dirty_fnames = get_dirty_files(self.abs_fnames) + else: + raise ValueError(f"Invalid value for 'which': {which}") repo = self.repo if not repo: return