summaryrefslogtreecommitdiff
path: root/asyncio/streams.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-02-06 00:11:28 -0500
committerYury Selivanov <yselivanov@sprymix.com>2014-02-06 00:11:28 -0500
commit02015e44cd42d8b42a72012770208a41c54ac17d (patch)
tree451b592451e588c02259990021647fd168b5d47e /asyncio/streams.py
parent7da495833b9c97e7466c86435884743cee8cfd0b (diff)
downloadtrollius-02015e44cd42d8b42a72012770208a41c54ac17d.tar.gz
streams.StreamReader: Add 'at_eof()' method
Diffstat (limited to 'asyncio/streams.py')
-rw-r--r--asyncio/streams.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/asyncio/streams.py b/asyncio/streams.py
index 3da1d10..8fc2147 100644
--- a/asyncio/streams.py
+++ b/asyncio/streams.py
@@ -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'