Partially Use f string (#10218)

* flynt. trial 1.

* Trial 1.

* Addressed code review.
This commit is contained in:
SangBin Cho
2020-08-20 18:21:16 -07:00
committed by GitHub
parent 07cd815e5a
commit 92664249e8
41 changed files with 195 additions and 238 deletions
+7 -8
View File
@@ -11,16 +11,15 @@ import ray
def do_link(package, force=False, local_path=""):
package_home = os.path.abspath(
os.path.join(ray.__file__, "../{}".format(package)))
package_home = os.path.abspath(os.path.join(ray.__file__, f"../{package}"))
local_home = os.path.abspath(
os.path.join(__file__, local_path + "../{}".format(package)))
os.path.join(__file__, local_path + f"../{package}"))
if not os.path.isdir(package_home):
print("{} does not exist. Continuing to link.".format(package_home))
print(f"{package_home} does not exist. Continuing to link.")
assert os.path.isdir(local_home), local_home
if not force and not click.confirm(
"This will replace:\n {}\nwith a symlink to:\n {}".format(
package_home, local_home),
f"This will replace:\n {package_home}\nwith "
f"a symlink to:\n {local_home}",
default=True):
return
# Windows: Create directory junction.
@@ -37,8 +36,8 @@ def do_link(package, force=False, local_path=""):
else:
sudo = []
if not os.access(os.path.dirname(package_home), os.W_OK):
print("You don't have write permission to {}, using sudo:".format(
package_home))
print("You don't have write permission "
f"to {package_home}, using sudo:")
sudo = ["sudo"]
subprocess.check_call(sudo + ["rm", "-rf", package_home])
subprocess.check_call(sudo + ["ln", "-s", local_home, package_home])