Skip to content

Commit 9bbba9b

Browse files
clean reset args (#67)
1 parent db60fe9 commit 9bbba9b

File tree

5 files changed

+7
-16
lines changed

5 files changed

+7
-16
lines changed

froggy/envs/aider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ def eval(self, **kwargs):
3030
self.last_eval_obs = utils.cleanup_pytest_output(output)
3131
return self.last_eval_obs
3232

33-
def reset(self, *, seed=None, options: dict = None):
33+
def reset(self, *, options: dict = None):
3434
options = options or {}
3535
self.current_sample = self.dataset[options["task_name"]]
3636

3737
directory = self.current_sample["base_directory"]
3838
self.setup_workspace(directory, entrypoint="python -m pytest -s .")
39-
infos = super().reset()
39+
infos = super().reset(options=options)
4040

4141
# By default, open the only modifiable file.
4242
self.load_current_file(self.current_sample["filename"])

froggy/envs/env.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ def restore(self, *filepaths):
264264
def reset(
265265
self,
266266
*,
267-
seed=None,
268267
options: dict = None,
269-
restore_code=True,
270268
):
271269
"""Resets the environment to the initial state and returns the initial observation"""
272270
self.logger.info(f"Resetting environment")
@@ -279,10 +277,6 @@ def reset(
279277
self.done = False
280278
self.clear_all_observations()
281279
self.empty_event_queue()
282-
self.seed(seed)
283-
284-
if restore_code:
285-
self.restore()
286280

287281
# Notify all tools that the environment is reset and get their observations
288282
self.queue_event(Event.ENV_RESET, source="env")

froggy/envs/mini_nightmare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def eval(self, **kwargs):
3939
self.last_eval_obs = utils.cleanup_pytest_output(output)
4040
return self.last_eval_obs
4141

42-
def reset(self, *, seed=None, options: dict = None):
42+
def reset(self, *, options: dict = None):
4343
options = options or {}
4444
self.current_sample = self.dataset[options["task_name"]]
4545

@@ -50,7 +50,7 @@ def reset(self, *, seed=None, options: dict = None):
5050
debug_entrypoint="python -m pdb -m pytest -s test.py",
5151
)
5252

53-
infos = super().reset()
53+
infos = super().reset(options=options)
5454

5555
# By default, open the only modifiable file.
5656
self.load_current_file(self.current_sample["filename"])

froggy/envs/swe_bench.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def eval(self, **kwargs):
194194
self.last_eval_obs = output
195195
return self.last_eval_obs
196196

197-
def reset(self, *, seed=None, options: dict | None = None):
197+
def reset(self, *, options: dict | None = None):
198198
# TODO: support reset current task, i.e. no options provided.
199199
options = options or {}
200200

@@ -287,7 +287,7 @@ def reset(self, *, seed=None, options: dict | None = None):
287287
# Reset RepoEnv
288288
# TODO: Create a RepoEnv per task and set max_score at initialization.
289289
self.max_score = len(self.fail_to_pass)
290-
infos = super().reset(options=options, restore_code=False)
290+
infos = super().reset(options=options)
291291
assert not self.done, "Tests should be failing before debugging."
292292

293293
return infos

froggy/envs/tests/test_env.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,22 +295,19 @@ def test_directory_tree(tmp_path):
295295
assert result == expected_result
296296

297297

298-
@patch.object(RepoEnv, "restore")
299298
@patch.object(Terminal, "run", return_value=(False, "1 failed, 0 passed"))
300299
@patch.object(RepoEnv, "get_tool")
301300
def test_reset(
302301
mock_get_tool,
303302
mock_eval,
304-
mock_restore,
305303
env,
306304
):
307305
mock_pdb_tool = MagicMock()
308306
mock_pdb_tool.start_pseudo_terminal.return_value = None
309307
mock_pdb_tool.pdb_obs = "PDB started"
310308
mock_get_tool.return_value = mock_pdb_tool
311-
infos = env.reset(seed=42)
309+
infos = env.reset()
312310

313-
mock_restore.assert_called_once()
314311
mock_eval.assert_called_once()
315312
assert env.current_file is None
316313
assert env.current_file_content is None

0 commit comments

Comments
 (0)