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(tools): Handling of @ for window expansion

Kilian Lieret2996d8f84ecd
diff --git a/tools/edit_anthropic/bin/str_replace_editor b/tools/edit_anthropic/bin/str_replace_editor
index 23ffac64..3ba9e6b3 100644
--- a/tools/edit_anthropic/bin/str_replace_editor
+++ b/tools/edit_anthropic/bin/str_replace_editor
@@ -138,7 +138,7 @@ class WindowExpander:
# Double new blank line:
score = 2
if self.suffix == ".py" and any(
- re.match(r"^\s*" + keyword + r"\s+", line) for keyword in ["def", "class", "@"]
+ re.match(regex, line) for regex in [r"^\s*def\s+", r"^\s*class\s+", r"^\s*@"]
):
# We include decorators here, because they are always on top of the function/class definition
score = 3