mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
cleanup Coder params
This commit is contained in:
parent
a59575fa4b
commit
ba9307374e
3 changed files with 19 additions and 22 deletions
|
@ -28,14 +28,21 @@ class Coder:
|
||||||
last_aider_commit_hash = None
|
last_aider_commit_hash = None
|
||||||
last_asked_for_commit_time = 0
|
last_asked_for_commit_time = 0
|
||||||
|
|
||||||
def __init__(self, main_model, fnames, pretty, show_diffs, auto_commits, io, dry_run):
|
def __init__(
|
||||||
|
self,
|
||||||
|
io,
|
||||||
|
main_model="gpt-4",
|
||||||
|
fnames=None,
|
||||||
|
pretty=True,
|
||||||
|
show_diffs=False,
|
||||||
|
auto_commits=True,
|
||||||
|
dry_run=False,
|
||||||
|
):
|
||||||
self.abs_fnames = set()
|
self.abs_fnames = set()
|
||||||
|
|
||||||
self.io = io
|
|
||||||
|
|
||||||
self.cur_messages = []
|
self.cur_messages = []
|
||||||
self.done_messages = []
|
self.done_messages = []
|
||||||
|
|
||||||
|
self.io = io
|
||||||
self.auto_commits = auto_commits
|
self.auto_commits = auto_commits
|
||||||
self.dry_run = dry_run
|
self.dry_run = dry_run
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,6 @@ def main(args=None, input=None, output=None):
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
args = parser.parse_args(args)
|
args = parser.parse_args(args)
|
||||||
fnames = args.files
|
|
||||||
pretty = args.pretty
|
|
||||||
|
|
||||||
io = InputOutput(
|
io = InputOutput(
|
||||||
args.pretty,
|
args.pretty,
|
||||||
|
@ -103,13 +101,13 @@ def main(args=None, input=None, output=None):
|
||||||
io.tool(*sys.argv, log_only=True)
|
io.tool(*sys.argv, log_only=True)
|
||||||
|
|
||||||
coder = Coder(
|
coder = Coder(
|
||||||
args.model,
|
|
||||||
fnames,
|
|
||||||
pretty,
|
|
||||||
args.show_diffs,
|
|
||||||
args.auto_commits,
|
|
||||||
io,
|
io,
|
||||||
args.dry_run,
|
main_model=args.model,
|
||||||
|
fnames=args.files,
|
||||||
|
pretty=args.pretty,
|
||||||
|
show_diffs=args.show_diffs,
|
||||||
|
auto_commits=args.auto_commits,
|
||||||
|
dry_run=args.dry_run,
|
||||||
)
|
)
|
||||||
if args.auto_commits:
|
if args.auto_commits:
|
||||||
coder.commit(ask=True, prefix="wip: ", which="repo_files")
|
coder.commit(ask=True, prefix="wip: ", which="repo_files")
|
||||||
|
|
|
@ -4,6 +4,7 @@ import unittest
|
||||||
from aider.commands import Commands
|
from aider.commands import Commands
|
||||||
from aider.io import InputOutput as IO
|
from aider.io import InputOutput as IO
|
||||||
from aider.coder import Coder
|
from aider.coder import Coder
|
||||||
|
from unittest.mock import MagicMock # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
class TestCommands(unittest.TestCase):
|
class TestCommands(unittest.TestCase):
|
||||||
|
@ -12,18 +13,9 @@ class TestCommands(unittest.TestCase):
|
||||||
os.chdir(tmpdir)
|
os.chdir(tmpdir)
|
||||||
|
|
||||||
io = IO(pretty=False, yes=True)
|
io = IO(pretty=False, yes=True)
|
||||||
coder = Coder(
|
coder = Coder(io)
|
||||||
main_model="gpt-3.5-turbo",
|
|
||||||
fnames=[],
|
|
||||||
pretty=False,
|
|
||||||
show_diffs=False,
|
|
||||||
auto_commits=False,
|
|
||||||
io=io,
|
|
||||||
dry_run=False,
|
|
||||||
)
|
|
||||||
commands = Commands(io, coder)
|
commands = Commands(io, coder)
|
||||||
|
|
||||||
# Mock the Confirm.ask method to return True for creating files
|
|
||||||
with unittest.mock.patch("rich.prompt.Confirm.ask", return_value=True):
|
with unittest.mock.patch("rich.prompt.Confirm.ask", return_value=True):
|
||||||
commands.cmd_add("foo.txt bar.txt")
|
commands.cmd_add("foo.txt bar.txt")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue