Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Rename: args -> config in run_xx cli

Kilian Lieret0c06d906d8ee
diff --git a/sweagent/run/common.py b/sweagent/run/common.py
index 1544a25c..418a7aa3 100644
--- a/sweagent/run/common.py
+++ b/sweagent/run/common.py
@@ -72,7 +72,7 @@ class BasicCLI:
self.logger = get_logger("swea-cli", emoji="🔧")
self.help_text = help_text
- def get_args(self, args=None) -> BaseSettings:
+ def get_config(self, args=None) -> BaseSettings:
# The defaults if no config file is provided
# Otherwise, the configs from the respective classes will be used
parser = ArgumentParser(description=__doc__, add_help=False)
@@ -114,7 +114,10 @@ class BasicCLI:
exit(0)
if cli_args.print_options:
- CliApp.run(self.arg_type, ["--help"])
+ CliApp.run(
+ self.arg_type,
+ ["--help"],
+ )
exit(0)
config_merged = {}
diff --git a/sweagent/run/run_batch.py b/sweagent/run/run_batch.py
index 8aaf35f8..2b4d2f18 100644
--- a/sweagent/run/run_batch.py
+++ b/sweagent/run/run_batch.py
@@ -287,14 +287,14 @@ class RunBatch:
remove_file_handler(f"{instance_id}-{level}")
-def run_from_config(args: RunBatchConfig):
- RunBatch.from_config(args).main()
+def run_from_config(config: RunBatchConfig):
+ RunBatch.from_config(config).main()
def run_from_cli(args: list[str] | None = None):
if args is None:
args = sys.argv[1:]
- run_from_config(BasicCLI(RunBatchConfig).get_args(args)) # type: ignore
+ run_from_config(BasicCLI(RunBatchConfig).get_config(args)) # type: ignore
if __name__ == "__main__":
diff --git a/sweagent/run/run_replay.py b/sweagent/run/run_replay.py
index fc76e52e..9ec0bae5 100644
--- a/sweagent/run/run_replay.py
+++ b/sweagent/run/run_replay.py
@@ -118,14 +118,14 @@ class RunReplay:
run_single.run()
-def run_from_config(args: RunReplayConfig):
- RunReplay.from_config(args).main()
+def run_from_config(config: RunReplayConfig):
+ RunReplay.from_config(config).main()
def run_from_cli(args: list[str] | None = None):
if args is None:
args = sys.argv[1:]
- run_from_config(BasicCLI(RunReplayConfig, default_settings=False).get_args(args)) # type: ignore
+ run_from_config(BasicCLI(RunReplayConfig, default_settings=False).get_config(args)) # type: ignore
if __name__ == "__main__":
diff --git a/sweagent/run/run_single.py b/sweagent/run/run_single.py
index f18782d3..e2651d59 100644
--- a/sweagent/run/run_single.py
+++ b/sweagent/run/run_single.py
@@ -184,14 +184,14 @@ class RunSingle:
self.env.close()
-def run_from_config(args: RunSingleConfig):
- RunSingle.from_config(args).run()
+def run_from_config(config: RunSingleConfig):
+ RunSingle.from_config(config).run()
def run_from_cli(args: list[str] | None = None):
if args is None:
args = sys.argv[1:]
- run_from_config(BasicCLI(RunSingleConfig, help_text=__doc__).get_args(args)) # type: ignore
+ run_from_config(BasicCLI(RunSingleConfig, help_text=__doc__).get_config(args)) # type: ignore
if __name__ == "__main__":
diff --git a/tests/test_run_single.py b/tests/test_run_single.py
index 57b8ca0d..48e791df 100644
--- a/tests/test_run_single.py
+++ b/tests/test_run_single.py
@@ -87,7 +87,7 @@ def test_run_ies_repo_ps_matrix(
*repo_args,
]
print(args)
- rs_config = BasicCLI(RunSingleConfig).get_args(args)
+ rs_config = BasicCLI(RunSingleConfig).get_config(args)
print(rs_config)
rs = RunSingle.from_config(rs_config) # type: ignore
with tmpdir.as_cwd():
diff --git a/tools/defaults/bin/create b/tools/defaults/bin/create
index 92abc456..9a4f7b2e 100644
--- a/tools/defaults/bin/create
+++ b/tools/defaults/bin/create
@@ -1,6 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
-source /root/tools/defaults/lib/utils.sh
main() {
local filename="${1:-}"