MCPcopy Index your code
hub / github.com/RustPython/RustPython / _configure

Method _configure

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

2092 raise ValueError("illegal newline value: %r" % (newline,))
2093
2094 def _configure(self, encoding=None, errors=None, newline=None,
2095 line_buffering=False, write_through=False):
2096 self._encoding = encoding
2097 self._errors = errors
2098 self._encoder = None
2099 self._decoder = None
2100 self._b2cratio = 0.0
2101
2102 self._readuniversal = not newline
2103 self._readtranslate = newline is None
2104 self._readnl = newline
2105 self._writetranslate = newline != ''
2106 self._writenl = newline or os.linesep
2107
2108 self._line_buffering = line_buffering
2109 self._write_through = write_through
2110
2111 # don't write a BOM in the middle of a file
2112 if self._seekable and self.writable():
2113 position = self.buffer.tell()
2114 if position != 0:
2115 try:
2116 self._get_encoder().setstate(0)
2117 except LookupError:
2118 # Sometimes the encoder doesn't exist
2119 pass
2120
2121 # self._snapshot is either None, or a tuple (dec_flags, next_input)
2122 # 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