MCPcopy Index your code
hub / github.com/reactive-python/reactpy / _find_elements

Function _find_elements

src/py/reactpy/tests/tooling/select.py:87–101  ·  view source on GitHub ↗
(
    element: VdomJson,
    selector: Selector,
    parents: Sequence[VdomJson],
    path: Sequence[int],
)

Source from the content-addressed store, hash-verified

85
86
87def _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

Callers 1

find_elementsFunction · 0.85

Calls 2

ElementInfoClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected