Skip to content

Commit a959e63

Browse files
committedOct 21, 2024·
chore: type annotate and simplify template tags
1 parent bd02403 commit a959e63

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed
 

‎weblate_web/templatetags/downloads.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@
2525
register = Library()
2626

2727

28-
def filesizeformat(num_bytes):
28+
def filesizeformat(num_bytes: int):
2929
"""
3030
Format the value like a 'human-readable' file size.
3131
3232
For example 13 KB, 4.1 MB, 102 bytes, etc).
3333
"""
34-
num_bytes = float(num_bytes)
35-
3634
if num_bytes < 1024:
3735
return ngettext("%(size)d byte", "%(size)d bytes", num_bytes) % {
3836
"size": num_bytes
@@ -45,7 +43,7 @@ def filesizeformat(num_bytes):
4543

4644

4745
@register.inclusion_tag("snippets/download-link.html")
48-
def downloadlink(info):
46+
def downloadlink(info: dict[str, str]):
4947
name = info["filename"]
5048

5149
if name.endswith(".tar.bz2"):

0 commit comments

Comments
 (0)
Please sign in to comment.