MCPcopy
hub / github.com/pallets/jinja / find_all

Method find_all

src/jinja2/nodes.py:195–204  ·  view source on GitHub ↗

Find all the nodes of a given type. If the type is a tuple, the check is performed for any of the tuple items.

(
        self, node_type: t.Union[t.Type[_NodeBound], t.Tuple[t.Type[_NodeBound], ...]]
    )

Source from the content-addressed store, hash-verified

193 return None
194
195 def find_all(
196 self, node_type: t.Union[t.Type[_NodeBound], t.Tuple[t.Type[_NodeBound], ...]]
197 ) -> t.Iterator[_NodeBound]:
198 """Find all the nodes of a given type. If the type is a tuple,
199 the check is performed for any of the tuple items.
200 """
201 for child in self.iter_child_nodes():
202 if isinstance(child, node_type):
203 yield child # type: ignore
204 yield from child.find_all(node_type)
205
206 def set_ctx(self, ctx: str) -> "Node":
207 """Reset the context of a node and all child nodes. Per default the

Callers 6

findMethod · 0.95
extract_from_astFunction · 0.80
visit_TemplateMethod · 0.80
visit_ForMethod · 0.80
visit_AssignMethod · 0.80

Calls 1

iter_child_nodesMethod · 0.95

Tested by

no test coverage detected