Visit a statement. This implementation is shared for `if`, `while`, `for`, `try`, `except`, `def`, `with`, `class`, `assert`, and assignments. The relevant Python language `keywords` for a given statement will be NAME leaves within it. This methods puts those on a s
(
self, node: Node, keywords: set[str], parens: set[str]
)
| 209 | yield from self.line(-1) |
| 210 | |
| 211 | def visit_stmt( |
| 212 | self, node: Node, keywords: set[str], parens: set[str] |
| 213 | ) -> Iterator[Line]: |
| 214 | """Visit a statement. |
| 215 | |
| 216 | This implementation is shared for `if`, `while`, `for`, `try`, `except`, |
| 217 | `def`, `with`, `class`, `assert`, and assignments. |
| 218 | |
| 219 | The relevant Python language `keywords` for a given statement will be |
| 220 | NAME leaves within it. This methods puts those on a separate line. |
| 221 | |
| 222 | `parens` holds a set of string leaf values immediately after which |
| 223 | invisible parens should be put. |
| 224 | """ |
| 225 | normalize_invisible_parens( |
| 226 | node, parens_after=parens, mode=self.mode, features=self.features |
| 227 | ) |
| 228 | for child in node.children: |
| 229 | if is_name_token(child) and child.value in keywords: |
| 230 | yield from self.line() |
| 231 | |
| 232 | yield from self.visit(child) |
| 233 | |
| 234 | def visit_typeparams(self, node: Node) -> Iterator[Line]: |
| 235 | yield from self.visit_default(node) |
nothing calls this directly
no test coverage detected