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

Method seek

tools/python-3.11.9-amd64/Lib/wave.py:140–157  ·  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

138 self.closed = True
139
140 def seek(self, pos, whence=0):
141 """Seek to specified position into the chunk.
142 Default position is 0 (start of chunk).
143 If the file is not seekable, this will result in an error.
144 """
145
146 if self.closed:
147 raise ValueError("I/O operation on closed file")
148 if not self.seekable:
149 raise OSError("cannot seek")
150 if whence == 1:
151 pos = pos + self.size_read
152 elif whence == 2:
153 pos = pos + self.chunksize
154 if pos < 0 or pos > self.chunksize:
155 raise RuntimeError
156 self.file.seek(self.offset + pos, 0)
157 self.size_read = pos
158
159 def tell(self):
160 if self.closed:

Callers 3

skipMethod · 0.45
readframesMethod · 0.45
_patchheaderMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected