MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __init__

Method __init__

tools/python-3.11.9-amd64/Lib/_pyio.py:2671–2685  ·  view source on GitHub ↗
(self, initial_value="", newline="\n")

Source from the content-addressed store, hash-verified

2669 """
2670
2671 def __init__(self, initial_value="", newline="\n"):
2672 super(StringIO, self).__init__(BytesIO(),
2673 encoding="utf-8",
2674 errors="surrogatepass",
2675 newline=newline)
2676 # Issue #5645: make universal newlines semantics the same as in the
2677 # C version, even under Windows.
2678 if newline is None:
2679 self._writetranslate = False
2680 if initial_value is not None:
2681 if not isinstance(initial_value, str):
2682 raise TypeError("initial_value must be str or None, not {0}"
2683 .format(type(initial_value).__name__))
2684 self.write(initial_value)
2685 self.seek(0)
2686
2687 def getvalue(self):
2688 self.flush()

Callers

nothing calls this directly

Calls 6

writeMethod · 0.95
BytesIOClass · 0.85
typeClass · 0.50
__init__Method · 0.45
formatMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected