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]
CI: Add flake8 simplify
Kilian Lieret199ed84a11bc
diff --git a/pyproject.toml b/pyproject.tomlindex 7e91130a..f868b35c 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -161,6 +161,8 @@ select = ["COM812", # use trailing commas# pytest"PT",+ # flake8-simplify (SIM)+ "SIM201",]ignore = [# flake8-returndiff --git a/run.py b/run.pyindex 5b0d0953..cee1bd22 100644--- a/run.py+++ b/run.py@@ -192,7 +192,7 @@ class SaveApplyPatchHook(MainHook):if not self._is_promising_patch(info):returnassert self._instance # mypy- if not self._instance["repo_type"] == "local":+ if self._instance["repo_type"] != "local":returnlocal_dir = Path(self._instance["repo"])self._apply_patch(patch_path, local_dir)diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.pyindex b53b789b..6d6a75b9 100644--- a/sweagent/environment/swe_env.py+++ b/sweagent/environment/swe_env.py@@ -912,7 +912,7 @@ class SWEEnv(gym.Env):# If `--repo_path` was specified with a different github URL, then the record will contain# the forking userassert self.record is not None- if not self.record["repo_type"] == "github":+ if self.record["repo_type"] != "github":# We already validated that `--data_path` is a github issue URL# so this is the only case where we can reach heremsg = "--repo_path must point to a github URL if --open_pr is set"diff --git a/sweagent/environment/utils.py b/sweagent/environment/utils.pyindex 0292e96e..ed267a8f 100644--- a/sweagent/environment/utils.py+++ b/sweagent/environment/utils.py@@ -724,7 +724,7 @@ def get_associated_commit_urls(org: str, repo: str, issue_number: str, *, token:events = api.issues.list_events(org, repo, issue_number)commit_urls = []for event in events:- if not event.event == "referenced":+ if event.event != "referenced":continueif not event.commit_id:continue