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

Method visit_UnaryOp

Lib/_ast_unparse.py:818–828  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

816 }
817
818 def visit_UnaryOp(self, node):
819 operator = self.unop[node.op.__class__.__name__]
820 operator_precedence = self.unop_precedence[operator]
821 with self.require_parens(operator_precedence, node):
822 self.write(operator)
823 # factor prefixes (+, -, ~) shouldn't be separated
824 # from the value they belong, (e.g: +1 instead of + 1)
825 if operator_precedence is not _Precedence.FACTOR:
826 self.write(" ")
827 self.set_precedence(operator_precedence, node.operand)
828 self.traverse(node.operand)
829
830 binop = {
831 "Add": "+",

Callers

nothing calls this directly

Calls 4

require_parensMethod · 0.95
writeMethod · 0.95
set_precedenceMethod · 0.95
traverseMethod · 0.95

Tested by

no test coverage detected