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]

Tools: Two more compatibility issues

Kilian Lieretd23f497abfaf
diff --git a/tools/defaults/lib/default_utils.py b/tools/defaults/lib/default_utils.py
index 494f958a..2377e592 100644
--- a/tools/defaults/lib/default_utils.py
+++ b/tools/defaults/lib/default_utils.py
@@ -3,7 +3,7 @@ import os
from collections.abc import Generator
from dataclasses import dataclass
from pathlib import Path
-from typing import Any, Optional, Union
+from typing import Any, Optional, Tuple, Union
from typing_extensions import Literal
@@ -172,7 +172,7 @@ class WindowedFile:
return len(self.text.splitlines())
@property
- def line_range(self) -> tuple[int, int]:
+ def line_range(self) -> Tuple[int, int]:
"""Return first and last line (inclusive) of the display window, such
that exactly `window` many lines are displayed.
This means `line_range[1] - line_range[0] == window-1` as long as there are
@@ -202,7 +202,7 @@ class WindowedFile:
return "\n".join(out_lines)
def set_window_text(
- self, new_text: str, *, line_range: Optional[tuple[int, int]] = None
+ self, new_text: str, *, line_range: Optional[Tuple[int, int]] = None
) -> None:
"""Replace the text in the current display window with a new string.
diff --git a/tools/edit_linting/bin/edit b/tools/edit_linting/bin/edit
index 1a7c00fd..7560bd4a 100644
--- a/tools/edit_linting/bin/edit
+++ b/tools/edit_linting/bin/edit
@@ -2,7 +2,8 @@
import argparse
import sys
-from typing import Union
+from typing import Tuple, Union
+
try:
from sweagent import TOOLS_DIR
except ImportError:
@@ -48,7 +49,7 @@ def get_parser() -> argparse.ArgumentParser:
return parser
-def parse_line_range(line_range: str) -> tuple[int, int]:
+def parse_line_range(line_range: str) -> Tuple[int, int]:
try:
start, end = map(int, line_range.split(":"))
return start - 1, end # Convert to 0-based indexing for start line