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

Method seek

tools/python-3.11.9-amd64/Lib/tarfile.py:511–522  ·  view source on GitHub ↗

Set the stream's file pointer to pos. Negative seeking is forbidden.

(self, pos=0)

Source from the content-addressed store, hash-verified

509 return self.pos
510
511 def seek(self, pos=0):
512 """Set the stream's file pointer to pos. Negative seeking
513 is forbidden.
514 """
515 if pos - self.pos >= 0:
516 blocks, remainder = divmod(pos - self.pos, self.bufsize)
517 for i in range(blocks):
518 self.read(self.bufsize)
519 self.read(remainder)
520 else:
521 raise StreamError("seeking backwards is not allowed")
522 return self.pos
523
524 def read(self, size):
525 """Return the next size number of bytes from the stream."""

Callers 6

readMethod · 0.45
__init__Method · 0.45
openMethod · 0.45
makefileMethod · 0.45
nextMethod · 0.45
is_tarfileFunction · 0.45

Calls 2

readMethod · 0.95
StreamErrorClass · 0.85

Tested by

no test coverage detected