Find the first node of a given type. If no such node exists the return value is `None`.
(self, node_type: t.Type[_NodeBound])
| 182 | yield item |
| 183 | |
| 184 | def find(self, node_type: t.Type[_NodeBound]) -> t.Optional[_NodeBound]: |
| 185 | """Find the first node of a given type. If no such node exists the |
| 186 | return value is `None`. |
| 187 | """ |
| 188 | for result in self.find_all(node_type): |
| 189 | return result |
| 190 | |
| 191 | return None |
| 192 | |
| 193 | def find_all( |
| 194 | self, node_type: t.Union[t.Type[_NodeBound], t.Tuple[t.Type[_NodeBound], ...]] |