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

Method seek

tools/python-3.11.9-amd64/Lib/chunk.py:102–119  ·  view source on GitHub ↗

Seek to specified position into the chunk. Default position is 0 (start of chunk). If the file is not seekable, this will result in an error.

(self, pos, whence=0)

Source from the content-addressed store, hash-verified

100 return False
101
102 def seek(self, pos, whence=0):
103 """Seek to specified position into the chunk.
104 Default position is 0 (start of chunk).
105 If the file is not seekable, this will result in an error.
106 """
107
108 if self.closed:
109 raise ValueError("I/O operation on closed file")
110 if not self.seekable:
111 raise OSError("cannot seek")
112 if whence == 1:
113 pos = pos + self.size_read
114 elif whence == 2:
115 pos = pos + self.chunksize
116 if pos < 0 or pos > self.chunksize:
117 raise RuntimeError
118 self.file.seek(self.offset + pos, 0)
119 self.size_read = pos
120
121 def tell(self):
122 if self.closed:

Callers 1

skipMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected