MCPcopy Index your code
hub / github.com/python/mypy / visit_UnaryOp

Method visit_UnaryOp

mypy/fastparse.py:1508–1523  ·  view source on GitHub ↗
(self, n: ast3.UnaryOp)

Source from the content-addressed store, hash-verified

1506
1507 # UnaryOp(unaryop op, expr operand)
1508 def visit_UnaryOp(self, n: ast3.UnaryOp) -> UnaryExpr:
1509 op = None
1510 if isinstance(n.op, ast3.Invert):
1511 op = "~"
1512 elif isinstance(n.op, ast3.Not):
1513 op = "not"
1514 elif isinstance(n.op, ast3.UAdd):
1515 op = "+"
1516 elif isinstance(n.op, ast3.USub):
1517 op = "-"
1518
1519 if op is None:
1520 raise RuntimeError("cannot translate UnaryOp " + str(type(n.op)))
1521
1522 e = UnaryExpr(op, self.visit(n.operand))
1523 return self.set_line(e, n)
1524
1525 # Lambda(arguments args, expr body)
1526 def visit_Lambda(self, n: ast3.Lambda) -> LambdaExpr:

Callers

nothing calls this directly

Calls 7

visitMethod · 0.95
set_lineMethod · 0.95
UnaryExprClass · 0.90
isinstanceFunction · 0.85
RuntimeErrorClass · 0.85
strClass · 0.85
typeClass · 0.85

Tested by

no test coverage detected