| 79 | |
| 80 | @functools.cached_property |
| 81 | def _new_chunks(self): |
| 82 | current_chunk, new_chunks = [], [] |
| 83 | for idx in copy.deepcopy(self.indexer): |
| 84 | if ( |
| 85 | len(current_chunk) + len(idx) > self._chunk_size_limit |
| 86 | and len(current_chunk) > 0 |
| 87 | ): |
| 88 | new_chunks.append(current_chunk) |
| 89 | current_chunk = idx.copy() |
| 90 | else: |
| 91 | current_chunk.extend(idx) |
| 92 | if ( |
| 93 | len(current_chunk) |
| 94 | > self._chunk_size_limit / self._chunksize_tolerance |
| 95 | ): |
| 96 | new_chunks.append(current_chunk) |
| 97 | current_chunk = [] |
| 98 | if len(current_chunk) > 0: |
| 99 | new_chunks.append(current_chunk) |
| 100 | return new_chunks |
| 101 | |
| 102 | def _layer(self) -> dict: |
| 103 | chunks = self.array.chunks |