Iterates over all direct child nodes of the node. This iterates over all fields and yields the values of they are nodes. If the value of a field is a list all the nodes in that list are returned.
(
self,
exclude: t.Optional[t.Container[str]] = None,
only: t.Optional[t.Container[str]] = None,
)
| 167 | pass |
| 168 | |
| 169 | def iter_child_nodes( |
| 170 | self, |
| 171 | exclude: t.Optional[t.Container[str]] = None, |
| 172 | only: t.Optional[t.Container[str]] = None, |
| 173 | ) -> t.Iterator["Node"]: |
| 174 | """Iterates over all direct child nodes of the node. This iterates |
| 175 | over all fields and yields the values of they are nodes. If the value |
| 176 | of a field is a list all the nodes in that list are returned. |
| 177 | """ |
| 178 | for _, item in self.iter_fields(exclude, only): |
| 179 | if isinstance(item, list): |
| 180 | for n in item: |
| 181 | if isinstance(n, Node): |
| 182 | yield n |
| 183 | elif isinstance(item, Node): |
| 184 | yield item |
| 185 | |
| 186 | def find(self, node_type: t.Type[_NodeBound]) -> t.Optional[_NodeBound]: |
| 187 | """Find the first node of a given type. If no such node exists the |
no test coverage detected