Rendering code refactor

This commit is contained in:
marc
2025-04-26 19:09:59 +02:00
parent 7a823a98ab
commit d132e6fd60
33 changed files with 638 additions and 188 deletions

View File

@@ -1,5 +1,6 @@
from __future__ import annotations
import dataclasses
import itertools
from collections.abc import Callable, Iterable, Iterator
from typing import Generic, Protocol, Self, TypeVar
@@ -55,3 +56,13 @@ def batched(iterable: Iterable[T], n: int) -> Iterator[tuple[T, ...]]:
iterator = iter(iterable)
while batch := tuple(itertools.islice(iterator, n)):
yield batch
ResultT = TypeVar("ResultT")
ErrorT = TypeVar("ErrorT")
@dataclasses.dataclass
class Result(Generic[ResultT, ErrorT]):
result: ResultT | None = None
error: ErrorT | None = None