| 2108 | self._populate_separate_keys((col.key, col) for col in iter_) |
| 2109 | |
| 2110 | def remove(self, column: _NAMEDCOL) -> None: # type: ignore[override] |
| 2111 | if column not in self._colset: |
| 2112 | raise ValueError( |
| 2113 | "Can't remove column %r; column is not in this collection" |
| 2114 | % column |
| 2115 | ) |
| 2116 | del self._index[column.key] |
| 2117 | self._colset.remove(column) |
| 2118 | self._collection[:] = [ |
| 2119 | (k, c, metrics) |
| 2120 | for (k, c, metrics) in self._collection |
| 2121 | if c is not column |
| 2122 | ] |
| 2123 | for metrics in self._proxy_index.get(column, ()): |
| 2124 | metrics.dispose(self) |
| 2125 | |
| 2126 | self._index.update( |
| 2127 | {idx: (k, col) for idx, (k, col, _) in enumerate(self._collection)} |
| 2128 | ) |
| 2129 | # delete higher index |
| 2130 | del self._index[len(self._collection)] |
| 2131 | |
| 2132 | def replace( |
| 2133 | self, |