(self, path)
| 206 | self._load_n_chunks() |
| 207 | |
| 208 | def _read_header(self, path): |
| 209 | with open(path, 'rb') as f: |
| 210 | magic = f.read(len(HDR_MAGIC)) |
| 211 | assert magic == HDR_MAGIC, "File doesn't match expected format." |
| 212 | version = struct.unpack('<Q', f.read(8)) |
| 213 | assert version == (1,) |
| 214 | (dtype_code,) = struct.unpack('<B', f.read(1)) |
| 215 | dtype = dtypes[dtype_code] |
| 216 | (chunk_size,) = struct.unpack('<Q', f.read(8)) |
| 217 | return dtype, chunk_size |
| 218 | |
| 219 | def _close_mmaps(self): |
| 220 | for mmap in self._mmaps: |