Improved lyrics rendering

This commit is contained in:
marc
2025-04-05 23:09:20 +02:00
parent 211a1fbb05
commit 7a823a98ab
6 changed files with 44 additions and 25 deletions

View File

@@ -47,3 +47,11 @@ class FnChain(Generic[U]):
@classmethod
def transform(cls, x: V, /) -> FnChain[V]:
return FnChain(lambda: x)
def batched(iterable: Iterable[T], n: int) -> Iterator[tuple[T, ...]]:
if n < 1:
raise ValueError('n must be at least one')
iterator = iter(iterable)
while batch := tuple(itertools.islice(iterator, n)):
yield batch