MCPcopy Index your code
hub / github.com/RustPython/RustPython / write

Method write

Lib/wsgiref/handlers.py:281–299  ·  view source on GitHub ↗

write()' callable as specified by PEP 3333

(self, data)

Source from the content-addressed store, hash-verified

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

Callers 2

finish_responseMethod · 0.95
_writeMethod · 0.45

Calls 4

send_headersMethod · 0.95
_writeMethod · 0.95
_flushMethod · 0.95
lenFunction · 0.85

Tested by

no test coverage detected