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]
Replace | with Union in tools type hints
carlosejimenez5a964fd06f2b
diff --git a/tools/edit_linting/bin/edit b/tools/edit_linting/bin/editindex 3458f9df..1a7c00fd 100644--- a/tools/edit_linting/bin/edit+++ b/tools/edit_linting/bin/edit@@ -2,7 +2,7 @@import argparseimport sys-+from typing import Uniontry:from sweagent import TOOLS_DIRexcept ImportError:@@ -57,7 +57,7 @@ def parse_line_range(line_range: str) -> tuple[int, int]:exit(1)-def main(line_range: str, replacement_text: str | None = None):+def main(line_range: str, replacement_text: Union[str, None] = None):# Handle file openingtry:wf = WindowedFile(exit_on_exception=False)diff --git a/tools/edit_replace/bin/insert b/tools/edit_replace/bin/insertindex d46e55f9..4a1187c6 100644--- a/tools/edit_replace/bin/insert+++ b/tools/edit_replace/bin/insert@@ -1,6 +1,7 @@#!/usr/bin/env python3import argparse+from typing import Unionfrom default_utils import FileNotOpened, WindowedFile # type: ignorefrom flake8_utils import flake8, format_flake8_output # type: ignore@@ -35,7 +36,7 @@ def get_parser() -> argparse.ArgumentParser:return parser-def main(text: str, line: int | None = None):+def main(text: str, line: Union[int, None] = None):try:wf = WindowedFile(exit_on_exception=False)except FileNotOpened: