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

Method seek

tools/python-3.11.9-amd64/Lib/_pyio.py:986–1005  ·  view source on GitHub ↗
(self, pos, whence=0)

Source from the content-addressed store, hash-verified

984 return n
985
986 def seek(self, pos, whence=0):
987 if self.closed:
988 raise ValueError("seek on closed file")
989 try:
990 pos_index = pos.__index__
991 except AttributeError:
992 raise TypeError(f"{pos!r} is not an integer")
993 else:
994 pos = pos_index()
995 if whence == 0:
996 if pos < 0:
997 raise ValueError("negative seek position %r" % (pos,))
998 self._pos = pos
999 elif whence == 1:
1000 self._pos = max(0, self._pos + pos)
1001 elif whence == 2:
1002 self._pos = max(0, len(self._buffer) + pos)
1003 else:
1004 raise ValueError("unsupported whence value")
1005 return self._pos
1006
1007 def tell(self):
1008 if self.closed:

Callers 4

_dump_messageMethod · 0.95
_install_messageMethod · 0.95
_RealGetContentsMethod · 0.95
list_directoryMethod · 0.95

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected