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

Method visit_op_expr

mypy/semanal.py:6173–6188  ·  view source on GitHub ↗
(self, expr: OpExpr)

Source from the content-addressed store, hash-verified

6171 expr.node = n.node
6172
6173 def visit_op_expr(self, expr: OpExpr) -> None:
6174 expr.left.accept(self)
6175
6176 if expr.op in ("and", "or"):
6177 inferred = infer_condition_value(expr.left, self.options)
6178 if (inferred in (ALWAYS_FALSE, MYPY_FALSE) and expr.op == "and") or (
6179 inferred in (ALWAYS_TRUE, MYPY_TRUE) and expr.op == "or"
6180 ):
6181 expr.right_unreachable = True
6182 return
6183 elif (inferred in (ALWAYS_TRUE, MYPY_TRUE) and expr.op == "and") or (
6184 inferred in (ALWAYS_FALSE, MYPY_FALSE) and expr.op == "or"
6185 ):
6186 expr.right_always = True
6187
6188 expr.right.accept(self)
6189
6190 def visit_comparison_expr(self, expr: ComparisonExpr) -> None:
6191 for operand in expr.operands:

Callers

nothing calls this directly

Calls 2

infer_condition_valueFunction · 0.90
acceptMethod · 0.45

Tested by

no test coverage detected