2323from typing import Any , Callable , Dict , List , Optional , Tuple
2424
2525import yaml
26-
2726from userbenchmark .utils import (
2827 parse_abtest_result_from_regression_file_for_bisect ,
2928 TorchBenchABTestResult ,
@@ -125,9 +124,9 @@ def get_updated_clean_torch_repos(
125124 all_repos = {}
126125
127126 def _gen_torch_repo (repo_name : str , repo_path : str ):
128- assert (
129- repo_path . exists () and repo_path . is_dir ()
130- ), f" { str ( repo_path ) } is not an existing directory."
127+ assert repo_path . exists () and repo_path . is_dir (), (
128+ f" { str ( repo_path ) } is not an existing directory."
129+ )
131130 main_branch = (
132131 "main"
133132 if not "main_branch" in TORCHBENCH_BISECTION_TARGETS [repo_name ]
@@ -216,9 +215,9 @@ def _checkout_non_target_repos(self, cdate: datetime):
216215 print (
217216 f"Checking out { repo .name } commit { dep_commit } ..." , end = "" , flush = True
218217 )
219- assert gitutils .checkout_git_commit (
220- repo . src_path . absolute (), dep_commit
221- ), f"Failed to checkout commit { dep_commit } of { repo . name } "
218+ assert gitutils .checkout_git_commit (repo . src_path . absolute (), dep_commit ), (
219+ f"Failed to checkout commit { dep_commit } of { repo . name } "
220+ )
222221 print ("done." )
223222
224223 def prep (self , interactive : bool = False ) -> bool :
@@ -314,9 +313,9 @@ def _run_benchmark_for_commit(
314313 output_dir = os .path .join (self .workdir .absolute (), commit .sha )
315314 # If the directory already exists, clear its contents
316315 if os .path .exists (output_dir ):
317- assert os .path .isdir (
318- output_dir
319- ), "Must specify output directory: {output_dir}"
316+ assert os .path .isdir (output_dir ), (
317+ "Must specify output directory: { output_dir}"
318+ )
320319 shutil .rmtree (output_dir )
321320 os .mkdir (output_dir )
322321 # If the first time to run benchmark, install the dependencies first
@@ -612,15 +611,15 @@ def main() -> None:
612611
613612 bisect_config = parse_abtest_result_from_regression_file_for_bisect (args .config )
614613 # sanity checks
615- assert (
616- bisect_config . name
617- ), "Invalid bisection config, must specify userbenchmark name."
618- assert bisect_config .control_env [
619- "git_commit_hash "
620- ], "Invalid bisection config, must specify control group commit hash."
621- assert bisect_config .treatment_env [
622- "git_commit_hash "
623- ], "Invalid bisection config, must specify treatment group commit hash."
614+ assert bisect_config . name , (
615+ "Invalid bisection config, must specify userbenchmark name."
616+ )
617+ assert bisect_config .control_env ["git_commit_hash" ], (
618+ "Invalid bisection config, must specify control group commit hash. "
619+ )
620+ assert bisect_config .treatment_env ["git_commit_hash" ], (
621+ "Invalid bisection config, must specify treatment group commit hash. "
622+ )
624623 assert bisect_config .bisection in TORCHBENCH_BISECTION_TARGETS .keys (), (
625624 f"Invalid bisection config, "
626625 f"get bisection target repo { bisect_config .bisection } , "
@@ -632,9 +631,9 @@ def main() -> None:
632631 if args .skip_update :
633632 skip_update_repos = list (map (lambda x : x .strip (), args .skip_update .split ("," )))
634633 for repo in skip_update_repos :
635- assert (
636- repo in list ( TORCHBENCH_BISECTION_TARGETS .keys ())
637- ), f"User specified skip update repo { repo } not in list: { TORCHBENCH_BISECTION_TARGETS . keys () } "
634+ assert repo in list ( TORCHBENCH_BISECTION_TARGETS . keys ()), (
635+ f"User specified skip update repo { repo } not in list: { TORCHBENCH_BISECTION_TARGETS .keys ()} "
636+ )
638637 else :
639638 skip_update_repos = None
640639 if args .skip_install_torchbench :
0 commit comments