Skip to content

Use new tuples #13487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions mypy/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

from typing import Tuple

import mypy.typeops
from mypy.maptype import map_instance_to_supertype
from mypy.nodes import CONTRAVARIANT, COVARIANT, INVARIANT
Expand Down Expand Up @@ -536,7 +534,7 @@ def is_better(t: Type, s: Type) -> bool:
return False


def normalize_callables(s: ProperType, t: ProperType) -> Tuple[ProperType, ProperType]:
def normalize_callables(s: ProperType, t: ProperType) -> tuple[ProperType, ProperType]:
if isinstance(s, (CallableType, Overloaded)):
s = s.with_unpacked_kwargs()
if isinstance(t, (CallableType, Overloaded)):
Expand Down
12 changes: 5 additions & 7 deletions mypy/test/testinfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

from typing import Tuple

from mypy.argmap import map_actuals_to_formals
from mypy.checker import DisjointDict, group_comparison_operands
from mypy.literals import Key
Expand Down Expand Up @@ -46,15 +44,15 @@ def test_too_many_caller_args(self) -> None:

def test_tuple_star(self) -> None:
any_type = AnyType(TypeOfAny.special_form)
self.assert_vararg_map([ARG_STAR], [ARG_POS], [[0]], self.tuple(any_type))
self.assert_vararg_map([ARG_STAR], [ARG_POS], [[0]], self.make_tuple(any_type))
self.assert_vararg_map(
[ARG_STAR], [ARG_POS, ARG_POS], [[0], [0]], self.tuple(any_type, any_type)
[ARG_STAR], [ARG_POS, ARG_POS], [[0], [0]], self.make_tuple(any_type, any_type)
)
self.assert_vararg_map(
[ARG_STAR], [ARG_POS, ARG_OPT, ARG_OPT], [[0], [0], []], self.tuple(any_type, any_type)
[ARG_STAR], [ARG_POS, ARG_OPT, ARG_OPT], [[0], [0], []], self.make_tuple(any_type, any_type)
)

def tuple(self, *args: Type) -> TupleType:
def make_tuple(self, *args: Type) -> TupleType:
return TupleType(list(args), TypeFixture().std_tuple)

def test_named_args(self) -> None:
Expand Down Expand Up @@ -92,7 +90,7 @@ def test_special_cases(self) -> None:
def assert_map(
self,
caller_kinds_: list[ArgKind | str],
callee_kinds_: list[ArgKind | Tuple[ArgKind, str]],
callee_kinds_: list[ArgKind | tuple[ArgKind, str]],
expected: list[list[int]],
) -> None:
caller_kinds, caller_names = expand_caller_kinds(caller_kinds_)
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ commands =
description = type check ourselves
commands =
python -m mypy --config-file mypy_self_check.ini -p mypy -p mypyc
python -m mypy --config-file mypy_self_check.ini scripts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to do this as part of this PR? Looks like it maybe should have been done as part of #13286? :)

python -m mypy --config-file mypy_self_check.ini misc --exclude misc/fix_annotate.py --exclude misc/async_matrix.py

[testenv:docs]
Expand Down