The context hint can be used to perform an static optimization based on the context given.
(node: nodes.Node, environment: "Environment")
| 18 | |
| 19 | |
| 20 | def optimize(node: nodes.Node, environment: "Environment") -> nodes.Node: |
| 21 | """The context hint can be used to perform an static optimization |
| 22 | based on the context given.""" |
| 23 | optimizer = Optimizer(environment) |
| 24 | return t.cast(nodes.Node, optimizer.visit(node)) |
| 25 | |
| 26 | |
| 27 | class Optimizer(NodeTransformer): |