diff --git a/stdlib/@tests/test_cases/itertools/check_itertools_recipes.py b/stdlib/@tests/test_cases/itertools/check_itertools_recipes.py index 84f4bca5c868..cde875ccd4f1 100644 --- a/stdlib/@tests/test_cases/itertools/check_itertools_recipes.py +++ b/stdlib/@tests/test_cases/itertools/check_itertools_recipes.py @@ -10,23 +10,9 @@ import math import operator import sys +from collections.abc import Callable, Collection, Hashable, Iterable, Iterator, Sequence from itertools import chain, combinations, count, cycle, filterfalse, groupby, islice, product, repeat, starmap, tee, zip_longest -from typing import ( - Any, - Callable, - Collection, - Hashable, - Iterable, - Iterator, - Literal, - Sequence, - Tuple, - Type, - TypeAlias, - TypeVar, - Union, - overload, -) +from typing import Any, Literal, TypeAlias, TypeVar, overload from typing_extensions import TypeVarTuple, Unpack _T = TypeVar("_T") @@ -141,7 +127,7 @@ def first_true(iterable: Iterable[object], default: object = False, pred: Callab return next(filter(pred, iterable), default) -_ExceptionOrExceptionTuple: TypeAlias = Union[Type[BaseException], Tuple[Type[BaseException], ...]] +_ExceptionOrExceptionTuple: TypeAlias = type[BaseException] | tuple[type[BaseException], ...] @overload diff --git a/stubs/grpcio/@tests/test_cases/check_server_interceptor.py b/stubs/grpcio/@tests/test_cases/check_server_interceptor.py index 893ff591fb52..febad80e4bb8 100644 --- a/stubs/grpcio/@tests/test_cases/check_server_interceptor.py +++ b/stubs/grpcio/@tests/test_cases/check_server_interceptor.py @@ -1,8 +1,8 @@ from __future__ import annotations -from collections.abc import Callable +from collections.abc import Awaitable, Callable from concurrent.futures.thread import ThreadPoolExecutor -from typing import Awaitable, TypeVar +from typing import TypeVar import grpc import grpc.aio diff --git a/stubs/python-dateutil/@tests/test_cases/check_rrule.py b/stubs/python-dateutil/@tests/test_cases/check_rrule.py index db0810b38cdb..8c22c0f36c87 100644 --- a/stubs/python-dateutil/@tests/test_cases/check_rrule.py +++ b/stubs/python-dateutil/@tests/test_cases/check_rrule.py @@ -1,4 +1,3 @@ -from typing import Union from typing_extensions import assert_type from dateutil.rrule import rrule, rruleset, rrulestr @@ -10,4 +9,4 @@ assert_type(rs2, rruleset) rs3 = rrulestr("") -assert_type(rs3, Union[rrule, rruleset]) +assert_type(rs3, rrule | rruleset)