mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
lint
This commit is contained in:
parent
14f863e732
commit
d279f9751f
1 changed files with 13 additions and 9 deletions
22
coder.py
22
coder.py
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import readline
|
import readline
|
||||||
|
@ -34,6 +35,7 @@ except FileNotFoundError:
|
||||||
|
|
||||||
openai.api_key = os.getenv("OPENAI_API_KEY")
|
openai.api_key = os.getenv("OPENAI_API_KEY")
|
||||||
|
|
||||||
|
|
||||||
def find_index(list1, list2):
|
def find_index(list1, list2):
|
||||||
for i in range(len(list1)):
|
for i in range(len(list1)):
|
||||||
if list1[i : i + len(list2)] == list2:
|
if list1[i : i + len(list2)] == list2:
|
||||||
|
@ -205,14 +207,14 @@ class Coder:
|
||||||
|
|
||||||
res = self.commit(history=self.cur_messages)
|
res = self.commit(history=self.cur_messages)
|
||||||
if res:
|
if res:
|
||||||
commit_hash,commit_message = res
|
commit_hash, commit_message = res
|
||||||
|
|
||||||
saved_message = prompts.files_content_gpt_edits.format(
|
saved_message = prompts.files_content_gpt_edits.format(
|
||||||
hash = commit_hash,
|
hash=commit_hash,
|
||||||
message = commit_message,
|
message=commit_message,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.console.print('[red bold]Edits failed to change the files?')
|
self.console.print("[red bold]Edits failed to change the files?")
|
||||||
saved_message = prompts.files_content_gpt_no_edits
|
saved_message = prompts.files_content_gpt_no_edits
|
||||||
|
|
||||||
self.check_for_local_edits(True)
|
self.check_for_local_edits(True)
|
||||||
|
@ -444,7 +446,7 @@ class Coder:
|
||||||
if not repo.is_dirty():
|
if not repo.is_dirty():
|
||||||
return
|
return
|
||||||
|
|
||||||
diffs = ''
|
diffs = ""
|
||||||
dirty_fnames = []
|
dirty_fnames = []
|
||||||
relative_dirty_fnames = []
|
relative_dirty_fnames = []
|
||||||
for fname in self.fnames:
|
for fname in self.fnames:
|
||||||
|
@ -462,7 +464,7 @@ class Coder:
|
||||||
|
|
||||||
diffs = "# Diffs:\n" + diffs
|
diffs = "# Diffs:\n" + diffs
|
||||||
|
|
||||||
#for fname in dirty_fnames:
|
# for fname in dirty_fnames:
|
||||||
# self.console.print(f"[red] {fname}")
|
# self.console.print(f"[red] {fname}")
|
||||||
|
|
||||||
context = ""
|
context = ""
|
||||||
|
@ -497,12 +499,14 @@ class Coder:
|
||||||
self.console.print(f"[red]Suggested commit message:\n{commit_message}\n")
|
self.console.print(f"[red]Suggested commit message:\n{commit_message}\n")
|
||||||
|
|
||||||
if ask:
|
if ask:
|
||||||
res = Prompt.ask("[red]Commit before the chat proceeds? \[y/n/commit message]").strip()
|
res = Prompt.ask(
|
||||||
|
"[red]Commit before the chat proceeds? \[y/n/commit message]"
|
||||||
|
).strip()
|
||||||
|
|
||||||
if res.lower() in ['n', 'no']:
|
if res.lower() in ["n", "no"]:
|
||||||
self.console.print("[red]Skipped commmit.")
|
self.console.print("[red]Skipped commmit.")
|
||||||
return
|
return
|
||||||
if res.lower() not in ['y', 'yes']:
|
if res.lower() not in ["y", "yes"]:
|
||||||
commit_message = res
|
commit_message = res
|
||||||
|
|
||||||
repo.git.add(*relative_dirty_fnames)
|
repo.git.add(*relative_dirty_fnames)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue