MCPcopy Index your code
hub / github.com/python/cpython / write

Method write

Lib/wsgiref/handlers.py:284–302  ·  view source on GitHub ↗

write()' callable as specified by PEP 3333

(self, data)

Source from the content-addressed store, hash-verified

282 self._write(('Status: %s\r\n' % self.status).encode('iso-8859-1'))
283
284 def write(self, data):
285 """'write()' callable as specified by PEP 3333"""
286
287 assert type(data) is bytes, \
288 "write() argument must be a bytes instance"
289
290 if not self.status:
291 raise AssertionError("write() before start_response()")
292
293 elif not self.headers_sent:
294 # Before the first output, send the stored headers
295 self.bytes_sent = len(data) # make sure we know content-length
296 self.send_headers()
297 else:
298 self.bytes_sent += len(data)
299
300 # XXX check Content-Length and truncate if too many bytes written?
301 self._write(data)
302 self._flush()
303
304
305 def sendfile(self):

Callers 2

finish_responseMethod · 0.95
_writeMethod · 0.45

Calls 3

send_headersMethod · 0.95
_writeMethod · 0.95
_flushMethod · 0.95

Tested by

no test coverage detected