Function
_apply_unique_strategy
(
rows: Sequence[Any],
destination: list[Any],
uniques: set[Any],
strategy: Callable[[Any], Any] | None,
)
Source from the content-addressed store, hash-verified
| 694 | @cython.inline |
| 695 | @cython.cfunc |
| 696 | def _apply_unique_strategy( |
| 697 | rows: Sequence[Any], |
| 698 | destination: list[Any], |
| 699 | uniques: set[Any], |
| 700 | strategy: Callable[[Any], Any] | None, |
| 701 | ) -> list[Any]: |
| 702 | i: cython.Py_ssize_t |
| 703 | has_strategy: cython.bint = strategy is not None |
| 704 | for i in range(len(rows)): |
| 705 | row = rows[i] |
| 706 | hashed = strategy(row) if has_strategy else row |
| 707 | if hashed in uniques: |
| 708 | continue |
| 709 | uniques.add(hashed) |
| 710 | destination.append(row) |
| 711 | return destination |
Tested by
no test coverage detected