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

Method analyze_lvalues

mypy/semanal.py:3678–3701  ·  view source on GitHub ↗
(self, s: AssignmentStmt)

Source from the content-addressed store, hash-verified

3676 return len(s.lvalues) == 1 and isinstance(s.lvalues[0], NameExpr)
3677
3678 def analyze_lvalues(self, s: AssignmentStmt) -> None:
3679 # We cannot use s.type, because analyze_simple_literal_type() will set it.
3680 explicit = s.unanalyzed_type is not None
3681 if self.is_final_type(s.unanalyzed_type):
3682 # We need to exclude bare Final.
3683 assert isinstance(s.unanalyzed_type, UnboundType)
3684 if not s.unanalyzed_type.args:
3685 explicit = False
3686
3687 if s.rvalue:
3688 if isinstance(s.rvalue, TempNode):
3689 has_explicit_value = not s.rvalue.no_rhs
3690 else:
3691 has_explicit_value = True
3692 else:
3693 has_explicit_value = False
3694
3695 for lval in s.lvalues:
3696 self.analyze_lvalue(
3697 lval,
3698 explicit_type=explicit,
3699 is_final=s.is_final_def,
3700 has_explicit_value=has_explicit_value,
3701 )
3702
3703 def analyze_rvalue_as_type_form(self, s: AssignmentStmt) -> None:
3704 if TYPE_FORM in self.options.enable_incomplete_feature:

Callers 1

visit_assignment_stmtMethod · 0.95

Calls 3

is_final_typeMethod · 0.95
analyze_lvalueMethod · 0.95
isinstanceFunction · 0.85

Tested by

no test coverage detected