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

Method _write_chunk

Lib/_android_support.py:82–94  ·  view source on GitHub ↗
(self, s)

Source from the content-addressed store, hash-verified

80 # The size and behavior of TextIOWrapper's buffer is not part of its public
81 # API, so we handle buffering ourselves to avoid truncation.
82 def _write_chunk(self, s):
83 b = s.encode(self.encoding, self.errors)
84 if self._pending_bytes_count + len(b) > MAX_BYTES_PER_WRITE:
85 self.flush()
86
87 self._pending_bytes.append(b)
88 self._pending_bytes_count += len(b)
89 if (
90 self.write_through
91 or b.endswith(b"\n")
92 or self._pending_bytes_count > MAX_BYTES_PER_WRITE
93 ):
94 self.flush()
95
96 def flush(self):
97 with self._lock:

Callers 1

writeMethod · 0.95

Calls 4

flushMethod · 0.95
encodeMethod · 0.45
appendMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected