asyncio.streams.StreamReader: Add 'at_eof()' method

This commit is contained in:
Yury Selivanov 2014-02-06 00:14:30 -05:00
parent e694c9745f
commit f0020f5d77
2 changed files with 19 additions and 0 deletions

View file

@ -293,6 +293,10 @@ class StreamReader:
if not waiter.cancelled():
waiter.set_result(True)
def at_eof(self):
"""Return True if the buffer is empty and 'feed_eof' was called."""
return self._eof and not self._buffer
def feed_data(self, data):
assert not self._eof, 'feed_data after feed_eof'