Skip to content

Commit c34a8da

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 6f77430 commit c34a8da

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

mypy/checker.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3266,12 +3266,9 @@ def check_assignment(
32663266
lvalue, None, rvalue, "=", pre_check=True
32673267
)
32683268
lvalue_type, index_lvalue, inferred = self.check_lvalue(lvalue, rvalue)
3269-
(
3270-
lvalue_type,
3271-
override_rvalue_type,
3272-
should_return,
3273-
skip_simple_assignment,
3274-
) = self.try_resolve_partial_type_from_assignment(lvalue, lvalue_type, rvalue, "=")
3269+
(lvalue_type, override_rvalue_type, should_return, skip_simple_assignment) = (
3270+
self.try_resolve_partial_type_from_assignment(lvalue, lvalue_type, rvalue, "=")
3271+
)
32753272
if should_return:
32763273
return
32773274
# If we're assigning to __getattr__ or similar methods, check that the signature is
@@ -4760,9 +4757,7 @@ def try_resolve_partial_type_from_assignment(
47604757
# None initializers preserve the partial None type.
47614758
return lvalue_type, rvalue_type, True, True
47624759

4763-
if is_valid_inferred_type(
4764-
rvalue_type, self.options, is_lvalue_final=var.is_final
4765-
):
4760+
if is_valid_inferred_type(rvalue_type, self.options, is_lvalue_final=var.is_final):
47664761
partial_types = self.find_partial_types(var)
47674762
if partial_types is None:
47684763
return lvalue_type, rvalue_type, False, True
@@ -4857,11 +4852,7 @@ def try_infer_partial_type_from_indexed_assignment(
48574852
if partial_types is None:
48584853
return
48594854
typename = type_info.fullname
4860-
if typename not in (
4861-
"builtins.dict",
4862-
"collections.OrderedDict",
4863-
"collections.defaultdict",
4864-
):
4855+
if typename not in ("builtins.dict", "collections.OrderedDict", "collections.defaultdict"):
48654856
return
48664857
# TODO: Don't infer things twice.
48674858
key_type = self.expr_checker.accept(lvalue.index)
@@ -5101,12 +5092,9 @@ def visit_operator_assignment_stmt(self, s: OperatorAssignmentStmt) -> None:
51015092
lvalue_type = self.expr_checker.visit_member_expr(s.lvalue, True)
51025093
else:
51035094
lvalue_type = self.expr_checker.accept(s.lvalue)
5104-
(
5105-
lvalue_type,
5106-
_,
5107-
should_return,
5108-
_,
5109-
) = self.try_resolve_partial_type_from_assignment(s.lvalue, lvalue_type, s.rvalue, s.op)
5095+
(lvalue_type, _, should_return, _) = self.try_resolve_partial_type_from_assignment(
5096+
s.lvalue, lvalue_type, s.rvalue, s.op
5097+
)
51105098
if should_return:
51115099
self.check_final(s)
51125100
return

0 commit comments

Comments
 (0)