Skip to content

Commit a191626

Browse files
committed
uasyncio: Add awriteiter() method.
Write piecewise content from iterable (usually, a generator).
1 parent 1096940 commit a191626

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

uasyncio/uasyncio/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ def awrite(self, buf, off=0, sz=-1):
171171
if DEBUG and __debug__:
172172
log.debug("StreamWriter.awrite(): can write more")
173173

174+
# Write piecewise content from iterable (usually, a generator)
175+
def awriteiter(self, iterable):
176+
for buf in iterable:
177+
yield from self.awrite(buf)
178+
174179
def aclose(self):
175180
yield IOWriteDone(self.s)
176181
self.s.close()

0 commit comments

Comments
 (0)