Push data back into the buffer for re-reading. Args: data: bytes to push back Note: This prepends data to the buffer so it will be read first.
(self, data)
| 112 | return b"" |
| 113 | |
| 114 | def unread(self, data): |
| 115 | """Push data back into the buffer for re-reading. |
| 116 | |
| 117 | Args: |
| 118 | data: bytes to push back |
| 119 | |
| 120 | Note: This prepends data to the buffer so it will be read first. |
| 121 | """ |
| 122 | if data: |
| 123 | # Get existing buffered data |
| 124 | self.buf.seek(self._buf_start) |
| 125 | existing = self.buf.read() |
| 126 | |
| 127 | # Reset and write new data first, then existing |
| 128 | self._reset_buffer() |
| 129 | self.buf.write(data) |
| 130 | if existing: |
| 131 | self.buf.write(existing) |
| 132 | |
| 133 | def has_buffered_data(self): |
| 134 | """Check if there's data in the pushback buffer.""" |
nothing calls this directly
no test coverage detected