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

Method seek

Lib/_pyio.py:1767–1781  ·  view source on GitHub ↗

Move to new file position. Argument offset is a byte count. Optional argument whence defaults to SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values are SEEK_CUR or 1 (move relative to current position, positive or negative), and SEEK_END

(self, pos, whence=SEEK_SET)

Source from the content-addressed store, hash-verified

1765 return None
1766
1767 def seek(self, pos, whence=SEEK_SET):
1768 """Move to new file position.
1769
1770 Argument offset is a byte count. Optional argument whence defaults to
1771 SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
1772 are SEEK_CUR or 1 (move relative to current position, positive or negative),
1773 and SEEK_END or 2 (move relative to end of file, usually negative, although
1774 many platforms allow seeking beyond the end of a file).
1775
1776 Note that not all file objects are seekable.
1777 """
1778 if isinstance(pos, float):
1779 raise TypeError('an integer is required')
1780 self._checkClosed()
1781 return os.lseek(self._fd, pos, whence)
1782
1783 def tell(self):
1784 """tell() -> int. Current file position.

Callers 1

testTruncateMethod · 0.95

Calls 1

_checkClosedMethod · 0.45

Tested by 1

testTruncateMethod · 0.76