|
6 | 6 | import copy |
7 | 7 | import itertools |
8 | 8 | import warnings |
| 9 | +from collections.abc import Callable |
9 | 10 | from typing import Any |
10 | 11 |
|
11 | 12 | from lark import Token, v_args |
@@ -567,19 +568,21 @@ def replace_str_date_with_datetime(subdict, prop, expr): |
567 | 568 | ) |
568 | 569 |
|
569 | 570 |
|
570 | | -def recursive_postprocessing(filter_: dict | list, condition, replacement): |
| 571 | +def recursive_postprocessing( |
| 572 | + filter_: dict | list, condition: Callable, replacement: Callable |
| 573 | +): |
571 | 574 | """Recursively descend into the query, checking each dictionary |
572 | 575 | (contained in a list, or as an entry in another dictionary) for |
573 | 576 | the condition passed. If the condition is true, apply the |
574 | 577 | replacement to the dictionary. |
575 | 578 |
|
576 | 579 | Parameters: |
577 | | - filter_ : the filter_ to process. |
578 | | - condition (callable): a function that returns True if the |
| 580 | + filter_: the filter to process. |
| 581 | + condition: a function that returns True if the |
579 | 582 | replacement function should be applied. It should take |
580 | 583 | as arguments the property and expression from the filter_, |
581 | 584 | as would be returned by iterating over `filter_.items()`. |
582 | | - replacement (callable): a function that returns the processed |
| 585 | + replacement: a function that returns the processed |
583 | 586 | dictionary. It should take as arguments the dictionary |
584 | 587 | to modify, the property and the expression (as described |
585 | 588 | above). |
|
0 commit comments