(
element: VdomJson,
selector: Selector,
parents: Sequence[VdomJson],
path: Sequence[int],
)
| 85 | |
| 86 | |
| 87 | def _find_elements( |
| 88 | element: VdomJson, |
| 89 | selector: Selector, |
| 90 | parents: Sequence[VdomJson], |
| 91 | path: Sequence[int], |
| 92 | ) -> tuple[VdomJson, ElementInfo] | None: |
| 93 | info = ElementInfo(parents, path) |
| 94 | if selector(element, info): |
| 95 | yield element, info |
| 96 | |
| 97 | for index, child in enumerate(element.get("children", [])): |
| 98 | if isinstance(child, dict): |
| 99 | yield from _find_elements( |
| 100 | child, selector, (*parents, element), (*path, index) |
| 101 | ) |
| 102 | |
| 103 | |
| 104 | @dataclass |
no test coverage detected