| 2409 | self._populate_separate_keys((col.key, col) for col in iter_) |
| 2410 | |
| 2411 | def remove(self, column: _NAMEDCOL) -> None: |
| 2412 | if column not in self._colset: |
| 2413 | raise ValueError( |
| 2414 | "Can't remove column %r; column is not in this collection" |
| 2415 | % column |
| 2416 | ) |
| 2417 | del self._index[column.key] |
| 2418 | self._colset.remove(column) |
| 2419 | self._collection[:] = [ |
| 2420 | (k, c, metrics) |
| 2421 | for (k, c, metrics) in self._collection |
| 2422 | if c is not column |
| 2423 | ] |
| 2424 | for metrics in self._proxy_index.get(column, ()): |
| 2425 | metrics.dispose(self) |
| 2426 | |
| 2427 | self._index.update( |
| 2428 | {idx: (k, col) for idx, (k, col, _) in enumerate(self._collection)} |
| 2429 | ) |
| 2430 | # delete higher index |
| 2431 | del self._index[len(self._collection)] |
| 2432 | |
| 2433 | def replace( |
| 2434 | self, |