Improved lyrics rendering
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user