fix: replace datetime.UTC with timezone.utc for Python 3.10 compatibility

datetime.UTC was introduced in Python 3.11. Users on 3.10 get an ImportError.
Also lower ruff/mypy target-version from py313 to py310 to match minimum supported version.
This commit is contained in:
Pouzor
2026-03-09 22:01:32 +01:00
parent 99b40fa9e9
commit 6ae7f7768f
6 changed files with 14 additions and 14 deletions
+3 -3
View File
@@ -2,7 +2,7 @@
import asyncio
import logging
import socket
from datetime import UTC, datetime
from datetime import datetime, timezone
from typing import Any
from sqlalchemy.ext.asyncio import AsyncSession
@@ -159,7 +159,7 @@ async def run_scan(ranges: list[str], db: AsyncSession, run_id: str) -> None:
if run:
run.status = "done"
run.devices_found = devices_found
run.finished_at = datetime.now(UTC)
run.finished_at = datetime.now(timezone.utc)
await db.commit()
except Exception as exc:
@@ -168,5 +168,5 @@ async def run_scan(ranges: list[str], db: AsyncSession, run_id: str) -> None:
if run:
run.status = "error"
run.error = str(exc)
run.finished_at = datetime.now(UTC)
run.finished_at = datetime.now(timezone.utc)
await db.commit()