Commit 9428a3bb authored by Zixian Cai's avatar Zixian Cai

os.PathLike is not a thing in Python < 3.6

parent 4c0e27bb
......@@ -35,7 +35,7 @@ class LocalStorage(Storage):
def load(cls, repo, host, rev):
dirname = cls.STORAGE_PATH / repo / host
filename = dirname.glob("{}*".format(rev)).__next__()
with open(filename) as logfile:
with filename.open() as logfile:
l = json.load(logfile)
attach_info(l, str(filename.stem))
return l
......@@ -45,7 +45,7 @@ class LocalStorage(Storage):
dirname = cls.STORAGE_PATH / repo / host
filename = dirname / "{}_{}".format(rev, timestamp)
os.makedirs(os.path.dirname(str(filename.absolute())), exist_ok=True)
with open(filename, "w") as logfile:
with filename.open("w") as logfile:
logfile.write(text_form)
@classmethod
......@@ -55,7 +55,7 @@ class LocalStorage(Storage):
[f.stem for f in dirname.iterdir() if not f.stem.startswith(".")],
key=lambda x: int(x.split("_")[1]))
filename = dirname / fs[-(1 + num)]
with open(filename) as logfile:
with filename.open() as logfile:
l = json.load(logfile)
attach_info(l, str(filename.stem))
return l
......@@ -68,7 +68,7 @@ class LocalStorage(Storage):
key=lambda x: int(x.split("_")[1]))
results = []
for f in fs:
with open(dirname / f) as logfile:
with (dirname / f).open() as logfile:
l = json.load(logfile)
attach_info(l, str((dirname / f).stem))
results.append(l)
......
......@@ -309,7 +309,7 @@ def load_file(config_files):
tasksets = []
for config_file in config_files:
config_file = Path(config_file).resolve()
with open(config_file) as fp:
with config_file.open() as fp:
tasksets.extend(load_yaml(fp.read(),
config_file.parent))
return tasksets
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment