Skip to content

Commit 7c40aae

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 08fc207 commit 7c40aae

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/pypistats/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ def pypi_stats_api(
162162
elif total == "all":
163163
res["data"] = _total(res["data"])
164164
elif total is not None:
165-
raise ValueError(f"invalid value {total} provided for total: use 'all' or 'monthly'")
165+
raise ValueError(
166+
f"invalid value {total} provided for total: use 'all' or 'monthly'"
167+
)
166168

167169
if format == "json":
168170
return json.dumps(res)
@@ -335,7 +337,11 @@ def _percent(data: dict | list) -> dict | list:
335337
grand_total = _grand_total_value(data)
336338

337339
for row in data:
338-
row["percent"] = "N/A" if grand_total == 0 else "{:.2%}".format(row["downloads"] / grand_total)
340+
row["percent"] = (
341+
"N/A"
342+
if grand_total == 0
343+
else "{:.2%}".format(row["downloads"] / grand_total)
344+
)
339345

340346
return data
341347

0 commit comments

Comments
 (0)