Skip to content

Commit 9f7552a

Browse files
committed
fix: correct some typings
1 parent 77c706b commit 9f7552a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

swebench/harness/test_spec.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import re
55

66
from dataclasses import dataclass
7-
from typing import Any, Union
7+
from typing import Any, Union, cast
88

99
from swebench.harness.constants import (
1010
SWEbenchInstance,
@@ -37,9 +37,9 @@ class TestSpec:
3737
instance_id: str
3838
repo: str
3939
version: str
40-
repo_script_list: str
41-
eval_script_list: str
42-
env_script_list: str
40+
repo_script_list: list[str]
41+
eval_script_list: list[str]
42+
env_script_list: list[str]
4343
arch: str
4444
FAIL_TO_PASS: list[str]
4545
PASS_TO_PASS: list[str]
@@ -104,15 +104,15 @@ def platform(self):
104104
return "linux/arm64/v8"
105105
else:
106106
raise ValueError(f"Invalid architecture: {self.arch}")
107-
107+
108108

109109
def get_test_specs_from_dataset(dataset: Union[list[SWEbenchInstance], list[TestSpec]]) -> list[TestSpec]:
110110
"""
111111
Idempotent function that converts a list of SWEbenchInstance objects to a list of TestSpec objects.
112112
"""
113113
if isinstance(dataset[0], TestSpec):
114-
return dataset
115-
return list(map(make_test_spec, dataset))
114+
return cast(list[TestSpec], dataset)
115+
return list(map(make_test_spec, cast(list[SWEbenchInstance], dataset)))
116116

117117

118118
def make_repo_script_list(specs, repo, repo_directory, base_commit, env_name):

0 commit comments

Comments
 (0)