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

Method _reset_encoder

Lib/_pyio.py:2513–2524  ·  view source on GitHub ↗

Reset the encoder (merely useful for proper BOM handling)

(position)

Source from the content-addressed store, hash-verified

2511
2512 def seek(self, cookie, whence=0):
2513 def _reset_encoder(position):
2514 """Reset the encoder (merely useful for proper BOM handling)"""
2515 try:
2516 encoder = self._encoder or self._get_encoder()
2517 except LookupError:
2518 # Sometimes the encoder doesn't exist
2519 pass
2520 else:
2521 if position != 0:
2522 encoder.setstate(0)
2523 else:
2524 encoder.reset()
2525
2526 if self.closed:
2527 raise ValueError("tell on closed file")

Callers

nothing calls this directly

Calls 3

_get_encoderMethod · 0.95
setstateMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected