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

Method _configure

Lib/_pyio.py:2118–2143  ·  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

2116 raise ValueError("illegal newline value: %r" % (newline,))
2117
2118 def _configure(self, encoding=None, errors=None, newline=None,
2119 line_buffering=False, write_through=False):
2120 self._encoding = encoding
2121 self._errors = errors
2122 self._encoder = None
2123 self._decoder = None
2124 self._b2cratio = 0.0
2125
2126 self._readuniversal = not newline
2127 self._readtranslate = newline is None
2128 self._readnl = newline
2129 self._writetranslate = newline != ''
2130 self._writenl = newline or os.linesep
2131
2132 self._line_buffering = line_buffering
2133 self._write_through = write_through
2134
2135 # don't write a BOM in the middle of a file
2136 if self._seekable and self.writable():
2137 position = self.buffer.tell()
2138 if position != 0:
2139 try:
2140 self._get_encoder().setstate(0)
2141 except LookupError:
2142 # Sometimes the encoder doesn't exist
2143 pass
2144
2145 # self._snapshot is either None, or a tuple (dec_flags, next_input)
2146 # 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