diff --git a/spoolman/database/spool.py b/spoolman/database/spool.py index c797438..1681a9b 100644 --- a/spoolman/database/spool.py +++ b/spoolman/database/spool.py @@ -1,6 +1,6 @@ """Helper functions for interacting with spool database objects.""" -from datetime import UTC, datetime +from datetime import datetime, timezone from typing import Optional import sqlalchemy @@ -15,7 +15,7 @@ from spoolman.math import weight_from_length def utc_timezone_naive(dt: datetime) -> datetime: """Convert a datetime object to UTC and remove timezone info.""" - return dt.astimezone(UTC).replace(tzinfo=None) + return dt.astimezone(tz=timezone.utc).replace(tzinfo=None) async def create( diff --git a/spoolman/main.py b/spoolman/main.py index e7c4b25..d54a056 100644 --- a/spoolman/main.py +++ b/spoolman/main.py @@ -5,6 +5,7 @@ import os import subprocess from logging.handlers import TimedRotatingFileHandler from pathlib import Path +from typing import Union import uvicorn from fastapi import FastAPI @@ -45,7 +46,7 @@ class SinglePageApplication(StaticFiles): """Construct.""" super().__init__(directory=directory, packages=None, html=True, check_dir=True) - def lookup_path(self, path: str) -> tuple[str, os.stat_result | None]: + def lookup_path(self, path: str) -> tuple[str, Union[os.stat_result, None]]: """Return index.html if the requested file cannot be found.""" full_path, stat_result = super().lookup_path(path)