fix: replace deprecated datetime.utcnow() with datetime.now(datetime.UTC)

- Replace all 2,087 uses of datetime.utcnow() across 294 files
- Add UTC import to datetime statements where needed
- Addresses Python 3.12+ deprecation warning (report item #3)
This commit is contained in:
aitbc
2026-04-30 08:36:55 +02:00
parent 4d76bf4d97
commit 5f03ded7ff
294 changed files with 1997 additions and 1997 deletions

View File

@@ -10,7 +10,7 @@ import sys
import shutil
import time
import random
from datetime import datetime
from datetime import datetime, UTC
from pathlib import Path
# Jitter: random delay up to 15 minutes (900 seconds)
@@ -33,7 +33,7 @@ API_BASE = os.getenv('GITEA_API_BASE', 'http://gitea.bubuit.net:3000/api/v1')
REPO = 'oib/aitbc'
def log(msg):
now = datetime.utcnow().isoformat() + 'Z'
now = datetime.now(datetime.UTC).isoformat() + 'Z'
with open(LOG_FILE, 'a') as f:
f.write(f"[{now}] {msg}\n")
print(msg)
@@ -139,7 +139,7 @@ def synthesize_status():
log(f"PR #{num} has failing checks: {', '.join(s.get('context','?') for s in failing)}")
def main():
now = datetime.utcnow().isoformat() + 'Z'
now = datetime.now(datetime.UTC).isoformat() + 'Z'
log(f"\n=== QA Cycle start: {now} ===")
if not GITEA_TOKEN:
log("GITEA_TOKEN not set; aborting.")