Blacken the code base.
This commit is contained in:
parent
d585c1529d
commit
07d079f204
19 changed files with 138 additions and 168 deletions
21
dcc/fetch.py
21
dcc/fetch.py
|
|
@ -21,14 +21,12 @@ class Fetch(dcc.config.Base):
|
|||
idgames_id = self.search_idgames(parsed_args.id_or_name)
|
||||
|
||||
reply = self.fetch_url(
|
||||
"https://www.doomworld.com/idgames/api/" +
|
||||
"api.php?action=get&id={}&out=json".format(idgames_id)
|
||||
"https://www.doomworld.com/idgames/api/"
|
||||
+ "api.php?action=get&id={}&out=json".format(idgames_id)
|
||||
)
|
||||
rpath = "/".join(
|
||||
[self.fetch_mirror, reply["content"]["dir"], reply["content"]["filename"]]
|
||||
)
|
||||
rpath = "/".join([
|
||||
self.fetch_mirror,
|
||||
reply["content"]["dir"],
|
||||
reply["content"]["filename"]
|
||||
])
|
||||
wad = reply["content"]["filename"][0:-4]
|
||||
|
||||
with urllib.request.urlopen(rpath) as response:
|
||||
|
|
@ -38,8 +36,8 @@ class Fetch(dcc.config.Base):
|
|||
# TODO: explicit error handling. Let users choose when >1 result.
|
||||
def search_idgames(self, wad):
|
||||
reply = self.fetch_url(
|
||||
"https://www.doomworld.com/idgames/api/" +
|
||||
"api.php?action=search&query={}&out=json".format(wad)
|
||||
"https://www.doomworld.com/idgames/api/"
|
||||
+ "api.php?action=search&query={}&out=json".format(wad)
|
||||
)
|
||||
if "content" not in reply:
|
||||
sys.exit(f"No WAD named {wad} found on idgames.")
|
||||
|
|
@ -62,8 +60,5 @@ class Fetch(dcc.config.Base):
|
|||
if fetcher_path is None:
|
||||
raise Exception(f"Fetch util {fetcher} not found on PATH.")
|
||||
|
||||
proc = subprocess.run(
|
||||
[fetcher_path, url],
|
||||
capture_output=True, check=True
|
||||
)
|
||||
proc = subprocess.run([fetcher_path, url], capture_output=True, check=True)
|
||||
return json.loads(proc.stdout)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue