Skip to content

Commit d6feadf

Browse files
authored
Use new tuples types in several modules (#13487)
1 parent 1efb110 commit d6feadf

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

mypy/join.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from __future__ import annotations
44

5-
from typing import Tuple
6-
75
import mypy.typeops
86
from mypy.maptype import map_instance_to_supertype
97
from mypy.nodes import CONTRAVARIANT, COVARIANT, INVARIANT
@@ -536,7 +534,7 @@ def is_better(t: Type, s: Type) -> bool:
536534
return False
537535

538536

539-
def normalize_callables(s: ProperType, t: ProperType) -> Tuple[ProperType, ProperType]:
537+
def normalize_callables(s: ProperType, t: ProperType) -> tuple[ProperType, ProperType]:
540538
if isinstance(s, (CallableType, Overloaded)):
541539
s = s.with_unpacked_kwargs()
542540
if isinstance(t, (CallableType, Overloaded)):

mypy/test/testinfer.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from __future__ import annotations
44

5-
from typing import Tuple
6-
75
from mypy.argmap import map_actuals_to_formals
86
from mypy.checker import DisjointDict, group_comparison_operands
97
from mypy.literals import Key
@@ -46,15 +44,18 @@ def test_too_many_caller_args(self) -> None:
4644

4745
def test_tuple_star(self) -> None:
4846
any_type = AnyType(TypeOfAny.special_form)
49-
self.assert_vararg_map([ARG_STAR], [ARG_POS], [[0]], self.tuple(any_type))
47+
self.assert_vararg_map([ARG_STAR], [ARG_POS], [[0]], self.make_tuple(any_type))
5048
self.assert_vararg_map(
51-
[ARG_STAR], [ARG_POS, ARG_POS], [[0], [0]], self.tuple(any_type, any_type)
49+
[ARG_STAR], [ARG_POS, ARG_POS], [[0], [0]], self.make_tuple(any_type, any_type)
5250
)
5351
self.assert_vararg_map(
54-
[ARG_STAR], [ARG_POS, ARG_OPT, ARG_OPT], [[0], [0], []], self.tuple(any_type, any_type)
52+
[ARG_STAR],
53+
[ARG_POS, ARG_OPT, ARG_OPT],
54+
[[0], [0], []],
55+
self.make_tuple(any_type, any_type),
5556
)
5657

57-
def tuple(self, *args: Type) -> TupleType:
58+
def make_tuple(self, *args: Type) -> TupleType:
5859
return TupleType(list(args), TypeFixture().std_tuple)
5960

6061
def test_named_args(self) -> None:
@@ -92,7 +93,7 @@ def test_special_cases(self) -> None:
9293
def assert_map(
9394
self,
9495
caller_kinds_: list[ArgKind | str],
95-
callee_kinds_: list[ArgKind | Tuple[ArgKind, str]],
96+
callee_kinds_: list[ArgKind | tuple[ArgKind, str]],
9697
expected: list[list[int]],
9798
) -> None:
9899
caller_kinds, caller_names = expand_caller_kinds(caller_kinds_)

0 commit comments

Comments
 (0)