MCPcopy Index your code
hub / github.com/RustPython/RustPython / visit_BinOp

Method visit_BinOp

Lib/inspect.py:2218–2231  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 2

isinstanceFunction · 0.85
visitMethod · 0.45

Tested by

no test coverage detected