| 1464 | |
| 1465 | |
| 1466 | class _ColumnMetrics(Generic[_COL_co]): |
| 1467 | __slots__ = ("column",) |
| 1468 | |
| 1469 | column: _COL_co |
| 1470 | |
| 1471 | def __init__( |
| 1472 | self, collection: ColumnCollection[Any, _COL_co], col: _COL_co |
| 1473 | ) -> None: |
| 1474 | self.column = col |
| 1475 | |
| 1476 | # proxy_index being non-empty means it was initialized. |
| 1477 | # so we need to update it |
| 1478 | pi = collection._proxy_index |
| 1479 | if pi: |
| 1480 | for eps_col in col._expanded_proxy_set: |
| 1481 | pi[eps_col].add(self) |
| 1482 | |
| 1483 | def get_expanded_proxy_set(self) -> FrozenSet[ColumnElement[Any]]: |
| 1484 | return self.column._expanded_proxy_set |
| 1485 | |
| 1486 | def dispose(self, collection: ColumnCollection[_COLKEY, _COL_co]) -> None: |
| 1487 | pi = collection._proxy_index |
| 1488 | if not pi: |
| 1489 | return |
| 1490 | for col in self.column._expanded_proxy_set: |
| 1491 | colset = pi.get(col, None) |
| 1492 | if colset: |
| 1493 | colset.discard(self) |
| 1494 | if colset is not None and not colset: |
| 1495 | del pi[col] |
| 1496 | |
| 1497 | def embedded( |
| 1498 | self, |
| 1499 | target_set: Union[ |
| 1500 | Set[ColumnElement[Any]], FrozenSet[ColumnElement[Any]] |
| 1501 | ], |
| 1502 | ) -> bool: |
| 1503 | expanded_proxy_set = self.column._expanded_proxy_set |
| 1504 | for t in target_set.difference(expanded_proxy_set): |
| 1505 | if not expanded_proxy_set.intersection(_expand_cloned([t])): |
| 1506 | return False |
| 1507 | return True |
| 1508 | |
| 1509 | |
| 1510 | class ColumnCollection(Generic[_COLKEY, _COL_co]): |
no outgoing calls
no test coverage detected