Forráskód Böngészése

style: Moved argument parsing statements into a separate function (#503)

* style: moved argument parsing into a separate function

* commito

* Update evaluation/regression/conftest.py

---------

Co-authored-by: Robert Brennan <accounts@rbren.io>
Aravind Somaraj 1 éve
szülő
commit
26c9ce132b
2 módosított fájl, 7 hozzáadás és 4 törlés
  1. 0 1
      evaluation/regression/conftest.py
  2. 7 3
      opendevin/main.py

+ 0 - 1
evaluation/regression/conftest.py

@@ -59,7 +59,6 @@ def workspace_dir(test_cases_dir, request):
     test_case_dir = os.path.dirname(request.module.__file__)
     workspace_dir = os.path.join(test_case_dir, 'workspace')
     return workspace_dir
-
 @pytest.fixture
 def model(request):
     """Fixture that provides the model name.

+ 7 - 3
opendevin/main.py

@@ -18,8 +18,8 @@ def read_task_from_stdin() -> str:
     """Read task from stdin."""
     return sys.stdin.read()
 
-async def main():
-    """Main coroutine to run the agent controller with task input flexibility."""
+def parse_arguments():
+    """Parse command-line arguments."""
     parser = argparse.ArgumentParser(description="Run an agent with a specific task")
     parser.add_argument("-d", "--directory", required=True, type=str, help="The working directory for the agent")
     parser.add_argument("-t", "--task", type=str, default="", help="The task for the agent to perform")
@@ -27,7 +27,11 @@ async def main():
     parser.add_argument("-c", "--agent-cls", default="LangchainsAgent", type=str, help="The agent class to use")
     parser.add_argument("-m", "--model-name", default=config.get_or_default("LLM_MODEL", "gpt-4-0125-preview"), type=str, help="The (litellm) model name to use")
     parser.add_argument("-i", "--max-iterations", default=100, type=int, help="The maximum number of iterations to run the agent")
-    args = parser.parse_args()
+    return parser.parse_args()
+
+async def main():
+    """Main coroutine to run the agent controller with task input flexibility."""
+    args = parse_arguments()
 
     # Determine the task source
     if args.file: