Tell whether the stream has ended and all data was read. This is a generator-based coroutine.
(self)
| 97 | return r |
| 98 | |
| 99 | def at_eof(self) -> Generator[None, None, bool]: |
| 100 | """ |
| 101 | Tell whether the stream has ended and all data was read. |
| 102 | |
| 103 | This is a generator-based coroutine. |
| 104 | |
| 105 | """ |
| 106 | while True: |
| 107 | if self.buffer: |
| 108 | return False |
| 109 | if self.eof: |
| 110 | return True |
| 111 | # When all data was read but the stream hasn't ended, we can't |
| 112 | # tell if until either feed_data() or feed_eof() is called. |
| 113 | yield |
| 114 | |
| 115 | def feed_data(self, data: bytes | bytearray) -> None: |
| 116 | """ |
no outgoing calls