| 1263 | if f is not None: |
| 1264 | # Copying from a file-like object. |
| 1265 | class _Reader: |
| 1266 | def __aiter__(self): |
| 1267 | return self |
| 1268 | |
| 1269 | async def __anext__(self): |
| 1270 | data = await run_in_executor(None, f.read, 524288) |
| 1271 | if len(data) == 0: |
| 1272 | raise StopAsyncIteration |
| 1273 | else: |
| 1274 | return data |
| 1275 | |
| 1276 | reader = _Reader() |
| 1277 |