Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 2 additions & 8 deletions stubs/Markdown/markdown/util.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -19,13 +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
def parseBoolValue(value: str) -> bool: ...
Expand Down
12 changes: 2 additions & 10 deletions stubs/Pygments/pygments/plugin.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,15 +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]]]]: ...
def find_plugin_styles() -> Generator[tuple[str, type[Style]]]: ...
Expand Down
6 changes: 1 addition & 5 deletions stubs/click-web/click_web/resources/input_fields.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from typing import Any, ClassVar, Final

import click
Expand Down Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions stubs/fpdf2/fpdf/drawing.pyi
Original file line number Diff line number Diff line change
@@ -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, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import Self

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

Expand Down
7 changes: 1 addition & 6 deletions stubs/mock/mock/backports.pyi
Original file line number Diff line number Diff line change
@@ -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
15 changes: 4 additions & 11 deletions stubs/networkx/networkx/_typing.pyi
Original file line number Diff line number Diff line change
@@ -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, TypeAlias, type_check_only
from typing_extensions import TypeVar
Expand All @@ -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
78 changes: 24 additions & 54 deletions stubs/networkx/networkx/utils/configs.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from _typeshed import Incomplete
from collections.abc import Callable, ItemsView, Iterable, Iterator, KeysView, ValuesView
from dataclasses import dataclass
Expand All @@ -7,59 +6,30 @@ 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: ...

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: ...
@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: ...

class NetworkXConfig(Config):
backend_priority: list[str]
Expand Down
6 changes: 0 additions & 6 deletions stubs/networkx/networkx/utils/misc.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import random
import sys
from types import ModuleType
from typing import TypeAlias
from typing_extensions import Self

import numpy
from networkx.classes.graph import Graph, _Node
Expand Down Expand Up @@ -39,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:
Expand Down
10 changes: 2 additions & 8 deletions stubs/pony/pony/orm/sqlbuilding.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
import types
from _typeshed import Incomplete
from collections.abc import Iterable
Expand Down Expand Up @@ -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: ...
Expand Down
31 changes: 1 addition & 30 deletions stubs/psutil/psutil/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: ...
Expand Down
56 changes: 13 additions & 43 deletions stubs/pyflakes/pyflakes/checker.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -19,12 +18,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]]
Expand Down Expand Up @@ -149,30 +143,6 @@ 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

if sys.version_info >= (3, 12):
_TypeVar: TypeAlias = ast.TypeVar
_ParamSpec: TypeAlias = ast.ParamSpec
Expand Down Expand Up @@ -214,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
Expand Down Expand Up @@ -352,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: ...
Expand Down
Loading
Loading