Improve serialization

This commit is contained in:
Andras Schmelczer 2022-07-03 12:25:56 +02:00
parent 7d774f37be
commit c76342534a
8 changed files with 16 additions and 14 deletions

View file

@ -1,8 +1,9 @@
from typing import Iterable, TypeVar
from typing import Iterable, Optional, TypeVar
T = TypeVar("T")
def unchunk(chunks: Iterable[Iterable[T]]) -> Iterable[T]:
def unchunk(chunks: Iterable[Optional[Iterable[T]]]) -> Iterable[T]:
for chunk in chunks:
yield from chunk
if chunk is not None:
yield from chunk