Skip to content

Commit 245c4ec

Browse files
committed
fixes type errors
1 parent 958155a commit 245c4ec

File tree

2 files changed

+7
-33
lines changed

2 files changed

+7
-33
lines changed

commit0/cli.py

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from pathlib import Path
33
from typing import Union, List
44
from typing_extensions import Annotated
5-
from datasets import load_dataset
65
import commit0.harness.run_pytest_ids
76
import commit0.harness.get_pytest_ids
87
import commit0.harness.build
@@ -119,10 +118,7 @@ def setup(
119118
) -> None:
120119
"""Commit0 clone a repo split."""
121120
check_commit0_path()
122-
if "swe" in dataset_name.lower():
123-
SWE_SPLIT = load_dataset(dataset_name, split=dataset_split)["instance_id"]
124-
check_valid(repo_split, SWE_SPLIT)
125-
else:
121+
if "commit0" in dataset_name.lower():
126122
check_valid(repo_split, SPLIT)
127123

128124
base_dir = str(Path(base_dir).resolve())
@@ -173,12 +169,7 @@ def build(
173169
check_commit0_path()
174170

175171
commit0_config = read_commit0_dot_file(commit0_dot_file_path)
176-
if "swe" in commit0_config["dataset_name"].lower():
177-
SWE_SPLIT = load_dataset(
178-
commit0_config["dataset_name"], split=commit0_config["dataset_split"]
179-
)["instance_id"]
180-
check_valid(commit0_config["repo_split"], SWE_SPLIT)
181-
else:
172+
if "commit0" in commit0_config["dataset_name"].lower():
182173
check_valid(commit0_config["repo_split"], SPLIT)
183174

184175
typer.echo(
@@ -210,10 +201,7 @@ def get_tests(
210201
) -> None:
211202
"""Get tests for a Commit0 repository."""
212203
check_commit0_path()
213-
SWE_SPLIT = load_dataset("princeton-nlp/SWE-bench_Verified", split="test")[
214-
"instance_id"
215-
]
216-
check_valid(repo_name, SPLIT_ALL + SWE_SPLIT)
204+
check_valid(repo_name, SPLIT_ALL)
217205

218206
commit0.harness.get_pytest_ids.main(repo_name, verbose=1)
219207

@@ -264,12 +252,7 @@ def test(
264252
commit0_config = read_commit0_dot_file(commit0_dot_file_path)
265253
if repo_or_repo_path.endswith("/"):
266254
repo_or_repo_path = repo_or_repo_path[:-1]
267-
if "swe" in commit0_config["dataset_name"].lower():
268-
SWE_SPLIT = load_dataset(
269-
commit0_config["dataset_name"], split=commit0_config["dataset_split"]
270-
)["instance_id"]
271-
check_valid(repo_or_repo_path.split("/")[-1], SWE_SPLIT)
272-
else:
255+
if "commit0" in commit0_config["dataset_name"].lower():
273256
check_valid(repo_or_repo_path.split("/")[-1], SPLIT)
274257

275258
if reference:
@@ -335,12 +318,7 @@ def evaluate(
335318
branch = "reference"
336319

337320
commit0_config = read_commit0_dot_file(commit0_dot_file_path)
338-
if "swe" in commit0_config["dataset_name"].lower():
339-
SWE_SPLIT = load_dataset(
340-
commit0_config["dataset_name"], split=commit0_config["dataset_split"]
341-
)["instance_id"]
342-
check_valid(commit0_config["repo_split"], SWE_SPLIT)
343-
else:
321+
if "commit0" in commit0_config["dataset_name"].lower():
344322
check_valid(commit0_config["repo_split"], SPLIT)
345323

346324
typer.echo(f"Evaluating repository split: {commit0_config['repo_split']}")
@@ -416,12 +394,7 @@ def save(
416394
"""Save Commit0 split you choose in Setup Stage to GitHub."""
417395
check_commit0_path()
418396
commit0_config = read_commit0_dot_file(commit0_dot_file_path)
419-
if "swe" in commit0_config["dataset_name"].lower():
420-
SWE_SPLIT = load_dataset(
421-
commit0_config["dataset_name"], split=commit0_config["dataset_split"]
422-
)["instance_id"]
423-
check_valid(commit0_config["repo_split"], SWE_SPLIT)
424-
else:
397+
if "commit0" in commit0_config["dataset_name"].lower():
425398
check_valid(commit0_config["repo_split"], SPLIT)
426399

427400
typer.echo(f"Saving repository split: {commit0_config['repo_split']}")

commit0/harness/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55

66
class RepoInstance(TypedDict):
7+
instance_id: str
78
repo: str
89
base_commit: str
910
reference_commit: str

0 commit comments

Comments
 (0)