Reset the context of a node and all child nodes. Per default the parser will all generate nodes that have a 'load' context as it's the most common one. This method is used in the parser to set assignment targets and other nodes to a store context.
(self, ctx)
| 192 | yield result |
| 193 | |
| 194 | def set_ctx(self, ctx): |
| 195 | """Reset the context of a node and all child nodes. Per default the |
| 196 | parser will all generate nodes that have a 'load' context as it's the |
| 197 | most common one. This method is used in the parser to set assignment |
| 198 | targets and other nodes to a store context. |
| 199 | """ |
| 200 | todo = deque([self]) |
| 201 | while todo: |
| 202 | node = todo.popleft() |
| 203 | if 'ctx' in node.fields: |
| 204 | node.ctx = ctx |
| 205 | todo.extend(node.iter_child_nodes()) |
| 206 | return self |
| 207 | |
| 208 | def set_lineno(self, lineno, override=False): |
| 209 | """Set the line numbers of the node and children.""" |
no test coverage detected