Skip to content

Commit e23feba

Browse files
committed
pre-commit
1 parent 80407fb commit e23feba

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

commit0/harness/evaluate.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22
import os
3-
import traceback
43
from collections import Counter
54

65
from concurrent.futures import ThreadPoolExecutor, as_completed
@@ -43,7 +42,6 @@ def main(
4342
log_dir = RUN_PYTEST_LOG_DIR / repo_name / branch / hashed_test_ids
4443
log_dirs.append(str(log_dir))
4544

46-
4745
with tqdm(total=len(repos), smoothing=0, desc="Evaluating repos") as pbar:
4846
with ThreadPoolExecutor(max_workers=num_workers) as executor:
4947
# Create a future for running each instance

commit0/harness/run_pytest_ids.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ def main(
4949
dataset: Iterator[RepoInstance] = load_dataset(dataset_name, split=dataset_split) # type: ignore
5050
spec = None
5151
example = None
52+
repo_name = None
5253
for example in dataset:
5354
repo_name = example["repo"].split("/")[-1]
5455
if repo_name in os.path.basename(repo_or_repo_dir):
5556
spec = make_spec(example)
5657
break
5758
assert spec is not None, "No spec available"
5859
assert example is not None, "No example available"
60+
assert repo_name is not None, "No repo available"
5961

6062
hashed_test_ids = get_hash_string(test_ids)
6163
# set up logging
@@ -66,13 +68,15 @@ def main(
6668

6769
try:
6870
local_repo = git.Repo(repo_or_repo_dir)
69-
except git.exc.NoSuchPathError:
71+
except git.exc.NoSuchPathError: # type: ignore
7072
repo_dir = os.path.join(base_dir, repo_name)
7173
logger.error(f"{repo_or_repo_dir} is not a git dir, trying {repo_dir} again")
7274
try:
7375
local_repo = git.Repo(repo_dir)
74-
except git.exc.NoSuchPathError:
75-
raise Exception(f"{repo_dir} and {repo_or_repo_dir} are not git directories.\nUsage: commit0 test {{repo_dir}} {test_ids}")
76+
except git.exc.NoSuchPathError: # type: ignore
77+
raise Exception(
78+
f"{repo_dir} and {repo_or_repo_dir} are not git directories.\nUsage: commit0 test {{repo_dir}} {test_ids}"
79+
)
7680
except Exception as e:
7781
raise e
7882
if branch == "reference":
@@ -123,7 +127,9 @@ def main(
123127
try:
124128
pytest_exit_code = int(pytest_exit_code)
125129
except Exception:
126-
raise Exception(f"Fail to convert pytest_exit_code {pytest_exit_code} into an integer.")
130+
raise Exception(
131+
f"Fail to convert pytest_exit_code {pytest_exit_code} into an integer."
132+
)
127133
sys.exit(pytest_exit_code)
128134
except EvaluationError as e:
129135
error_msg = (

0 commit comments

Comments
 (0)