MCPcopy
hub / github.com/benoitc/gunicorn / unread

Method unread

gunicorn/asgi/unreader.py:114–131  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 4

_reset_bufferMethod · 0.95
seekMethod · 0.80
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected