Skip to content

Commit 7745bd2

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 139b2a9 commit 7745bd2

1 file changed

Lines changed: 51 additions & 17 deletions

File tree

mypy/checkexpr.py

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,8 +1799,15 @@ def check_callable_call(
17991799
arg_types = self.infer_arg_types_in_context(callee, args, arg_kinds, formal_to_actual)
18001800

18011801
self.check_call_arguments(
1802-
callee, arg_types, arg_kinds, arg_names, args,
1803-
formal_to_actual, context, callable_name, object_type,
1802+
callee,
1803+
arg_types,
1804+
arg_kinds,
1805+
arg_names,
1806+
args,
1807+
formal_to_actual,
1808+
context,
1809+
callable_name,
1810+
object_type,
18041811
)
18051812

18061813
if (
@@ -2345,8 +2352,14 @@ def check_call_arguments(
23452352
"""Check argument count and types, consolidating errors for missing positional args."""
23462353
with self.msg.filter_errors():
23472354
_, missing_positional = self.check_argument_count(
2348-
callee, arg_types, arg_kinds, arg_names, formal_to_actual,
2349-
context, object_type, callable_name,
2355+
callee,
2356+
arg_types,
2357+
arg_kinds,
2358+
arg_names,
2359+
formal_to_actual,
2360+
context,
2361+
object_type,
2362+
callable_name,
23502363
)
23512364

23522365
if missing_positional:
@@ -2363,8 +2376,13 @@ def check_call_arguments(
23632376

23642377
with self.msg.filter_errors() as type_error_watcher:
23652378
self.check_argument_types(
2366-
arg_types, arg_kinds, args, callee, formal_to_actual, context,
2367-
object_type=object_type
2379+
arg_types,
2380+
arg_kinds,
2381+
args,
2382+
callee,
2383+
formal_to_actual,
2384+
context,
2385+
object_type=object_type,
23682386
)
23692387
has_type_errors = type_error_watcher.has_new_errors()
23702388

@@ -2392,17 +2410,34 @@ def check_call_arguments(
23922410
)
23932411
else:
23942412
self.check_argument_count(
2395-
callee, arg_types, arg_kinds, arg_names, formal_to_actual,
2396-
context, object_type, callable_name,
2413+
callee,
2414+
arg_types,
2415+
arg_kinds,
2416+
arg_names,
2417+
formal_to_actual,
2418+
context,
2419+
object_type,
2420+
callable_name,
23972421
)
23982422
else:
23992423
self.check_argument_count(
2400-
callee, arg_types, arg_kinds, arg_names, formal_to_actual,
2401-
context, object_type, callable_name,
2424+
callee,
2425+
arg_types,
2426+
arg_kinds,
2427+
arg_names,
2428+
formal_to_actual,
2429+
context,
2430+
object_type,
2431+
callable_name,
24022432
)
24032433
self.check_argument_types(
2404-
arg_types, arg_kinds, args, callee, formal_to_actual, context,
2405-
object_type=object_type
2434+
arg_types,
2435+
arg_kinds,
2436+
args,
2437+
callee,
2438+
formal_to_actual,
2439+
context,
2440+
object_type=object_type,
24062441
)
24072442

24082443
def detect_shifted_positional_args(
@@ -2452,7 +2487,9 @@ def detect_shifted_positional_args(
24522487
next_idx = i + 1
24532488
if next_idx >= len(positional_formal_types):
24542489
break
2455-
if is_subtype(actual_type, positional_formal_types[next_idx], options=self.chk.options):
2490+
if is_subtype(
2491+
actual_type, positional_formal_types[next_idx], options=self.chk.options
2492+
):
24562493
shift_position = i
24572494
break
24582495
else:
@@ -2475,10 +2512,7 @@ def detect_shifted_positional_args(
24752512
)
24762513

24772514
def _validate_shift_insertion(
2478-
self,
2479-
actual_types: list[Type],
2480-
formal_types: list[Type],
2481-
insert_position: int,
2515+
self, actual_types: list[Type], formal_types: list[Type], insert_position: int
24822516
) -> bool:
24832517
"""Check if inserting an argument at insert_position would fix type errors."""
24842518
for i, actual_type in enumerate(actual_types):

0 commit comments

Comments
 (0)