Read data in chunks for multipart/form-data parsing. Stop if no data is read. Yield ``None`` at the end to signal end of parsing.
(read: t.Callable[[int], bytes], size: int)
| 416 | |
| 417 | |
| 418 | def _chunk_iter(read: t.Callable[[int], bytes], size: int) -> t.Iterator[bytes | None]: |
| 419 | """Read data in chunks for multipart/form-data parsing. Stop if no data is read. |
| 420 | Yield ``None`` at the end to signal end of parsing. |
| 421 | """ |
| 422 | while True: |
| 423 | data = read(size) |
| 424 | |
| 425 | if not data: |
| 426 | break |
| 427 | |
| 428 | yield data |
| 429 | |
| 430 | yield None |