| 174 | return cls(sorted(glob.glob(_dir + f"/*.{ext}")), block_size) |
| 175 | |
| 176 | def __init__(self, block_paths, block_size): |
| 177 | self.max_idx = 0 |
| 178 | self.block_path_map = {} |
| 179 | for block_path in block_paths: |
| 180 | name = os.path.splitext(os.path.basename(block_path))[0] |
| 181 | start_idx, end_idx = [ int(i) for i in name.split("-") ] |
| 182 | self.block_path_map[start_idx] = block_path |
| 183 | self.max_idx = max(self.max_idx, end_idx) |
| 184 | self.block_size = block_size |
| 185 | |
| 186 | def __str__(self): |
| 187 | return "%d paths" % len(self.block_path_map) |