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)
| 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: |
no outgoing calls
no test coverage detected