Skip to content

Commit 5e5906b

Browse files
author
Zhao Wang
committed
formatting
1 parent 3fb78f1 commit 5e5906b

2 files changed

Lines changed: 22 additions & 15 deletions

File tree

brainframe/cli/commands/install.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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

202202
def 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

218218
def 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()

brainframe/cli/dependencies.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ def _install_docker():
6161
os_utils.run(["sh", "/tmp/get-docker.sh"])
6262

6363

64-
docker = Dependency("docker", "install.ask-install-docker", _install_docker,)
64+
docker = Dependency(
65+
"docker",
66+
"install.ask-install-docker",
67+
_install_docker,
68+
)
6569

6670
docker_compose = Dependency(
6771
"docker-compose",

0 commit comments

Comments
 (0)