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