Initial upload

This commit is contained in:
LINUXexpert.org
2025-10-18 23:11:15 -07:00
committed by GitHub
parent 5d778e00f6
commit fe17e1d507
36 changed files with 1111 additions and 670 deletions
+19
View File
@@ -0,0 +1,19 @@
import datetime
def human_size(n: int | None) -> str:
if n is None: return ""
units = ["B","KB","MB","GB","TB","PB"]
i = 0
x = float(n)
while x >= 1024 and i < len(units)-1:
x /= 1024.0
i += 1
return f"{x:.0f} {units[i]}"
def fmt_when(iso: str | None) -> str:
if not iso: return ""
try:
dt = datetime.datetime.fromisoformat(iso.replace("Z","+00:00")).astimezone()
return dt.strftime("%Y-%m-%d %H:%M")
except Exception:
return iso or ""