mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
fixed regex; black config
This commit is contained in:
parent
a73ad25c55
commit
36fe08ae13
2 changed files with 13 additions and 9 deletions
|
@ -3,6 +3,7 @@ repos:
|
||||||
rev: 23.3.0
|
rev: 23.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
|
args: ["--line-length", "90", "--preview"]
|
||||||
- repo: https://github.com/pycqa/flake8
|
- repo: https://github.com/pycqa/flake8
|
||||||
rev: 6.0.0
|
rev: 6.0.0
|
||||||
hooks:
|
hooks:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
@ -112,9 +113,7 @@ class Coder:
|
||||||
self.console.print(f"[bright_black]Files not tracked in {repo.git_dir}:")
|
self.console.print(f"[bright_black]Files not tracked in {repo.git_dir}:")
|
||||||
for fn in new_files:
|
for fn in new_files:
|
||||||
self.console.print(f"[bright_black] {fn}")
|
self.console.print(f"[bright_black] {fn}")
|
||||||
if Confirm.ask(
|
if Confirm.ask("[bright_black]Add them?", console=self.console, default="y"):
|
||||||
"[bright_black]Add them?", console=self.console, default="y"
|
|
||||||
):
|
|
||||||
for relative_fname in new_files:
|
for relative_fname in new_files:
|
||||||
repo.git.add(relative_fname)
|
repo.git.add(relative_fname)
|
||||||
self.console.print(
|
self.console.print(
|
||||||
|
@ -347,12 +346,12 @@ class Coder:
|
||||||
# Optional: Matches the start of a code block (e.g., ```python) and any following whitespace
|
# Optional: Matches the start of a code block (e.g., ```python) and any following whitespace
|
||||||
r"(^```\S*\s*)?"
|
r"(^```\S*\s*)?"
|
||||||
# Matches the file path
|
# Matches the file path
|
||||||
r"^((?:[a-zA-Z]:\\|/)?(?:[\w\s.-]+[\\/])*(?:\w+|\.\w+)(\.[\w\s.-]+)*)"
|
r"^(\S*)\s*"
|
||||||
# Optional: Matches the end of a code block (e.g., ```) and any following whitespace
|
# Optional: Matches the end of a code block (e.g., ```) and any following whitespace
|
||||||
r"\s+(^```\S*\s*)?"
|
r"(^```\S*\s*)?"
|
||||||
# Matches the start of the ORIGINAL section and captures its content
|
# Matches the start of the ORIGINAL section and captures its content
|
||||||
r"^<<<<<<< ORIGINAL\n(.*?\n?)"
|
r"^<<<<<<< ORIGINAL\n(.*?\n?)"
|
||||||
# Matches the separator between ORIGINAL and UPDATED sections and captures the UPDATED content
|
# Matches sep between ORIGINAL and UPDATED sections, captures UPDATED content
|
||||||
r"^=======\n(.*?)"
|
r"^=======\n(.*?)"
|
||||||
# Matches the end of the UPDATED section
|
# Matches the end of the UPDATED section
|
||||||
r"^>>>>>>> UPDATED",
|
r"^>>>>>>> UPDATED",
|
||||||
|
@ -362,7 +361,8 @@ class Coder:
|
||||||
def update_files(self, content, inp):
|
def update_files(self, content, inp):
|
||||||
edited = set()
|
edited = set()
|
||||||
for match in self.pattern.finditer(content):
|
for match in self.pattern.finditer(content):
|
||||||
_, path, _, _, original, updated = match.groups()
|
dump(match.groups())
|
||||||
|
_, path, _, original, updated = match.groups()
|
||||||
|
|
||||||
path = path.strip()
|
path = path.strip()
|
||||||
|
|
||||||
|
@ -370,7 +370,9 @@ class Coder:
|
||||||
|
|
||||||
if full_path not in self.abs_fnames:
|
if full_path not in self.abs_fnames:
|
||||||
if not Path(full_path).exists():
|
if not Path(full_path).exists():
|
||||||
question = f"[bright_black]Allow creation of new file {path}?" # noqa: E501
|
question = (
|
||||||
|
f"[bright_black]Allow creation of new file {path}?" # noqa: E501
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
question = f"[bright_black]Allow edits to {path} which was not previously provided?" # noqa: E501
|
question = f"[bright_black]Allow edits to {path} which was not previously provided?" # noqa: E501
|
||||||
if not Confirm.ask(question, console=self.console, default="y"):
|
if not Confirm.ask(question, console=self.console, default="y"):
|
||||||
|
@ -454,7 +456,8 @@ class Coder:
|
||||||
|
|
||||||
if interrupted:
|
if interrupted:
|
||||||
self.console.print(
|
self.console.print(
|
||||||
"[red]Unable to get commit message from gpt-3.5-turbo. Use /commit to try again.\n"
|
"[red]Unable to get commit message from gpt-3.5-turbo. Use /commit to try"
|
||||||
|
" again.\n"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue