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

Method seek

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

Source from the content-addressed store, hash-verified

954 return n
955
956 def seek(self, pos, whence=0):
957 if self.closed:
958 raise ValueError("seek on closed file")
959 try:
960 pos_index = pos.__index__
961 except AttributeError:
962 raise TypeError(f"{pos!r} is not an integer")
963 else:
964 pos = pos_index()
965 if whence == 0:
966 if pos < 0:
967 raise ValueError("negative seek position %r" % (pos,))
968 self._pos = pos
969 elif whence == 1:
970 self._pos = max(0, self._pos + pos)
971 elif whence == 2:
972 self._pos = max(0, len(self._buffer) + pos)
973 else:
974 raise ValueError("unsupported whence value")
975 return self._pos
976
977 def tell(self):
978 if self.closed:

Callers 15

_dump_messageMethod · 0.95
_install_messageMethod · 0.95
_safe_readMethod · 0.95
list_directoryMethod · 0.95
dumpsMethod · 0.95
dumpsMethod · 0.95
check_file_digestMethod · 0.95
test_storbinaryMethod · 0.95
test_storbinary_restMethod · 0.95
test_file_dictMethod · 0.95
test_file_prefixMethod · 0.95

Calls 2

maxFunction · 0.85
lenFunction · 0.85

Tested by 15

dumpsMethod · 0.76
dumpsMethod · 0.76
check_file_digestMethod · 0.76
test_storbinaryMethod · 0.76
test_storbinary_restMethod · 0.76
test_file_dictMethod · 0.76
test_file_prefixMethod · 0.76
test_open_dictMethod · 0.76
test_open_prefixMethod · 0.76
send_typical_requestMethod · 0.76