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

Method _reset_encoder

Lib/_pyio.py:2489–2500  ·  view source on GitHub ↗

Reset the encoder (merely useful for proper BOM handling)

(position)

Source from the content-addressed store, hash-verified

2487
2488 def seek(self, cookie, whence=0):
2489 def _reset_encoder(position):
2490 """Reset the encoder (merely useful for proper BOM handling)"""
2491 try:
2492 encoder = self._encoder or self._get_encoder()
2493 except LookupError:
2494 # Sometimes the encoder doesn't exist
2495 pass
2496 else:
2497 if position != 0:
2498 encoder.setstate(0)
2499 else:
2500 encoder.reset()
2501
2502 if self.closed:
2503 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