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

Method seek

Lib/wave.py:154–171  ·  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

152 self.closed = True
153
154 def seek(self, pos, whence=0):
155 """Seek to specified position into the chunk.
156 Default position is 0 (start of chunk).
157 If the file is not seekable, this will result in an error.
158 """
159
160 if self.closed:
161 raise ValueError("I/O operation on closed file")
162 if not self.seekable:
163 raise OSError("cannot seek")
164 if whence == 1:
165 pos = pos + self.size_read
166 elif whence == 2:
167 pos = pos + self.chunksize
168 if pos < 0 or pos > self.chunksize:
169 raise RuntimeError
170 self.file.seek(self.offset + pos, 0)
171 self.size_read = pos
172
173 def tell(self):
174 if self.closed:

Callers 3

skipMethod · 0.45
readframesMethod · 0.45
_patchheaderMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected