Analyze an lvalue or assignment target that is a list or tuple.
(self, lval: TupleExpr, explicit_type: bool = False)
| 4600 | func.def_or_infer_vars = True |
| 4601 | |
| 4602 | def analyze_tuple_or_list_lvalue(self, lval: TupleExpr, explicit_type: bool = False) -> None: |
| 4603 | """Analyze an lvalue or assignment target that is a list or tuple.""" |
| 4604 | items = lval.items |
| 4605 | star_exprs = [item for item in items if isinstance(item, StarExpr)] |
| 4606 | |
| 4607 | if len(star_exprs) > 1: |
| 4608 | self.fail("Two starred expressions in assignment", lval) |
| 4609 | else: |
| 4610 | if len(star_exprs) == 1: |
| 4611 | star_exprs[0].valid = True |
| 4612 | for i in items: |
| 4613 | self.analyze_lvalue( |
| 4614 | lval=i, |
| 4615 | nested=True, |
| 4616 | explicit_type=explicit_type, |
| 4617 | # Lists and tuples always have explicit values defined: |
| 4618 | # `a, b, c = value` |
| 4619 | has_explicit_value=True, |
| 4620 | ) |
| 4621 | |
| 4622 | def analyze_member_lvalue( |
| 4623 | self, lval: MemberExpr, explicit_type: bool, is_final: bool, has_explicit_value: bool |
no test coverage detected