mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
minor hiccups
This commit is contained in:
parent
fb20275775
commit
73bfc16bfd
2 changed files with 5 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
import colorsys
|
import colorsys
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from typing import Self
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
@ -10,7 +11,7 @@ class AdventImage:
|
||||||
img: Image.Image
|
img: Image.Image
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def load_standard(cls, fp) -> "AdventImage":
|
async def load_standard(cls, fp) -> Self:
|
||||||
"""
|
"""
|
||||||
Bild laden und einen quadratischen Ausschnitt
|
Bild laden und einen quadratischen Ausschnitt
|
||||||
aus der Mitte nehmen
|
aus der Mitte nehmen
|
||||||
|
@ -33,7 +34,7 @@ class AdventImage:
|
||||||
|
|
||||||
img = img.resize(
|
img = img.resize(
|
||||||
size=(500, 500),
|
size=(500, 500),
|
||||||
resample=Image.ANTIALIAS,
|
resample=Image.LANCZOS,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Farbmodell festlegen
|
# Farbmodell festlegen
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import itertools
|
import itertools
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
from typing import Any, Sequence
|
from typing import Any, Self, Sequence
|
||||||
|
|
||||||
from fastapi import Depends
|
from fastapi import Depends
|
||||||
from PIL import ImageFont
|
from PIL import ImageFont
|
||||||
|
@ -17,7 +17,7 @@ from ._image import AdventImage
|
||||||
|
|
||||||
class Random(random.Random):
|
class Random(random.Random):
|
||||||
@classmethod
|
@classmethod
|
||||||
async def get(cls, bonus_salt: Any = "") -> "Random":
|
async def get(cls, bonus_salt: Any = "") -> Self:
|
||||||
cfg = await get_config()
|
cfg = await get_config()
|
||||||
return cls(f"{cfg.puzzle.solution}{bonus_salt}")
|
return cls(f"{cfg.puzzle.solution}{bonus_salt}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue