From 7440c779f2d877cadc5e30056907ef2d8c9c8b4f Mon Sep 17 00:00:00 2001 From: guilhermesenko Date: Mon, 27 Oct 2025 16:48:06 -0300 Subject: [PATCH 1/3] Refactor: migrate imports from typing_extensions to typing --- mypy/checker.py | 3 ++- mypy/checkexpr.py | 3 ++- mypy/config_parser.py | 3 ++- mypy/constraints.py | 2 +- mypy/errors.py | 3 ++- mypy/nodes.py | 3 ++- mypy/semanal.py | 3 ++- mypy/types.py | 3 ++- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/mypy/checker.py b/mypy/checker.py index c1cb29652e88..de33bdcccf7f 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -18,7 +18,8 @@ cast, overload, ) -from typing_extensions import TypeAlias as _TypeAlias, TypeGuard +from typing import TypeGuard +from typing_extensions import TypeAlias import mypy.checkexpr from mypy import errorcodes as codes, join, message_registry, nodes, operators diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index 3eb54579a050..cdc047be4219 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -9,7 +9,8 @@ from collections.abc import Iterable, Iterator, Sequence from contextlib import contextmanager, nullcontext from typing import Callable, ClassVar, Final, Optional, cast, overload -from typing_extensions import TypeAlias as _TypeAlias, assert_never +from typing import assert_never +from typing_extensions import TypeAlias import mypy.checker import mypy.errorcodes as codes diff --git a/mypy/config_parser.py b/mypy/config_parser.py index 2bfd2a1e2eef..96603ea351af 100644 --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -15,7 +15,8 @@ from collections.abc import Mapping, MutableMapping, Sequence from typing import Any, Callable, Final, TextIO, Union -from typing_extensions import Never, TypeAlias +from typing import Never +from typing_extensions import TypeAlias from mypy import defaults from mypy.options import PER_MODULE_OPTIONS, Options diff --git a/mypy/constraints.py b/mypy/constraints.py index 96c0c7ccaf35..66ad433d14e7 100644 --- a/mypy/constraints.py +++ b/mypy/constraints.py @@ -4,7 +4,7 @@ from collections.abc import Iterable, Sequence from typing import TYPE_CHECKING, Final, cast -from typing_extensions import TypeGuard +from typing import TypeGuard import mypy.subtypes import mypy.typeops diff --git a/mypy/errors.py b/mypy/errors.py index 69e4fb4cf065..a6e50feea6e5 100644 --- a/mypy/errors.py +++ b/mypy/errors.py @@ -7,7 +7,8 @@ from collections.abc import Iterable, Iterator from itertools import chain from typing import Callable, Final, NoReturn, Optional, TextIO, TypeVar -from typing_extensions import Literal, Self, TypeAlias as _TypeAlias +from typing import Literal +from typing_extensions import Self, TypeAlias from mypy import errorcodes as codes from mypy.error_formatter import ErrorFormatter diff --git a/mypy/nodes.py b/mypy/nodes.py index 040f3fc28dce..a5248fa8c33b 100644 --- a/mypy/nodes.py +++ b/mypy/nodes.py @@ -9,7 +9,8 @@ from collections.abc import Iterator, Sequence from enum import Enum, unique from typing import TYPE_CHECKING, Any, Callable, Final, Optional, TypeVar, Union, cast -from typing_extensions import TypeAlias as _TypeAlias, TypeGuard +from typing import TypeGuard +from typing_extensions import TypeAlias from mypy_extensions import trait diff --git a/mypy/semanal.py b/mypy/semanal.py index d7b50bd09496..4b22507c1750 100644 --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -53,7 +53,8 @@ from collections.abc import Collection, Iterable, Iterator from contextlib import contextmanager from typing import Any, Callable, Final, TypeVar, cast -from typing_extensions import TypeAlias as _TypeAlias, TypeGuard +from typing import TypeGuard +from typing_extensions import TypeAlias from mypy import errorcodes as codes, message_registry from mypy.constant_fold import constant_fold_expr diff --git a/mypy/types.py b/mypy/types.py index 426d560c2bf7..52794b23b0e3 100644 --- a/mypy/types.py +++ b/mypy/types.py @@ -6,7 +6,8 @@ from abc import abstractmethod from collections.abc import Iterable, Sequence from typing import TYPE_CHECKING, Any, ClassVar, Final, NewType, TypeVar, Union, cast, overload -from typing_extensions import Self, TypeAlias as _TypeAlias, TypeGuard +from typing import TypeGuard +from typing_extensions import Self, TypeAlias import mypy.nodes from mypy.bogus_type import Bogus From b6561e294fecf1921b6af36b2f74bf3dc44a3c4b Mon Sep 17 00:00:00 2001 From: guilhermesenko Date: Tue, 28 Oct 2025 11:13:30 -0300 Subject: [PATCH 2/3] Refactor: migrate imports from typing_extensions to typing (partial #8043) --- .gitignore | Bin 599 -> 717 bytes mypy/checker.py | 3 +-- mypy/checkexpr.py | 3 +-- mypy/config_parser.py | 3 +-- mypy/constraints.py | 2 +- mypy/errors.py | 5 ++--- mypy/nodes.py | 3 +-- mypy/semanal.py | 3 +-- mypy/types.py | 3 +-- 9 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 9c325f3e29f8af3eaee4640a15040b89c954bbdb..e4abde6e20284c7051077408c2d7ec53864466eb 100644 GIT binary patch literal 717 zcmY*XL2leI4CL8>|6m}u1#CZ|ha?4hN`O5Ug`kzWUUg+lkYuO2^z9wm-XOh*A~_sV zLtPf@hQ6+p3dLx1W2Nfq)P?fX_~93>f9tBh2nd$v^#ttTP1<7*C;25B?$rUD3dnlE zJ|m~jP7Vxy$*Ad8VX7-J;tF1E-Nm!Bi9GR~wNn_#+&S*a?sxJt02{KdGN;@QI_o}Y zbJruMz6&-e=gl2M3hATbtJ81ojFNJNdBT$Gs;-`z_k%^=&*ONQ*3MUd+|v&H@$!mW zX9w0WYl2d|XI48knWx~Rj-|O;#{xWc>EoMFY(`qW1&%t~d2G%lp+HbCXLZg#9!$@E z1!Uyr`%ZGplQVt=4(FDEenJ(BJft}^!Q!@eJ;W5mYGYosgVv~iFZm`SUhE95oxR|M z;BFaMv`0D8EjlDCuux=2ow-5|q_h8nm<{d6joGymXDthm+`bPiDp+~yCK(dPG!pFh vZ-Jg|%%A_~|0pyn82ANW#Oo%{@<>VPm&H)zr_XmiygCMkjq%6W5z zp%mQZ54Nn0j4HW`#|R4nJT=F?0Pl+9xSgGy&wevg(YzmC6OT5a=Ft=Lz~Wu))DTX= zM;&u>whmd;igbJC)N-=sBVg2I=dn5E#9~$)PU=KH))Fs%<@kurTg|@E Date: Tue, 28 Oct 2025 14:52:39 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .gitignore | Bin 717 -> 718 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index e4abde6e20284c7051077408c2d7ec53864466eb..e594ffd9046c8ba66cf1b48a202df68029569919 100644 GIT binary patch delta 9 QcmX@hdX9C&Stdp<02AB;FaQ7m delta 7 OcmX@ddX{y=StbAthyx`6