Method: gzip.GzipFile.seek
Calls: 1027, Exceptions: 2, Paths: 4Back
Path 1: 1004 calls (0.98)
0 (504) 39 (2) 59 (2) 87 (2) 120 (2) 121 (2) 160 (2) 180 (2) 208 (2) 241 (2)
1 (504) 0 (500)
6050 (4) 39 (4) 59 (4) 87 (4) 120 (4) 121 (4) 160 (4) 180 (4) 208 (4) 241 (4)
1def seek(self, offset, whence=io.SEEK_SET):
2 if self.mode == WRITE:
3 if whence != io.SEEK_SET:
4 if whence == io.SEEK_CUR:
5 offset = self.offset + offset
6 else:
7 raise ValueError('Seek from end not supported')
8 if offset < self.offset:
9 raise OSError('Negative seek in write mode')
10 count = offset - self.offset
11 chunk = b'\0' * 1024
12 for i in range(count // 1024):
13 self.write(chunk)
14 self.write(b'\0' * (count % 1024))
15 elif self.mode == READ:
16 self._check_not_closed()
17 return self._buffer.seek(offset, whence)
18
19 return self.offset
Path 2: 16 calls (0.02)
0 (1) 16 (1) 32 (1) 48 (1) 64 (1) 80 (1) 96 (1) 112 (1) 128 (1) 144 (1)
0 (16)
0 (1) 16 (1) 32 (1) 48 (1) 64 (1) 80 (1) 96 (1) 112 (1) 128 (1) 144 (1)
1def seek(self, offset, whence=io.SEEK_SET):
2 if self.mode == WRITE:
3 if whence != io.SEEK_SET:
4 if whence == io.SEEK_CUR:
5 offset = self.offset + offset
6 else:
7 raise ValueError('Seek from end not supported')
8 if offset < self.offset:
9 raise OSError('Negative seek in write mode')
10 count = offset - self.offset
11 chunk = b'\0' * 1024
12 for i in range(count // 1024):
13 self.write(chunk)
14 self.write(b'\0' * (count % 1024))
15 elif self.mode == READ:
16 self._check_not_closed()
17 return self._buffer.seek(offset, whence)
18
19 return self.offset
Path 3: 5 calls (0.0)
0 (5)
1 (5)
0 (4) 40 (1)
1def seek(self, offset, whence=io.SEEK_SET):
2 if self.mode == WRITE:
3 if whence != io.SEEK_SET:
4 if whence == io.SEEK_CUR:
5 offset = self.offset + offset
6 else:
7 raise ValueError('Seek from end not supported')
8 if offset < self.offset:
9 raise OSError('Negative seek in write mode')
10 count = offset - self.offset
11 chunk = b'\0' * 1024
12 for i in range(count // 1024):
13 self.write(chunk)
14 self.write(b'\0' * (count % 1024))
15 elif self.mode == READ:
16 self._check_not_closed()
17 return self._buffer.seek(offset, whence)
18
19 return self.offset
Path 4: 2 calls (0.0)
0 (2)
0 (1) 1 (1)
ValueError (2)
1def seek(self, offset, whence=io.SEEK_SET):
2 if self.mode == WRITE:
3 if whence != io.SEEK_SET:
4 if whence == io.SEEK_CUR:
5 offset = self.offset + offset
6 else:
7 raise ValueError('Seek from end not supported')
8 if offset < self.offset:
9 raise OSError('Negative seek in write mode')
10 count = offset - self.offset
11 chunk = b'\0' * 1024
12 for i in range(count // 1024):
13 self.write(chunk)
14 self.write(b'\0' * (count % 1024))
15 elif self.mode == READ:
16 self._check_not_closed()
17 return self._buffer.seek(offset, whence)
18
19 return self.offset