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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user