@@ -129,8 +129,8 @@ def install():
129129 # Recommend to the user to add their custom paths to environment variables
130130 # so that future invocations of the program will know where to look.
131131 if (
132- install_path != env_vars .install_path .default
133- or data_path != env_vars .data_path .default
132+ install_path != env_vars .install_path .default
133+ or data_path != env_vars .data_path .default
134134 ):
135135 print ()
136136 print_utils .translate ("install.set-custom-directory-env-vars" )
@@ -200,7 +200,7 @@ def _parse_args():
200200
201201
202202def check_location () -> str :
203- url = ' http://ipinfo.io/json'
203+ url = " http://ipinfo.io/json"
204204 try :
205205 response = urlopen (url , timeout = 5 )
206206 except Exception :
@@ -217,22 +217,25 @@ def get_docker_config() -> dict:
217217
218218def update_docker_mirror (docker_config : dict , location : str ):
219219 docker_mirror_host = {"CN" : "USTC" , "US" : "Docker Hub" }
220- if location == "CN" and \
221- ("registry-mirrors" not in docker_config .keys () or
222- docker_config ["registry-mirrors" ] !=
223- ["https://docker.mirrors.ustc.edu.cn/" ]):
224- docker_config ["registry-mirrors" ] = \
225- ["https://docker.mirrors.ustc.edu.cn/" ]
220+ if location == "CN" and (
221+ "registry-mirrors" not in docker_config .keys ()
222+ or docker_config ["registry-mirrors" ]
223+ != ["https://docker.mirrors.ustc.edu.cn/" ]
224+ ):
225+ docker_config ["registry-mirrors" ] = [
226+ "https://docker.mirrors.ustc.edu.cn/"
227+ ]
226228 elif location != "CN" and "registry-mirrors" in docker_config .keys ():
227229 del docker_config ["registry-mirrors" ]
228230 else :
229231 return
230232 if print_utils .ask_yes_no (
231- "install.change-docker-mirror" ,
232- location = location ,
233- mirror_host = docker_mirror_host [location ]
233+ "install.change-docker-mirror" ,
234+ location = location ,
235+ mirror_host = docker_mirror_host [location ],
234236 ):
235237 with open ("/etc/docker/daemon.json" , "w" ) as docker_config_file :
236- json .dump (docker_config , docker_config_file , indent = 4 ,
237- sort_keys = True )
238+ json .dump (
239+ docker_config , docker_config_file , indent = 4 , sort_keys = True
240+ )
238241 os_utils .restart_docker ()
0 commit comments