@@ -40,8 +40,9 @@ def get_unhidden_ungenerated_python_files(directory: str) -> Iterable[str]:
4040 yield os .path .join (dirpath , filename )
4141
4242
43- def create_virtual_env (venv_path : str , requirements_paths : Iterable [str ],
44- python_path : str , verbose : bool ) -> None :
43+ def create_virtual_env (
44+ venv_path : str , requirements_paths : Iterable [str ], python_path : str , verbose : bool
45+ ) -> None :
4546 """Creates a new virtual environment and then installs dependencies.
4647
4748 Args:
@@ -50,30 +51,24 @@ def create_virtual_env(venv_path: str, requirements_paths: Iterable[str],
5051 python_path: The python binary to use.
5152 verbose: When set, more progress output is produced.
5253 """
53- shell_tools .run_cmd ('virtualenv' ,
54- None if verbose else '--quiet' ,
55- '-p' ,
56- python_path ,
57- venv_path ,
58- out = sys .stderr )
54+ shell_tools .run_cmd (
55+ 'virtualenv' , None if verbose else '--quiet' , '-p' , python_path , venv_path , out = sys .stderr
56+ )
5957 pip_path = os .path .join (venv_path , 'bin' , 'pip' )
6058 for req_path in requirements_paths :
61- shell_tools .run_cmd (pip_path ,
62- 'install' ,
63- None if verbose else '--quiet' ,
64- '-r' ,
65- req_path ,
66- out = sys .stderr )
59+ shell_tools .run_cmd (
60+ pip_path , 'install' , None if verbose else '--quiet' , '-r' , req_path , out = sys .stderr
61+ )
6762
6863
6964def prepare_temporary_test_environment (
70- destination_directory : str ,
71- repository : GithubRepository ,
72- pull_request_number : Optional [int ],
73- verbose : bool ,
74- env_name : str = '.test_virtualenv' ,
75- python_path : str = sys .executable ,
76- commit_ids_known_callback : Callable [[PreparedEnv ], None ] = None
65+ destination_directory : str ,
66+ repository : GithubRepository ,
67+ pull_request_number : Optional [int ],
68+ verbose : bool ,
69+ env_name : str = '.test_virtualenv' ,
70+ python_path : str = sys .executable ,
71+ commit_ids_known_callback : Callable [[PreparedEnv ], None ] = None ,
7772) -> PreparedEnv :
7873 """Prepares a temporary test environment at the (existing empty) directory.
7974
@@ -101,10 +96,12 @@ def prepare_temporary_test_environment(
10196 destination_directory = destination_directory ,
10297 repository = repository ,
10398 pull_request_number = pull_request_number ,
104- verbose = verbose )
99+ verbose = verbose ,
100+ )
105101 else :
106102 env = git_env_tools .fetch_local_files (
107- destination_directory = destination_directory , verbose = verbose )
103+ destination_directory = destination_directory , verbose = verbose
104+ )
108105
109106 if commit_ids_known_callback is not None :
110107 commit_ids_known_callback (env )
@@ -113,18 +110,19 @@ def prepare_temporary_test_environment(
113110 base_path = cast (str , env .destination_directory )
114111 env_path = os .path .join (base_path , env_name )
115112 req_path = os .path .join (base_path , 'tutorial-requirements.txt' )
116- dev_req_path = os .path .join (base_path , 'dev_tools' , 'conf' ,
117- 'pip-list-dev-tools.txt' )
118- contrib_req_path = os . path . join ( base_path , 'cirq' , 'contrib' ,
119- 'contrib-tutorial-requirements.txt' )
113+ dev_req_path = os .path .join (base_path , 'dev_tools' , 'conf' , 'pip-list-dev-tools.txt' )
114+ contrib_req_path = os . path . join (
115+ base_path , 'cirq' , 'contrib' , 'contrib-tutorial-requirements.txt'
116+ )
120117 rev_paths = [req_path , dev_req_path , contrib_req_path ]
121- create_virtual_env (venv_path = env_path ,
122- python_path = python_path ,
123- requirements_paths = rev_paths ,
124- verbose = verbose )
125-
126- return PreparedEnv (github_repo = env .repository ,
127- actual_commit_id = env .actual_commit_id ,
128- compare_commit_id = env .compare_commit_id ,
129- destination_directory = env .destination_directory ,
130- virtual_env_path = env_path )
118+ create_virtual_env (
119+ venv_path = env_path , python_path = python_path , requirements_paths = rev_paths , verbose = verbose
120+ )
121+
122+ return PreparedEnv (
123+ github_repo = env .repository ,
124+ actual_commit_id = env .actual_commit_id ,
125+ compare_commit_id = env .compare_commit_id ,
126+ destination_directory = env .destination_directory ,
127+ virtual_env_path = env_path ,
128+ )
0 commit comments