Combine a base predicate with state:modified tokens.
- 'state:modified' → filter to modified only
- 'state:modified+' → filter to modified union downstream(modified)
- Combined with other tokens → logical AND with base predicate
Source code in src/fastflowtransform/cli/selectors.py
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191 | def augment_with_state_modified(
tokens: list[str],
base_pred: Callable[[Any], bool],
modified: set[str],
) -> Callable[[Any], bool]:
"""
Combine a base predicate with state:modified tokens.
- 'state:modified' → filter to modified only
- 'state:modified+' → filter to modified union downstream(modified)
- Combined with other tokens → logical AND with base predicate
"""
if not any(t.startswith("state:modified") for t in tokens):
return base_pred
plus = any(t.startswith("state:modified+") for t in tokens)
state_set = set(modified)
if plus:
state_set = _downstream_closure(state_set)
other_tokens = [t for t in tokens if not t.startswith("state:modified")]
if not other_tokens:
return lambda n: n.name in state_set
return lambda n: (n.name in state_set) and base_pred(n)
|