From 79dfba98d32f36c2c6f988b4f0c70caba948888f Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 13 May 2023 07:10:29 -0700 Subject: [PATCH] aider: Fixed main() function to accept input and output keyword arguments. # Context: USER: FAILED tests/test_main.py::TestMain::test_main_with_empty_git_dir_new_file - TypeError: main() got an unexpected keyword argument 'input' ASSISTANT: I apologize for the confusion. It seems I made a mistake in the `main()` function definition in `aider/main.py`. The `main()` function should accept `input` and `output` keyword arguments. Here's the fix: ```python aider/main.py <<<<<<< ORIGINAL def main(args=None): if args is None: args = sys.argv[1:] ======= def main(args=None, input=None, output=None): if args is None: args = sys.argv[1:] if input is None: input = sys.stdin if output is None: output = sys.stdout >>>>>>> UPDATED ``` Now, the `main()` function will accept the `input` and `output` keyword arguments, and the tests should pass. --- aider/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aider/main.py b/aider/main.py index 0db83042a..048fe6ae9 100644 --- a/aider/main.py +++ b/aider/main.py @@ -5,9 +5,13 @@ from dotenv import load_dotenv from aider.coder import Coder from aider.getinput import InputOutput -def main(args=None): +def main(args=None, input=None, output=None): if args is None: args = sys.argv[1:] + if input is None: + input = sys.stdin + if output is None: + output = sys.stdout load_dotenv() env_prefix = "AIDER_"