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

Method write

Lib/_apple_support.py:22–36  ·  view source on GitHub ↗
(self, s)

Source from the content-addressed store, hash-verified

20 return f"<SystemLog (level {self.buffer.level})>"
21
22 def write(self, s):
23 if not isinstance(s, str):
24 raise TypeError(
25 f"write() argument must be str, not {type(s).__name__}")
26
27 # In case `s` is a str subclass that writes itself to stdout or stderr
28 # when we call its methods, convert it to an actual str.
29 s = str.__str__(s)
30
31 # We want to emit one log message per line, so split
32 # the string before sending it to the superclass.
33 for line in s.splitlines(keepends=True):
34 super().write(line)
35
36 return len(s)
37
38
39class LogStream(io.RawIOBase):

Callers

nothing calls this directly

Calls 3

superClass · 0.85
__str__Method · 0.45
splitlinesMethod · 0.45

Tested by

no test coverage detected