| Total Complexity | 2 |
| Total Lines | 11 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # Copyright Pincer 2021-Present |
||
|
|
|||
| 2 | # Full MIT License can be found in `LICENSE` at the project root. |
||
| 3 | |||
| 4 | from typing import Any, Callable, Iterable, List, T |
||
| 5 | |||
| 6 | |||
| 7 | def replace( |
||
| 8 | func: Callable[[Any], bool], iter_: Iterable[T], new_item: T |
||
| 9 | ) -> List[T]: |
||
| 10 | return [item if func(item) else new_item for item in iter_] |
||
| 11 |