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

Method _configure

tools/python-3.11.9-amd64/Lib/_pyio.py:2059–2084  ·  view source on GitHub ↗
(self, encoding=None, errors=None, newline=None,
                   line_buffering=False, write_through=False)

Source from the content-addressed store, hash-verified

2057 raise ValueError("illegal newline value: %r" % (newline,))
2058
2059 def _configure(self, encoding=None, errors=None, newline=None,
2060 line_buffering=False, write_through=False):
2061 self._encoding = encoding
2062 self._errors = errors
2063 self._encoder = None
2064 self._decoder = None
2065 self._b2cratio = 0.0
2066
2067 self._readuniversal = not newline
2068 self._readtranslate = newline is None
2069 self._readnl = newline
2070 self._writetranslate = newline != ''
2071 self._writenl = newline or os.linesep
2072
2073 self._line_buffering = line_buffering
2074 self._write_through = write_through
2075
2076 # don't write a BOM in the middle of a file
2077 if self._seekable and self.writable():
2078 position = self.buffer.tell()
2079 if position != 0:
2080 try:
2081 self._get_encoder().setstate(0)
2082 except LookupError:
2083 # Sometimes the encoder doesn't exist
2084 pass
2085
2086 # self._snapshot is either None, or a tuple (dec_flags, next_input)
2087 # where dec_flags is the second (integer) item of the decoder state

Callers 2

__init__Method · 0.95
reconfigureMethod · 0.95

Calls 4

writableMethod · 0.95
_get_encoderMethod · 0.95
tellMethod · 0.45
setstateMethod · 0.45

Tested by

no test coverage detected