(self, node)
| 2216 | return wrap_value(node.id) |
| 2217 | |
| 2218 | def visit_BinOp(self, node): |
| 2219 | # Support constant folding of a couple simple binary operations |
| 2220 | # commonly used to define default values in text signatures |
| 2221 | left = self.visit(node.left) |
| 2222 | right = self.visit(node.right) |
| 2223 | if not isinstance(left, ast.Constant) or not isinstance(right, ast.Constant): |
| 2224 | raise ValueError |
| 2225 | if isinstance(node.op, ast.Add): |
| 2226 | return ast.Constant(left.value + right.value) |
| 2227 | elif isinstance(node.op, ast.Sub): |
| 2228 | return ast.Constant(left.value - right.value) |
| 2229 | elif isinstance(node.op, ast.BitOr): |
| 2230 | return ast.Constant(left.value | right.value) |
| 2231 | raise ValueError |
| 2232 | |
| 2233 | def p(name_node, default_node, default=empty): |
| 2234 | name = parse_name(name_node) |
nothing calls this directly
no test coverage detected