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], ...]]
)
| 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 |
no test coverage detected