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]

Fix flake8 checking

Kilian Lierete3b475987f82
diff --git a/tools/defaults/lib/flake8_utils.py b/tools/defaults/lib/flake8_utils.py
index 20b30478..16783f46 100644
--- a/tools/defaults/lib/flake8_utils.py
+++ b/tools/defaults/lib/flake8_utils.py
@@ -108,4 +108,5 @@ def flake8(file_path: str) -> str:
if Path(file_path).suffix != ".py":
return ""
cmd = registry.get("LINT_COMMAND", "flake8 --isolated --select=F821,F822,F831,E111,E112,E113,E999,E902 {file_path}")
- return subprocess.check_output(cmd.format(file_path=file_path), shell=True).decode("utf-8")
+ out = subprocess.run(cmd.format(file_path=file_path), shell=True, capture_output=True)
+ return out.stdout.decode()
diff --git a/tools/edit_replace/bin/edit b/tools/edit_replace/bin/edit
index 3daaa19a..b71bd873 100644
--- a/tools/edit_replace/bin/edit
+++ b/tools/edit_replace/bin/edit
@@ -43,7 +43,6 @@ This is the original code before your edit
------------------------------------------------
Your changes have NOT been applied. Please fix your edit command and try again.
-You either need to 1) Specify the correct start/end line arguments or 2) Correct your edit code.
DO NOT re-run the same failed edit command. Running it again will lead to the same error.
"""