Fixed dependencies on Python >3.9 versions

This commit is contained in:
Donkie
2023-06-30 23:28:30 +02:00
parent 94d8cbf227
commit 720ec30812
2 changed files with 4 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
"""Helper functions for interacting with spool database objects.""" """Helper functions for interacting with spool database objects."""
from datetime import UTC, datetime from datetime import datetime, timezone
from typing import Optional from typing import Optional
import sqlalchemy import sqlalchemy
@@ -15,7 +15,7 @@ from spoolman.math import weight_from_length
def utc_timezone_naive(dt: datetime) -> datetime: def utc_timezone_naive(dt: datetime) -> datetime:
"""Convert a datetime object to UTC and remove timezone info.""" """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( async def create(

View File

@@ -5,6 +5,7 @@ import os
import subprocess import subprocess
from logging.handlers import TimedRotatingFileHandler from logging.handlers import TimedRotatingFileHandler
from pathlib import Path from pathlib import Path
from typing import Union
import uvicorn import uvicorn
from fastapi import FastAPI from fastapi import FastAPI
@@ -45,7 +46,7 @@ class SinglePageApplication(StaticFiles):
"""Construct.""" """Construct."""
super().__init__(directory=directory, packages=None, html=True, check_dir=True) 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.""" """Return index.html if the requested file cannot be found."""
full_path, stat_result = super().lookup_path(path) full_path, stat_result = super().lookup_path(path)