@@ -49,13 +49,15 @@ def main(
49
49
dataset : Iterator [RepoInstance ] = load_dataset (dataset_name , split = dataset_split ) # type: ignore
50
50
spec = None
51
51
example = None
52
+ repo_name = None
52
53
for example in dataset :
53
54
repo_name = example ["repo" ].split ("/" )[- 1 ]
54
55
if repo_name in os .path .basename (repo_or_repo_dir ):
55
56
spec = make_spec (example )
56
57
break
57
58
assert spec is not None , "No spec available"
58
59
assert example is not None , "No example available"
60
+ assert repo_name is not None , "No repo available"
59
61
60
62
hashed_test_ids = get_hash_string (test_ids )
61
63
# set up logging
@@ -66,13 +68,15 @@ def main(
66
68
67
69
try :
68
70
local_repo = git .Repo (repo_or_repo_dir )
69
- except git .exc .NoSuchPathError :
71
+ except git .exc .NoSuchPathError : # type: ignore
70
72
repo_dir = os .path .join (base_dir , repo_name )
71
73
logger .error (f"{ repo_or_repo_dir } is not a git dir, trying { repo_dir } again" )
72
74
try :
73
75
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.\n Usage: 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.\n Usage: commit0 test {{repo_dir}} { test_ids } "
79
+ )
76
80
except Exception as e :
77
81
raise e
78
82
if branch == "reference" :
@@ -123,7 +127,9 @@ def main(
123
127
try :
124
128
pytest_exit_code = int (pytest_exit_code )
125
129
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
+ )
127
133
sys .exit (pytest_exit_code )
128
134
except EvaluationError as e :
129
135
error_msg = (
0 commit comments