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]
chore: update pre-commit hooks (#886)
pre-commit-ci[bot]f698f245b06c
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 57936d29..f06c68cd 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -15,14 +15,14 @@ repos:- id: trailing-whitespace- repo: https://github.com/crate-ci/typos- rev: typos-dict-v0.11.37+ rev: typos-dict-v0.12.4hooks:- id: typosfiles: \.(py|md|rst|yaml|toml)exclude: pyproject.toml- repo: https://github.com/astral-sh/ruff-pre-commit- rev: v0.8.2+ rev: v0.9.4hooks:# Run the linter.- id: ruffdiff --git a/sweagent/agent/history_processors.py b/sweagent/agent/history_processors.pyindex d3040015..456d49d2 100644--- a/sweagent/agent/history_processors.py+++ b/sweagent/agent/history_processors.py@@ -67,10 +67,10 @@ class LastNObservations(BaseModel):new_history.append(entry)else:data = entry.copy()- assert (- data["message_type"] == "observation"- ), f"Expected observation for dropped entry, got: {data['message_type']}"- data["content"] = f'Old environment output: ({len(entry["content"].splitlines())} lines omitted)'+ assert data["message_type"] == "observation", (+ f"Expected observation for dropped entry, got: {data['message_type']}"+ )+ data["content"] = f"Old environment output: ({len(entry['content'].splitlines())} lines omitted)"new_history.append(data)return new_historydiff --git a/sweagent/agent/models.py b/sweagent/agent/models.pyindex 6ec68f4b..2ae2aefa 100644--- a/sweagent/agent/models.py+++ b/sweagent/agent/models.py@@ -418,9 +418,7 @@ class InstantEmptySubmitTestModel(AbstractModel):)elif self._action_idx == 1:self._action_idx = 0- action = (- "DISCUSSION\n" "The task should be resolved, so let's submit the patch.\n\n" "```\n" "submit\n" "```\n"- )+ action = "DISCUSSION\nThe task should be resolved, so let's submit the patch.\n\n```\nsubmit\n```\n"self.stats.api_calls += 1return {"message": action}diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.pyindex 5d7cea52..8a785cdd 100644--- a/sweagent/environment/swe_env.py+++ b/sweagent/environment/swe_env.py@@ -142,7 +142,7 @@ class SWEEnv:)def close(self) -> None:- """Shoutdown SWE-ReX deployment etc."""+ """Shutdown SWE-ReX deployment etc."""self.logger.info("Beginning environment shutdown...")asyncio.run(self.deployment.stop())self._chook.on_close()diff --git a/sweagent/utils/patch_formatter.py b/sweagent/utils/patch_formatter.pyindex a730eabc..4dfef801 100644--- a/sweagent/utils/patch_formatter.py+++ b/sweagent/utils/patch_formatter.py@@ -70,7 +70,7 @@ class PatchFormatter:out: list[str] = []if starts[0] > 1:# Count from 1- out.append(f"[{starts[0]-1} lines above omitted]")+ out.append(f"[{starts[0] - 1} lines above omitted]")last_stop: int | None = Nonelines = text.splitlines()for start, stop in zip(starts, stops):