fix: since when str can't use is/is not

This commit is contained in:
Macintxsh 2025-05-21 04:43:15 +03:00
parent 9ad1ce38ee
commit b266a1a2df
Signed by: mctaylors
GPG key ID: 4EEF4F949A266EE2
3 changed files with 4 additions and 4 deletions

View file

@ -6,14 +6,14 @@ from config import app
def humanize_tags_from_json(value: str, default: str) -> str:
if value is not "":
if value != "":
return ", ".join([re.sub("_\\(.*", "", t) for t in value.split()])
return default
def humanize_filesize(value: int) -> str:
for unit in ["B", "KiB", "MiB", "GiB"]:
if value < 1024 or unit is "GiB":
if value < 1024 or unit == "GiB":
break
value /= 1024
return f"{value:.2f} {unit}"