From 696cdc86d9d85a1eb238a62f37429bdf4f8bf53d Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 7 May 2026 18:29:24 +0200 Subject: [PATCH 1/7] Drop 3.9 support for third-party packages --- stubs/Markdown/markdown/util.pyi | 9 +-- stubs/Pygments/pygments/plugin.pyi | 11 +-- .../click_web/resources/input_fields.pyi | 6 +- stubs/fpdf2/fpdf/drawing.pyi | 8 +- stubs/mock/mock/backports.pyi | 7 +- stubs/networkx/networkx/_typing.pyi | 15 +--- stubs/networkx/networkx/utils/configs.pyi | 77 ++++++------------- stubs/networkx/networkx/utils/misc.pyi | 7 +- stubs/pony/pony/orm/sqlbuilding.pyi | 10 +-- stubs/psutil/psutil/__init__.pyi | 31 +------- stubs/pyflakes/pyflakes/checker.pyi | 40 +++------- stubs/shapely/shapely/predicates.pyi | 9 +-- 12 files changed, 52 insertions(+), 178 deletions(-) diff --git a/stubs/Markdown/markdown/util.pyi b/stubs/Markdown/markdown/util.pyi index f30f9e08432c..3a059c356561 100644 --- a/stubs/Markdown/markdown/util.pyi +++ b/stubs/Markdown/markdown/util.pyi @@ -1,5 +1,5 @@ -import sys from collections.abc import Iterator +from importlib import metadata from re import Pattern from typing import Final, Generic, TypedDict, TypeVar, overload, type_check_only @@ -19,12 +19,7 @@ HTML_PLACEHOLDER_RE: Final[Pattern[str]] TAG_PLACEHOLDER: Final[str] RTL_BIDI_RANGES: Final[tuple[tuple[str, str], tuple[str, str]]] -if sys.version_info >= (3, 10): - from importlib import metadata - def get_installed_extensions() -> metadata.EntryPoints: ... - -else: - def get_installed_extensions(): ... +def get_installed_extensions() -> metadata.EntryPoints: ... def deprecated(message: str, stacklevel: int = 2): ... @overload diff --git a/stubs/Pygments/pygments/plugin.pyi b/stubs/Pygments/pygments/plugin.pyi index a11c89351400..955fce980832 100644 --- a/stubs/Pygments/pygments/plugin.pyi +++ b/stubs/Pygments/pygments/plugin.pyi @@ -1,6 +1,6 @@ -import sys from _typeshed import Incomplete from collections.abc import Generator +from importlib.metadata import EntryPoints from typing import Final from pygments.filter import Filter @@ -13,14 +13,7 @@ FORMATTER_ENTRY_POINT: Final = "pygments.formatters" STYLE_ENTRY_POINT: Final = "pygments.styles" FILTER_ENTRY_POINT: Final = "pygments.filters" -if sys.version_info >= (3, 10): - from importlib.metadata import EntryPoints - def iter_entry_points(group_name: str) -> EntryPoints: ... - -else: - from importlib.metadata import EntryPoint - - def iter_entry_points(group_name: str) -> tuple[EntryPoint, ...] | list[EntryPoint]: ... +def iter_entry_points(group_name: str) -> EntryPoints: ... def find_plugin_lexers() -> Generator[type[Lexer]]: ... def find_plugin_formatters() -> Generator[tuple[str, type[Formatter[Incomplete]]]]: ... diff --git a/stubs/click-web/click_web/resources/input_fields.pyi b/stubs/click-web/click_web/resources/input_fields.pyi index ec2ede4d14b2..a77853d9f5df 100644 --- a/stubs/click-web/click_web/resources/input_fields.pyi +++ b/stubs/click-web/click_web/resources/input_fields.pyi @@ -1,4 +1,3 @@ -import sys from typing import Any, ClassVar, Final import click @@ -47,10 +46,7 @@ class BaseInput: def _build_name(self, name: str) -> str: ... class ChoiceInput(BaseInput): - if sys.version_info >= (3, 10): - param_type_cls: type[click.Choice[Any]] - else: - param_type_cls: type[click.Choice] + param_type_cls: type[click.Choice[Any]] class FlagInput(BaseInput): param_type_cls: None diff --git a/stubs/fpdf2/fpdf/drawing.pyi b/stubs/fpdf2/fpdf/drawing.pyi index 94b23cdd371b..d629c37a6a59 100644 --- a/stubs/fpdf2/fpdf/drawing.pyi +++ b/stubs/fpdf2/fpdf/drawing.pyi @@ -1,19 +1,13 @@ import decimal -import sys from _typeshed import Incomplete, SupportsWrite from collections import OrderedDict from collections.abc import Callable, Generator, Iterable, Sequence from contextlib import contextmanager from re import Pattern +from types import EllipsisType from typing import Any, ClassVar, Literal, NamedTuple, Protocol, TypeVar, overload, type_check_only from typing_extensions import Self, TypeAlias -if sys.version_info >= (3, 10): - from types import EllipsisType -else: - # Rely on builtins.ellipsis - from builtins import ellipsis as EllipsisType - from .enums import PathPaintRule from .syntax import Name, Raw diff --git a/stubs/mock/mock/backports.pyi b/stubs/mock/mock/backports.pyi index fd968db5d6cb..9cb45af2cd60 100644 --- a/stubs/mock/mock/backports.pyi +++ b/stubs/mock/mock/backports.pyi @@ -1,7 +1,2 @@ -import sys +from inspect import iscoroutinefunction as iscoroutinefunction from unittest import IsolatedAsyncioTestCase as IsolatedAsyncioTestCase - -if sys.version_info >= (3, 10): - from inspect import iscoroutinefunction as iscoroutinefunction -else: - from asyncio import iscoroutinefunction as iscoroutinefunction diff --git a/stubs/networkx/networkx/_typing.pyi b/stubs/networkx/networkx/_typing.pyi index ff530c5ba668..fcf7c0d42027 100644 --- a/stubs/networkx/networkx/_typing.pyi +++ b/stubs/networkx/networkx/_typing.pyi @@ -1,6 +1,5 @@ # Stub-only module, can't be imported at runtime. -import sys from collections.abc import Collection from typing import Any, Protocol, type_check_only from typing_extensions import TypeAlias, TypeVar @@ -13,17 +12,11 @@ _GenericT_co = TypeVar("_GenericT_co", bound=np.generic, covariant=True) _ShapeT_co = TypeVar("_ShapeT_co", bound=tuple[int, ...], default=Any, covariant=True) # numpy aliases -if sys.version_info >= (3, 10): - @type_check_only - class SupportsArray(Protocol[_GenericT_co, _ShapeT_co]): - def __array__(self) -> np.ndarray[_ShapeT_co, np.dtype[_GenericT_co]]: ... - - ArrayLike1D: TypeAlias = Collection[_ScalarT] | SupportsArray[_GenericT, tuple[int]] -else: - # networkx does not support Python 3.9 but pyright still runs on 3.9 in CI - # See https://github.com/python/typeshed/issues/10722 - ArrayLike1D: TypeAlias = Collection[_ScalarT] | np.ndarray[tuple[int], np.dtype[_GenericT]] +@type_check_only +class SupportsArray(Protocol[_GenericT_co, _ShapeT_co]): + def __array__(self) -> np.ndarray[_ShapeT_co, np.dtype[_GenericT_co]]: ... +ArrayLike1D: TypeAlias = Collection[_ScalarT] | SupportsArray[_GenericT, tuple[int]] Array1D: TypeAlias = np.ndarray[tuple[int], np.dtype[_GenericT]] Array2D: TypeAlias = np.ndarray[tuple[int, int], np.dtype[_GenericT]] Seed: TypeAlias = int | np.random.Generator | np.random.RandomState diff --git a/stubs/networkx/networkx/utils/configs.pyi b/stubs/networkx/networkx/utils/configs.pyi index b9206c9ace09..a9c590504a84 100644 --- a/stubs/networkx/networkx/utils/configs.pyi +++ b/stubs/networkx/networkx/utils/configs.pyi @@ -1,4 +1,3 @@ -import sys from _typeshed import Incomplete from collections.abc import Callable, ItemsView, Iterable, Iterator, KeysView, ValuesView from dataclasses import dataclass @@ -7,59 +6,31 @@ from typing_extensions import Self __all__ = ["Config"] -# TODO: Our pyright test doesn't understand `requires-python` in METADATA.toml -# https://github.com/python/typeshed/issues/14025 -if sys.version_info >= (3, 10): - @dataclass(init=False, eq=False, slots=True, kw_only=True, match_args=False) - class Config: - def __init_subclass__(cls, strict: bool = True) -> None: ... - def __new__(cls, **kwargs) -> Self: ... - def __dir__(self) -> Iterable[str]: ... - def __setattr__(self, name: str, value) -> None: ... - def __delattr__(self, name: str) -> None: ... - def __contains__(self, key: object) -> bool: ... - def __iter__(self) -> Iterator[str]: ... - def __len__(self) -> int: ... - def __reversed__(self) -> Iterator[str]: ... - def __getitem__(self, key: str): ... - def __setitem__(self, key: str, value) -> None: ... - def __delitem__(self, key: str) -> None: ... - def get(self, key: str, default=None): ... - def items(self) -> ItemsView[str, Incomplete]: ... - def keys(self) -> KeysView[str]: ... - def values(self) -> ValuesView[Incomplete]: ... - def __reduce__(self) -> tuple[Callable[..., Self], tuple[type[Self], dict[Incomplete, Incomplete]]]: ... - def __call__(self, **kwargs) -> Self: ... - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... +@dataclass(init=False, eq=False, slots=True, kw_only=True, match_args=False) +class Config: + def __init_subclass__(cls, strict: bool = True) -> None: ... + def __new__(cls, **kwargs) -> Self: ... + def __dir__(self) -> Iterable[str]: ... + def __setattr__(self, name: str, value) -> None: ... + def __delattr__(self, name: str) -> None: ... + def __contains__(self, key: object) -> bool: ... + def __iter__(self) -> Iterator[str]: ... + def __len__(self) -> int: ... + def __reversed__(self) -> Iterator[str]: ... + def __getitem__(self, key: str): ... + def __setitem__(self, key: str, value) -> None: ... + def __delitem__(self, key: str) -> None: ... + def get(self, key: str, default=None): ... + def items(self) -> ItemsView[str, Incomplete]: ... + def keys(self) -> KeysView[str]: ... + def values(self) -> ValuesView[Incomplete]: ... + def __reduce__(self) -> tuple[Callable[..., Self], tuple[type[Self], dict[Incomplete, Incomplete]]]: ... + def __call__(self, **kwargs) -> Self: ... + def __enter__(self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None + ) -> None: ... -else: - @dataclass(init=False, eq=False) - class Config: - def __init_subclass__(cls, strict: bool = True) -> None: ... - def __new__(cls, **kwargs) -> Self: ... - def __dir__(self) -> Iterable[str]: ... - def __setattr__(self, name: str, value) -> None: ... - def __delattr__(self, name: str) -> None: ... - def __contains__(self, key: object) -> bool: ... - def __iter__(self) -> Iterator[str]: ... - def __len__(self) -> int: ... - def __reversed__(self) -> Iterator[str]: ... - def __getitem__(self, key: str): ... - def __setitem__(self, key: str, value) -> None: ... - def __delitem__(self, key: str) -> None: ... - def get(self, key: str, default=None): ... - def items(self) -> ItemsView[str, Incomplete]: ... - def keys(self) -> KeysView[str]: ... - def values(self) -> ValuesView[Incomplete]: ... - def __reduce__(self) -> tuple[Callable[..., Self], tuple[type[Self], dict[Incomplete, Incomplete]]]: ... - def __call__(self, **kwargs) -> Self: ... - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... class NetworkXConfig(Config): backend_priority: list[str] diff --git a/stubs/networkx/networkx/utils/misc.pyi b/stubs/networkx/networkx/utils/misc.pyi index f925c63d1b8b..9b2ff26090f8 100644 --- a/stubs/networkx/networkx/utils/misc.pyi +++ b/stubs/networkx/networkx/utils/misc.pyi @@ -1,7 +1,6 @@ import random -import sys from types import ModuleType -from typing_extensions import Self, TypeAlias +from typing_extensions import TypeAlias import numpy from networkx.classes.graph import Graph, _Node @@ -38,10 +37,6 @@ def create_random_state(random_state=None): ... class PythonRandomViaNumpyBits(random.Random): def __init__(self, rng: numpy.random.Generator | None = None) -> None: ... - if sys.version_info < (3, 10): - # this is a workaround for pyright correctly flagging an inconsistent inherited constructor, see #14624 - def __new__(cls, rng: numpy.random.Generator | None = None) -> Self: ... - def getrandbits(self, k: int) -> int: ... class PythonRandomInterface: diff --git a/stubs/pony/pony/orm/sqlbuilding.pyi b/stubs/pony/pony/orm/sqlbuilding.pyi index abfe2f849511..e123d2be9993 100644 --- a/stubs/pony/pony/orm/sqlbuilding.pyi +++ b/stubs/pony/pony/orm/sqlbuilding.pyi @@ -1,4 +1,3 @@ -import sys import types from _typeshed import Incomplete from collections.abc import Iterable @@ -143,13 +142,8 @@ class SQLBuilder: def RANDOM(builder): ... def RAWSQL(builder, sql): ... def build_json_path(builder, path): ... - if sys.version_info >= (3, 10): - @classmethod - def eval_json_path(cls, values: Iterable[int | str | types.EllipsisType | slice]) -> str: ... - else: - @classmethod - def eval_json_path(cls, values: Iterable[int | str | type | slice]) -> str: ... - + @classmethod + def eval_json_path(cls, values: Iterable[int | str | types.EllipsisType | slice]) -> str: ... def JSON_QUERY(builder, expr, path) -> None: ... def JSON_VALUE(builder, expr, path, type) -> None: ... def JSON_NONZERO(builder, expr) -> None: ... diff --git a/stubs/psutil/psutil/__init__.pyi b/stubs/psutil/psutil/__init__.pyi index 7012bf7e8233..e3ffae9ab503 100644 --- a/stubs/psutil/psutil/__init__.pyi +++ b/stubs/psutil/psutil/__init__.pyi @@ -237,36 +237,6 @@ class Popen(Process): pipesize: int = -1, process_group: int | None = None, ) -> None: ... - elif sys.version_info >= (3, 10): - def __init__( - self, - args: _CMD, - bufsize: int = -1, - executable: StrOrBytesPath | None = None, - stdin: _FILE | None = None, - stdout: _FILE | None = None, - stderr: _FILE | None = None, - preexec_fn: Callable[[], object] | None = None, - close_fds: bool = True, - shell: bool = False, - cwd: StrOrBytesPath | None = None, - env: _ENV | None = None, - universal_newlines: bool | None = None, - startupinfo: Any | None = None, - creationflags: int = 0, - restore_signals: bool = True, - start_new_session: bool = False, - pass_fds: Collection[int] = (), - *, - text: bool | None = None, - encoding: str | None = None, - errors: str | None = None, - user: str | int | None = None, - group: str | int | None = None, - extra_groups: Iterable[str | int] | None = None, - umask: int = -1, - pipesize: int = -1, - ) -> None: ... else: def __init__( self, @@ -295,6 +265,7 @@ class Popen(Process): group: str | int | None = None, extra_groups: Iterable[str | int] | None = None, umask: int = -1, + pipesize: int = -1, ) -> None: ... def __enter__(self) -> Self: ... diff --git a/stubs/pyflakes/pyflakes/checker.pyi b/stubs/pyflakes/pyflakes/checker.pyi index 0b87aa5a84e6..f167130dbdfb 100644 --- a/stubs/pyflakes/pyflakes/checker.pyi +++ b/stubs/pyflakes/pyflakes/checker.pyi @@ -19,12 +19,7 @@ builtin_vars: Final[list[str]] def parse_format_string( format_string: StrOrLiteralStr, ) -> Iterable[tuple[StrOrLiteralStr, StrOrLiteralStr | None, StrOrLiteralStr | None, StrOrLiteralStr | None]]: ... - -if sys.version_info >= (3, 10): - def getAlternatives(n: ast.If | ast.Try | ast.Match) -> list[ast.AST]: ... - -else: - def getAlternatives(n: ast.If | ast.Try) -> list[ast.AST]: ... +def getAlternatives(n: ast.If | ast.Try | ast.Match) -> list[ast.AST]: ... FOR_TYPES: Final[tuple[type[ast.For], type[ast.AsyncFor]]] MAPPING_KEY_RE: Final[Pattern[str]] @@ -149,29 +144,16 @@ class AnnotationState: def in_annotation(func: _F) -> _F: ... def in_string_annotation(func: _F) -> _F: ... -if sys.version_info >= (3, 10): - _Match: TypeAlias = ast.Match - _MatchCase: TypeAlias = ast.match_case - _MatchValue: TypeAlias = ast.MatchValue - _MatchSingleton: TypeAlias = ast.MatchSingleton - _MatchSequence: TypeAlias = ast.MatchSequence - _MatchStar: TypeAlias = ast.MatchStar - _MatchMapping: TypeAlias = ast.MatchMapping - _MatchClass: TypeAlias = ast.MatchClass - _MatchAs: TypeAlias = ast.MatchAs - _MatchOr: TypeAlias = ast.MatchOr -else: - # The methods using these should never be called on Python < 3.10. - _Match: TypeAlias = Never - _MatchCase: TypeAlias = Never - _MatchValue: TypeAlias = Never - _MatchSingleton: TypeAlias = Never - _MatchSequence: TypeAlias = Never - _MatchStar: TypeAlias = Never - _MatchMapping: TypeAlias = Never - _MatchClass: TypeAlias = Never - _MatchAs: TypeAlias = Never - _MatchOr: TypeAlias = Never +_Match: TypeAlias = ast.Match +_MatchCase: TypeAlias = ast.match_case +_MatchValue: TypeAlias = ast.MatchValue +_MatchSingleton: TypeAlias = ast.MatchSingleton +_MatchSequence: TypeAlias = ast.MatchSequence +_MatchStar: TypeAlias = ast.MatchStar +_MatchMapping: TypeAlias = ast.MatchMapping +_MatchClass: TypeAlias = ast.MatchClass +_MatchAs: TypeAlias = ast.MatchAs +_MatchOr: TypeAlias = ast.MatchOr if sys.version_info >= (3, 12): _TypeVar: TypeAlias = ast.TypeVar diff --git a/stubs/shapely/shapely/predicates.pyi b/stubs/shapely/shapely/predicates.pyi index a9e39dfadead..aa0993f82c39 100644 --- a/stubs/shapely/shapely/predicates.pyi +++ b/stubs/shapely/shapely/predicates.pyi @@ -1,4 +1,3 @@ -import sys from typing import Any, Literal, overload from typing_extensions import TypeAlias, TypeGuard @@ -9,12 +8,8 @@ from ._typing import ArrayLike, ArrayLikeSeq, OptGeoArrayLike, OptGeoArrayLikeSe from .geometry.base import BaseGeometry from .lib import Geometry -if sys.version_info >= (3, 10): - _NPTrue: TypeAlias = np.bool_[Literal[True]] - _NPFalse: TypeAlias = np.bool_[Literal[False]] -else: - _NPTrue: TypeAlias = np.bool_ - _NPFalse: TypeAlias = np.bool_ +_NPTrue: TypeAlias = np.bool_[Literal[True]] +_NPFalse: TypeAlias = np.bool_[Literal[False]] __all__ = [ "contains", From 29fb0c34665666e1b41c33927e1f3d85a00c61aa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 16:33:40 +0000 Subject: [PATCH 2/7] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/Markdown/markdown/util.pyi | 1 - stubs/Pygments/pygments/plugin.pyi | 1 - stubs/networkx/networkx/utils/configs.pyi | 1 - 3 files changed, 3 deletions(-) diff --git a/stubs/Markdown/markdown/util.pyi b/stubs/Markdown/markdown/util.pyi index 3a059c356561..b942839a95f4 100644 --- a/stubs/Markdown/markdown/util.pyi +++ b/stubs/Markdown/markdown/util.pyi @@ -20,7 +20,6 @@ TAG_PLACEHOLDER: Final[str] RTL_BIDI_RANGES: Final[tuple[tuple[str, str], tuple[str, str]]] def get_installed_extensions() -> metadata.EntryPoints: ... - def deprecated(message: str, stacklevel: int = 2): ... @overload def parseBoolValue(value: str) -> bool: ... diff --git a/stubs/Pygments/pygments/plugin.pyi b/stubs/Pygments/pygments/plugin.pyi index 955fce980832..49b49c9d7641 100644 --- a/stubs/Pygments/pygments/plugin.pyi +++ b/stubs/Pygments/pygments/plugin.pyi @@ -14,7 +14,6 @@ STYLE_ENTRY_POINT: Final = "pygments.styles" FILTER_ENTRY_POINT: Final = "pygments.filters" def iter_entry_points(group_name: str) -> EntryPoints: ... - def find_plugin_lexers() -> Generator[type[Lexer]]: ... def find_plugin_formatters() -> Generator[tuple[str, type[Formatter[Incomplete]]]]: ... def find_plugin_styles() -> Generator[tuple[str, type[Style]]]: ... diff --git a/stubs/networkx/networkx/utils/configs.pyi b/stubs/networkx/networkx/utils/configs.pyi index a9c590504a84..46d843940841 100644 --- a/stubs/networkx/networkx/utils/configs.pyi +++ b/stubs/networkx/networkx/utils/configs.pyi @@ -31,7 +31,6 @@ class Config: self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None ) -> None: ... - class NetworkXConfig(Config): backend_priority: list[str] backends: Config From d1e0be8edec9e351311b3f104424d86665969a18 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Fri, 8 May 2026 00:16:03 +0200 Subject: [PATCH 3/7] Inline obsolete type aliases --- stubs/shapely/shapely/predicates.pyi | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/stubs/shapely/shapely/predicates.pyi b/stubs/shapely/shapely/predicates.pyi index 7bf345e441c5..2cc7c933a750 100644 --- a/stubs/shapely/shapely/predicates.pyi +++ b/stubs/shapely/shapely/predicates.pyi @@ -1,4 +1,4 @@ -from typing import Any, Literal, TypeAlias, overload +from typing import Any, Literal, overload import numpy as np from numpy.typing import NDArray @@ -7,9 +7,6 @@ from ._typing import ArrayLike, ArrayLikeSeq, OptGeoArrayLike, OptGeoArrayLikeSe from .geometry.base import BaseGeometry from .lib import Geometry -_NPTrue: TypeAlias = np.bool_[Literal[True]] -_NPFalse: TypeAlias = np.bool_[Literal[False]] - __all__ = [ "contains", "contains_properly", @@ -65,17 +62,17 @@ def is_empty(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_empty(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... @overload -def is_geometry(geometry: Geometry, **kwargs) -> _NPTrue: ... +def is_geometry(geometry: Geometry, **kwargs) -> np.bool_[Literal[True]]: ... @overload -def is_geometry(geometry: None, **kwargs) -> _NPFalse: ... +def is_geometry(geometry: None, **kwargs) -> np.bool_[Literal[False]]: ... @overload def is_geometry(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] @overload def is_geometry(geometry: object, **kwargs) -> TypeGuard[BaseGeometry]: ... @overload -def is_missing(geometry: Geometry, **kwargs) -> _NPFalse: ... +def is_missing(geometry: Geometry, **kwargs) -> np.bool_[Literal[False]]: ... @overload -def is_missing(geometry: None, **kwargs) -> _NPTrue: ... +def is_missing(geometry: None, **kwargs) -> np.bool_[Literal[True]]: ... @overload def is_missing(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] @overload @@ -85,7 +82,7 @@ def is_prepared(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_prepared(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... @overload -def is_valid_input(geometry: Geometry | None, **kwargs) -> _NPTrue: ... +def is_valid_input(geometry: Geometry | None, **kwargs) -> np.bool_[Literal[True]]: ... @overload def is_valid_input(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] @overload From 5d79e7a122199916e306f7eeff46fb5ed0a3676e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 22:18:03 +0000 Subject: [PATCH 4/7] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/shapely/shapely/predicates.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stubs/shapely/shapely/predicates.pyi b/stubs/shapely/shapely/predicates.pyi index 2cc7c933a750..0c5e531b4206 100644 --- a/stubs/shapely/shapely/predicates.pyi +++ b/stubs/shapely/shapely/predicates.pyi @@ -62,7 +62,7 @@ def is_empty(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_empty(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... @overload -def is_geometry(geometry: Geometry, **kwargs) -> np.bool_[Literal[True]]: ... +def is_geometry(geometry: Geometry, **kwargs) -> np.bool_[Literal[True]]: ... @overload def is_geometry(geometry: None, **kwargs) -> np.bool_[Literal[False]]: ... @overload @@ -72,7 +72,7 @@ def is_geometry(geometry: object, **kwargs) -> TypeGuard[BaseGeometry]: ... @overload def is_missing(geometry: Geometry, **kwargs) -> np.bool_[Literal[False]]: ... @overload -def is_missing(geometry: None, **kwargs) -> np.bool_[Literal[True]]: ... +def is_missing(geometry: None, **kwargs) -> np.bool_[Literal[True]]: ... @overload def is_missing(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] @overload @@ -82,7 +82,7 @@ def is_prepared(geometry: Geometry | None, **kwargs) -> np.bool_: ... @overload def is_prepared(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... @overload -def is_valid_input(geometry: Geometry | None, **kwargs) -> np.bool_[Literal[True]]: ... +def is_valid_input(geometry: Geometry | None, **kwargs) -> np.bool_[Literal[True]]: ... @overload def is_valid_input(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] @overload From 9aa3929615e707cf3c4689328e82eb56b33aad42 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Fri, 8 May 2026 00:19:46 +0200 Subject: [PATCH 5/7] Inline obsolete type aliases --- stubs/pyflakes/pyflakes/checker.pyi | 36 ++++++++++------------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/stubs/pyflakes/pyflakes/checker.pyi b/stubs/pyflakes/pyflakes/checker.pyi index 679fbe498e87..50b8edf55370 100644 --- a/stubs/pyflakes/pyflakes/checker.pyi +++ b/stubs/pyflakes/pyflakes/checker.pyi @@ -9,8 +9,7 @@ from typing_extensions import Never from pyflakes.messages import Message -_AnyFunction: TypeAlias = Callable[..., Any] -_F = TypeVar("_F", bound=_AnyFunction) +_F = TypeVar("_F", bound=Callable[..., Any]) _P = ParamSpec("_P") PYPY: Final[bool] @@ -144,17 +143,6 @@ class AnnotationState: def in_annotation(func: _F) -> _F: ... def in_string_annotation(func: _F) -> _F: ... -_Match: TypeAlias = ast.Match -_MatchCase: TypeAlias = ast.match_case -_MatchValue: TypeAlias = ast.MatchValue -_MatchSingleton: TypeAlias = ast.MatchSingleton -_MatchSequence: TypeAlias = ast.MatchSequence -_MatchStar: TypeAlias = ast.MatchStar -_MatchMapping: TypeAlias = ast.MatchMapping -_MatchClass: TypeAlias = ast.MatchClass -_MatchAs: TypeAlias = ast.MatchAs -_MatchOr: TypeAlias = ast.MatchOr - if sys.version_info >= (3, 12): _TypeVar: TypeAlias = ast.TypeVar _ParamSpec: TypeAlias = ast.ParamSpec @@ -196,7 +184,7 @@ class Checker: withDoctest: bool = False, file_tokens: Unused = (), ) -> None: ... - def deferFunction(self, callable: _AnyFunction) -> None: ... + def deferFunction(self, callable: Callable[..., Any]) -> None: ... @property def futuresAllowed(self) -> bool: ... @futuresAllowed.setter @@ -334,16 +322,16 @@ class Checker: def EXCEPTHANDLER(self, node: ast.ExceptHandler) -> None: ... def ANNASSIGN(self, node: ast.AnnAssign) -> None: ... def COMPARE(self, node: ast.Compare) -> None: ... - def MATCH(self, tree: _Match, omit: _OmitType = None) -> None: ... - def MATCH_CASE(self, tree: _MatchCase, omit: _OmitType = None) -> None: ... - def MATCHCLASS(self, tree: _MatchClass, omit: _OmitType = None) -> None: ... - def MATCHOR(self, tree: _MatchOr, omit: _OmitType = None) -> None: ... - def MATCHSEQUENCE(self, tree: _MatchSequence, omit: _OmitType = None) -> None: ... - def MATCHSINGLETON(self, tree: _MatchSingleton, omit: _OmitType = None) -> None: ... - def MATCHVALUE(self, tree: _MatchValue, omit: _OmitType = None) -> None: ... - def MATCHAS(self, node: _MatchAs) -> None: ... - def MATCHMAPPING(self, node: _MatchMapping) -> None: ... - def MATCHSTAR(self, node: _MatchStar) -> None: ... + def MATCH(self, tree: ast.Match, omit: _OmitType = None) -> None: ... + def MATCH_CASE(self, tree: ast.match_case, omit: _OmitType = None) -> None: ... + def MATCHCLASS(self, tree: ast.MatchClass, omit: _OmitType = None) -> None: ... + def MATCHOR(self, tree: ast.MatchOr, omit: _OmitType = None) -> None: ... + def MATCHSEQUENCE(self, tree: ast.MatchSequence, omit: _OmitType = None) -> None: ... + def MATCHSINGLETON(self, tree: ast.MatchSingleton, omit: _OmitType = None) -> None: ... + def MATCHVALUE(self, tree: ast.MatchValue, omit: _OmitType = None) -> None: ... + def MATCHAS(self, node: ast.MatchAs) -> None: ... + def MATCHMAPPING(self, node: ast.MatchMapping) -> None: ... + def MATCHSTAR(self, node: ast.MatchStar) -> None: ... def TYPEVAR(self, node: _TypeVar) -> None: ... def PARAMSPEC(self, node: _ParamSpec) -> None: ... def TYPEVARTUPLE(self, node: _TypeVarTuple) -> None: ... From 56fef264f4c28ffadea42aed7e470103b8ec3766 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 22:22:00 +0000 Subject: [PATCH 6/7] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/pyflakes/pyflakes/checker.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/pyflakes/pyflakes/checker.pyi b/stubs/pyflakes/pyflakes/checker.pyi index 50b8edf55370..bb3f8c09e658 100644 --- a/stubs/pyflakes/pyflakes/checker.pyi +++ b/stubs/pyflakes/pyflakes/checker.pyi @@ -323,7 +323,7 @@ class Checker: def ANNASSIGN(self, node: ast.AnnAssign) -> None: ... def COMPARE(self, node: ast.Compare) -> None: ... def MATCH(self, tree: ast.Match, omit: _OmitType = None) -> None: ... - def MATCH_CASE(self, tree: ast.match_case, omit: _OmitType = None) -> None: ... + def MATCH_CASE(self, tree: ast.match_case, omit: _OmitType = None) -> None: ... def MATCHCLASS(self, tree: ast.MatchClass, omit: _OmitType = None) -> None: ... def MATCHOR(self, tree: ast.MatchOr, omit: _OmitType = None) -> None: ... def MATCHSEQUENCE(self, tree: ast.MatchSequence, omit: _OmitType = None) -> None: ... From 511b2b96b729c7846a6c0e550a00878d61f0d796 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Fri, 8 May 2026 00:26:10 +0200 Subject: [PATCH 7/7] Fix missing import --- stubs/shapely/shapely/predicates.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/shapely/shapely/predicates.pyi b/stubs/shapely/shapely/predicates.pyi index 0c5e531b4206..2145c60b54a9 100644 --- a/stubs/shapely/shapely/predicates.pyi +++ b/stubs/shapely/shapely/predicates.pyi @@ -1,4 +1,4 @@ -from typing import Any, Literal, overload +from typing import Any, Literal, TypeGuard, overload import numpy as np from numpy.typing import NDArray