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): Correct viewport expansion
Kilian Lieret43de78f30b33
diff --git a/tools/edit_anthropic/bin/str_replace_editor b/tools/edit_anthropic/bin/str_replace_editorindex c7778dbe..23ffac64 100644--- a/tools/edit_anthropic/bin/str_replace_editor+++ b/tools/edit_anthropic/bin/str_replace_editor@@ -137,18 +137,16 @@ class WindowExpander:if next_line == "":# Double new blank line:score = 2- if score > best_score:- best_score = score- # The breakpoint is the previous line- best_breakpoint = i_line - directionif self.suffix == ".py" and any(re.match(r"^\s*" + keyword + r"\s+", line) for keyword in ["def", "class", "@"]):# We include decorators here, because they are always on top of the function/class definitionscore = 3- if score > best_score:- best_score = score- best_breakpoint = i_line - direction+ if score > best_score:+ best_score = score+ best_breakpoint = i_line+ if direction == 1 and i_line != current_line:+ best_breakpoint -= 1if i_line == 1 or i_line == len(lines):score = 3if score > best_score: