diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 74844e94a..2a6172ba4 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -178,9 +178,9 @@ _CanvasItemId = int _Color = str # typically '#rrggbb', '#rgb' or color names. _Compound = Literal["top", "left", "center", "right", "bottom", "none"] # -compound in manual page named 'options' _Cursor = Union[str, tuple[str], tuple[str, str], tuple[str, str, str], tuple[str, str, str, str]] # manual page: Tk_GetCursor -_EntryValidateCommand = Union[ - Callable[[], bool], str, list[str], tuple[str, ...] -] # example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P'] +_EntryValidateCommand = ( + str | list[str] | tuple[str, ...] | Callable[[], bool] +) # example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P'] _GridIndex = int | str | Literal["all"] _ImageSpec = _Image | str # str can be from e.g. tkinter.image_names() _Padding = Union[ diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 88b9fbeb6..4ad3ab3da 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -1138,21 +1138,19 @@ class Pattern(Generic[AnyStr]): # Functions if sys.version_info >= (3, 7): - _get_type_hints_obj_allowed_types = Union[ - object, - Callable[..., Any], - FunctionType, - BuiltinFunctionType, - MethodType, - ModuleType, - WrapperDescriptorType, - MethodWrapperType, - MethodDescriptorType, - ] + _get_type_hints_obj_allowed_types = ( + object + | Callable[..., Any] + | FunctionType + | BuiltinFunctionType + | MethodType + | ModuleType + | WrapperDescriptorType + | MethodWrapperType + | MethodDescriptorType + ) else: - _get_type_hints_obj_allowed_types = Union[ - object, Callable[..., Any], FunctionType, BuiltinFunctionType, MethodType, ModuleType, - ] + _get_type_hints_obj_allowed_types = object | Callable[..., Any] | FunctionType | BuiltinFunctionType | MethodType | ModuleType if sys.version_info >= (3, 9): def get_type_hints( diff --git a/stubs/Pillow/PIL/ImageDraw.pyi b/stubs/Pillow/PIL/ImageDraw.pyi index a5424aa82..dab68e666 100644 --- a/stubs/Pillow/PIL/ImageDraw.pyi +++ b/stubs/Pillow/PIL/ImageDraw.pyi @@ -1,12 +1,12 @@ from collections.abc import Container -from typing import Any, Sequence, Union, overload +from typing import Any, Sequence, overload from typing_extensions import Literal from .Image import Image from .ImageColor import _Ink from .ImageFont import _Font -_XY = Sequence[Union[float, tuple[float, float]]] +_XY = Sequence[float | tuple[float, float]] _Outline = Any class ImageDraw: diff --git a/stubs/beautifulsoup4/bs4/element.pyi b/stubs/beautifulsoup4/bs4/element.pyi index 7f6865b60..4468480a3 100644 --- a/stubs/beautifulsoup4/bs4/element.pyi +++ b/stubs/beautifulsoup4/bs4/element.pyi @@ -27,7 +27,6 @@ class ContentMetaAttributeValue(AttributeValueWithCharsetSubstitution): def encode(self, encoding: str) -> str: ... # type: ignore[override] # incompatible with str _PageElementT = TypeVar("_PageElementT", bound=PageElement) -# The wrapping Union[] can be removed once mypy fully supports | in type aliases. _SimpleStrainable = str | bool | None | bytes | Pattern[str] | Callable[[str], bool] | Callable[[Tag], bool] _Strainable = _SimpleStrainable | Iterable[_SimpleStrainable] _SimpleNormalizedStrainable = str | bool | None | Pattern[str] | Callable[[str], bool] | Callable[[Tag], bool] diff --git a/stubs/colorama/colorama/ansitowin32.pyi b/stubs/colorama/colorama/ansitowin32.pyi index ba1ba3e00..0bb2694f8 100644 --- a/stubs/colorama/colorama/ansitowin32.pyi +++ b/stubs/colorama/colorama/ansitowin32.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import SupportsWrite from types import TracebackType -from typing import Any, Callable, Pattern, Sequence, TextIO, Union +from typing import Any, Callable, Pattern, Sequence, TextIO if sys.platform == "win32": from .winterm import WinTerm @@ -23,7 +23,7 @@ class StreamWrapper: def closed(self) -> bool: ... _WinTermCall = Callable[[int | None, bool, bool], None] -_WinTermCallDict = dict[int, Union[tuple[_WinTermCall], tuple[_WinTermCall, int], tuple[_WinTermCall, int, bool]]] +_WinTermCallDict = dict[int, tuple[_WinTermCall] | tuple[_WinTermCall, int] | tuple[_WinTermCall, int, bool]] class AnsiToWin32: ANSI_CSI_RE: Pattern[str] = ...