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

Method _reset_encoder

tools/python-3.11.9-amd64/Lib/_pyio.py:2454–2465  ·  view source on GitHub ↗

Reset the encoder (merely useful for proper BOM handling)

(position)

Source from the content-addressed store, hash-verified

2452
2453 def seek(self, cookie, whence=0):
2454 def _reset_encoder(position):
2455 """Reset the encoder (merely useful for proper BOM handling)"""
2456 try:
2457 encoder = self._encoder or self._get_encoder()
2458 except LookupError:
2459 # Sometimes the encoder doesn't exist
2460 pass
2461 else:
2462 if position != 0:
2463 encoder.setstate(0)
2464 else:
2465 encoder.reset()
2466
2467 if self.closed:
2468 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