Commit 9e1bb6ef authored by shadMod's avatar shadMod 💬

black reformat

parent 5231d5c2
Pipeline #283 passed with stage
in 0 seconds
......@@ -64,9 +64,13 @@ class Downloads:
else:
self._mirrors = {}
for distro in self.config["mirrors"]["for"]:
found_mirrors = list(sorted(launchpad.get_cdimage_mirrors(
distro, self.config["mirrors"]["country"]
)))
found_mirrors = list(
sorted(
launchpad.get_cdimage_mirrors(
distro, self.config["mirrors"]["country"]
)
)
)
if found_mirrors:
self._mirrors[distro] = found_mirrors
if not self._mirrors:
......@@ -167,14 +171,18 @@ class Downloads:
# Store only if the cache isn't available
if self._cache is None:
with open(self._cache_file, "w") as f:
json.dump({
"config-hash": self._config_hash,
"version": CACHE_FILE_VERSION,
"content": {
"mirrors": self.mirrors,
"md5sums": self.md5sums,
json.dump(
{
"config-hash": self._config_hash,
"version": CACHE_FILE_VERSION,
"content": {
"mirrors": self.mirrors,
"md5sums": self.md5sums,
},
},
}, f, separators=(",", ":"))
f,
separators=(",", ":"),
)
# Invalidate the cache in this instance
delattr(self, "_cache_cache")
......@@ -260,16 +268,19 @@ class Downloads:
torrent = "torrent" in flask.request.form
payload = signer.dumps({
"url": self.url_for(distro, release, arch, torrent),
"md5": self.md5sums["%s:%s:%s" % (distro, release, arch)],
"name": "%s %s%s" % (
self.config["distros"][distro]["name"],
self.config["releases"][release]["version"],
" LTS" if self.config["releases"][release]["lts"] else "",
),
"theme": distro,
})
payload = signer.dumps(
{
"url": self.url_for(distro, release, arch, torrent),
"md5": self.md5sums["%s:%s:%s" % (distro, release, arch)],
"name": "%s %s%s"
% (
self.config["distros"][distro]["name"],
self.config["releases"][release]["version"],
" LTS" if self.config["releases"][release]["lts"] else "",
),
"theme": distro,
}
)
return flask.redirect(flask.url_for(".thanks", payload=payload))
@bp.route("/grazie/<payload>")
......@@ -287,10 +298,11 @@ class Downloads:
"""Generate the sub-navbar for /download"""
result = []
for name, distro in self.config["distros"].items():
result.append({
"name": distro["name"],
"endpoint": "download.landing",
"endpoint-args": {"distro": name},
})
result.append(
{
"name": distro["name"],
"endpoint": "download.landing",
"endpoint-args": {"distro": name},
}
)
return result
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