16.67%
12 statements
« prev ^ index » next coverage.py v7.6.8, created at 2024-11-25 15:36:16 +00:00
« prev ^ index » next coverage.py v7.6.8, created at 2024-11-25 15:36:16 +00:00
1"""Apply all pairs in patches to incoming."""
3from collections.abc import Iterable
5from liitos import log
8def apply(patches: list[tuple[str, str]], incoming: Iterable[str]) -> list[str]:
9 """Later alligator."""
10 outgoing = [line for line in incoming]
12 log.info(f'applying patches to {len(outgoing)} lines of text')
13 for this, that in patches:
14 log.info(f' - trying any ({this}) --> ({that}) ...')
15 for n, text in enumerate(outgoing):
16 if this in text:
17 log.info(f' + found match ({text})')
18 outgoing[n] = text.replace(this, that)
20 return outgoing