This commit is contained in:
2026-02-04 12:45:35 -05:00
parent 0a27b763f7
commit 700ea8d6a4
51 changed files with 4715 additions and 2904 deletions
+36
View File
@@ -0,0 +1,36 @@
"""Utility helpers extracted from the original script."""
import time
def shortname(name: str) -> str:
return name.split(".")[0]
def dur(sec: int) -> str:
sec = int(sec)
h = int(sec / 3600)
m = int((sec - h * 3600) / 60)
s = int((sec - h * 3600) % 60)
if h > 0:
return "%d:%02d:%02d" % (h, m, s)
if m > 0:
return "%d:%02d" % (m, s)
return "0:%02d" % s
def initlog(logfile: str):
"""Open logfile for appending; fall back to creating it or returning stderr.
This mirrors the original behaviour from the monolithic script.
"""
try:
return open(logfile, "a+")
except Exception:
pass
try:
return open(logfile, "w")
except Exception as e:
import sys
print(f"cannot open logfile {logfile}, using STDERR: {e}")
return sys.stderr