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

Method seek

Lib/_pyio.py:1223–1232  ·  view source on GitHub ↗
(self, pos, whence=0)

Source from the content-addressed store, hash-verified

1221 return max(_BufferedIOMixin.tell(self) - len(self._read_buf) + self._read_pos, 0)
1222
1223 def seek(self, pos, whence=0):
1224 if whence not in valid_seek_flags:
1225 raise ValueError("invalid whence value")
1226 self._checkClosed("seek of closed file")
1227 with self._read_lock:
1228 if whence == 1:
1229 pos -= len(self._read_buf) - self._read_pos
1230 pos = _BufferedIOMixin.seek(self, pos, whence)
1231 self._reset_read_buf()
1232 return pos
1233
1234class BufferedWriter(_BufferedIOMixin):
1235

Callers

nothing calls this directly

Calls 3

_reset_read_bufMethod · 0.95
_checkClosedMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected