diff --git a/api/advent22_api/routers/_image.py b/api/advent22_api/routers/_image.py index 2ab3285..f238321 100644 --- a/api/advent22_api/routers/_image.py +++ b/api/advent22_api/routers/_image.py @@ -1,5 +1,6 @@ import colorsys from dataclasses import dataclass +from typing import Self import numpy as np from PIL import Image, ImageDraw, ImageFont @@ -10,7 +11,7 @@ class AdventImage: img: Image.Image @classmethod - async def load_standard(cls, fp) -> "AdventImage": + async def load_standard(cls, fp) -> Self: """ Bild laden und einen quadratischen Ausschnitt aus der Mitte nehmen @@ -33,7 +34,7 @@ class AdventImage: img = img.resize( size=(500, 500), - resample=Image.ANTIALIAS, + resample=Image.LANCZOS, ) # Farbmodell festlegen diff --git a/api/advent22_api/routers/_misc.py b/api/advent22_api/routers/_misc.py index 54a25eb..8437969 100644 --- a/api/advent22_api/routers/_misc.py +++ b/api/advent22_api/routers/_misc.py @@ -1,7 +1,7 @@ import itertools import random import re -from typing import Any, Sequence +from typing import Any, Self, Sequence from fastapi import Depends from PIL import ImageFont @@ -17,7 +17,7 @@ from ._image import AdventImage class Random(random.Random): @classmethod - async def get(cls, bonus_salt: Any = "") -> "Random": + async def get(cls, bonus_salt: Any = "") -> Self: cfg = await get_config() return cls(f"{cfg.puzzle.solution}{bonus_salt}")