diff --git a/pyproject.toml b/pyproject.toml index f61829f0..b74791ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ hygiene = ["ruff ==0.11.*"] tests = [ # Tools used for testing "docopt-ng", - "mypy ==1.13.*", + "mypy ==1.15.*", "pyright", # Typed libraries and stubs @@ -156,7 +156,6 @@ disable_error_code = [ # Since this project is specific to Pylance, just ignore them "assert-type", # TODO - "valid-type", # 967 errors in 115 files "override", # 790 errors in 220 files "assignment", # 773 errors in 172 files "misc", # 692 errors in 132 files diff --git a/stubs/matplotlib/_typing.pyi b/stubs/matplotlib/_typing.pyi index 48eb475c..ef2156f0 100644 --- a/stubs/matplotlib/_typing.pyi +++ b/stubs/matplotlib/_typing.pyi @@ -1,14 +1,12 @@ -import decimal import io import typing_extensions +from decimal import Decimal as Decimal -import numpy.typing import pandas as pd +from numpy.typing import ArrayLike as ArrayLike -Decimal = decimal.Decimal PythonScalar: typing_extensions.TypeAlias = str | int | float | bool -ArrayLike = numpy.typing.ArrayLike FileLike = io.IOBase PathLike = str diff --git a/stubs/matplotlib/backend_bases.pyi b/stubs/matplotlib/backend_bases.pyi index 41ba8568..b64355f1 100644 --- a/stubs/matplotlib/backend_bases.pyi +++ b/stubs/matplotlib/backend_bases.pyi @@ -310,7 +310,7 @@ class FigureCanvasBase: def mpl_connect(self, s: str, func: Callable) -> int: ... def mpl_disconnect(self, cid: int): ... _timer_cls = TimerBase - def new_timer(self, interval: int = ..., callbacks: list[tuple[Callable, tuple, dict]] = ...) -> _timer_cls: ... + def new_timer(self, interval: int = ..., callbacks: list[tuple[Callable, tuple, dict]] = ...) -> TimerBase: ... def flush_events(self) -> None: ... def start_event_loop(self, timeout: int = ...) -> None: ... def stop_event_loop(self) -> None: ... diff --git a/stubs/sklearn/_typing.pyi b/stubs/sklearn/_typing.pyi index 50b06856..33a33acb 100644 --- a/stubs/sklearn/_typing.pyi +++ b/stubs/sklearn/_typing.pyi @@ -2,21 +2,19 @@ # to simplify the stubs generated by docs2stub. They are not # intended to be used directly by other users. -import decimal import io import typing_extensions +from decimal import Decimal as Decimal import numpy as np -import numpy.typing import pandas as pd +from numpy.typing import ArrayLike as ArrayLike from scipy.sparse import spmatrix from .base import BaseEstimator, ClassifierMixin, RegressorMixin -Decimal = decimal.Decimal PythonScalar: typing_extensions.TypeAlias = str | int | float | bool -ArrayLike = numpy.typing.ArrayLike MatrixLike: typing_extensions.TypeAlias = np.ndarray | pd.DataFrame | spmatrix FileLike = io.IOBase PathLike = str diff --git a/stubs/sympy-stubs/combinatorics/permutations.pyi b/stubs/sympy-stubs/combinatorics/permutations.pyi index 28a88245..e9673c79 100644 --- a/stubs/sympy-stubs/combinatorics/permutations.pyi +++ b/stubs/sympy-stubs/combinatorics/permutations.pyi @@ -1,4 +1,4 @@ -from collections.abc import Generator, Iterator +from collections.abc import Iterator from typing import Any, Literal from typing_extensions import Self @@ -7,11 +7,13 @@ from sympy.core.basic import Atom from sympy.core.expr import Expr from sympy.core.numbers import Integer +_List = list + class Cycle(dict): def __missing__(self, arg) -> int: ... def __iter__(self) -> Iterator[Any]: ... def __call__(self, *other) -> Cycle: ... - def list(self, size=...) -> list[Any]: ... + def list(self, size=...) -> _List[Any]: ... def __init__(self, *args) -> None: ... @property def size(self) -> Literal[0]: ... @@ -29,12 +31,12 @@ class Permutation(Atom): def array_form(self): ... def list(self, size=...): ... @property - def cyclic_form(self) -> list[Any]: ... + def cyclic_form(self) -> _List[Any]: ... @property - def full_cyclic_form(self) -> list[Any]: ... + def full_cyclic_form(self) -> _List[Any]: ... @property def size(self) -> None: ... - def support(self) -> list[int]: ... + def support(self) -> _List[int]: ... def __add__(self, other) -> Self: ... def __sub__(self, other) -> Self: ... @staticmethod @@ -46,15 +48,15 @@ class Permutation(Atom): def __mul__(self, other) -> Coset | Self: ... def commutes_with(self, other) -> bool: ... def __pow__(self, n) -> Self: ... - def __rxor__(self, i) -> list[Any] | Coset | Permutation: ... + def __rxor__(self, i) -> _List[Any] | Coset | Permutation: ... def __xor__(self, h) -> Self: ... - def transpositions(self) -> list[Any]: ... + def transpositions(self) -> _List[Any]: ... @classmethod def from_sequence(cls, i, key=...) -> Permutation: ... def __invert__(self) -> Self: ... def __iter__(self) -> Iterator[Any]: ... def __repr__(self): ... - def __call__(self, *i) -> list[Any] | Coset | Self: ... + def __call__(self, *i) -> _List[Any] | Coset | Self: ... def atoms(self) -> set[Any]: ... def apply(self, i) -> Integer | AppliedPermutation: ... def next_lex(self) -> Self | None: ... @@ -78,8 +80,8 @@ class Permutation(Atom): def is_identity(self) -> bool: ... @property def is_Identity(self) -> bool: ... - def ascents(self) -> list[int]: ... - def descents(self) -> list[int]: ... + def ascents(self) -> _List[int]: ... + def descents(self) -> _List[int]: ... def max(self) -> Literal[0]: ... def min(self) -> int: ... def inversions(self) -> int: ... @@ -92,8 +94,8 @@ class Permutation(Atom): @property def cycles(self) -> int: ... def index(self) -> int: ... - def runs(self) -> list[Any]: ... - def inversion_vector(self) -> list[int]: ... + def runs(self) -> _List[Any]: ... + def inversion_vector(self) -> _List[int]: ... def rank_trotterjohnson(self) -> int: ... @classmethod def unrank_trotterjohnson(cls, size, rank) -> Self: ... diff --git a/stubs/sympy-stubs/plotting/pygletplot/__init__.pyi b/stubs/sympy-stubs/plotting/pygletplot/__init__.pyi index 37206008..a3049c04 100644 --- a/stubs/sympy-stubs/plotting/pygletplot/__init__.pyi +++ b/stubs/sympy-stubs/plotting/pygletplot/__init__.pyi @@ -2,4 +2,4 @@ from sympy.plotting.pygletplot.plot import PygletPlot as Plot from sympy.utilities.decorator import doctest_depends_on @doctest_depends_on(modules=("pyglet",)) -def PygletPlot(*args, **kwargs) -> PygletPlot: ... +def PygletPlot(*args, **kwargs) -> Plot: ... diff --git a/stubs/sympy-stubs/polys/domains/gmpyintegerring.pyi b/stubs/sympy-stubs/polys/domains/gmpyintegerring.pyi index 937d8bde..783582e4 100644 --- a/stubs/sympy-stubs/polys/domains/gmpyintegerring.pyi +++ b/stubs/sympy-stubs/polys/domains/gmpyintegerring.pyi @@ -1,15 +1,14 @@ from typing import Any from sympy.core.numbers import Integer -from sympy.polys.domains.groundtypes import GMPYInteger, _GMPYInteger +from sympy.polys.domains.groundtypes import _GMPYInteger from sympy.polys.domains.integerring import IntegerRing -from sympy.utilities import public class GMPYIntegerRing(IntegerRing): - dtype = GMPYInteger - zero = dtype(0) - one = dtype(1) - tp: type[dtype] + dtype = _GMPYInteger + zero: _GMPYInteger + one: _GMPYInteger + tp: type[_GMPYInteger] alias = ... def __init__(self) -> None: ... def to_sympy(self, a) -> Integer: ... diff --git a/stubs/sympy-stubs/polys/domains/gmpyrationalfield.pyi b/stubs/sympy-stubs/polys/domains/gmpyrationalfield.pyi index 45fce790..06382d2d 100644 --- a/stubs/sympy-stubs/polys/domains/gmpyrationalfield.pyi +++ b/stubs/sympy-stubs/polys/domains/gmpyrationalfield.pyi @@ -1,15 +1,14 @@ from typing import Any from sympy.core.numbers import Rational -from sympy.polys.domains.groundtypes import GMPYRational, _GMPYRational +from sympy.polys.domains.groundtypes import _GMPYRational from sympy.polys.domains.rationalfield import RationalField -from sympy.utilities import public class GMPYRationalField(RationalField): - dtype = GMPYRational - zero = dtype(0) - one = dtype(1) - tp: type[dtype] + dtype = _GMPYRational + zero: _GMPYRational + one: _GMPYRational + tp: type[_GMPYRational] alias = ... def __init__(self) -> None: ... def get_ring(self) -> Any: ... @@ -23,8 +22,8 @@ class GMPYRationalField(RationalField): def from_RealField(K1, a, K0) -> _GMPYRational: ... def exquo(self, a, b): ... def quo(self, a, b): ... - def rem(self, a, b) -> dtype: ... - def div(self, a, b) -> tuple[Any, dtype]: ... + def rem(self, a, b) -> _GMPYRational: ... + def div(self, a, b) -> tuple[Any, _GMPYRational]: ... def numer(self, a): ... def denom(self, a): ... def factorial(self, a) -> _GMPYRational: ... diff --git a/stubs/sympy-stubs/stats/joint_rv.pyi b/stubs/sympy-stubs/stats/joint_rv.pyi index f8b0fa7f..c6053a15 100644 --- a/stubs/sympy-stubs/stats/joint_rv.pyi +++ b/stubs/sympy-stubs/stats/joint_rv.pyi @@ -1,5 +1,5 @@ from typing import Any -from typing_extensions import Self +from typing_extensions import Self, TypeAlias from sympy import Basic, Equality, FiniteSet, Indexed, Integral, Ne, ProductSet, Sum from sympy.core.expr import Expr @@ -10,6 +10,8 @@ from sympy.stats.drv import ProductDiscreteDomain, SingleDiscretePSpace from sympy.stats.frv import ProductFiniteDomain from sympy.stats.rv import Distribution, NamedArgsMixin, ProductDomain, ProductPSpace, RandomSymbol, SingleDomain +_Set = set + class JointPSpace(ProductPSpace): def __new__(cls, sym, dist) -> SingleContinuousPSpace | SingleDiscretePSpace | Self: ... @property @@ -65,7 +67,7 @@ class MarginalDistribution(Distribution): @property def set(self) -> FiniteSet | ProductSet: ... @property - def symbols(self) -> set[Any]: ... + def symbols(self) -> _Set[Any]: ... def pdf(self, *x) -> Basic: ... def compute_pdf(self, expr, rvs) -> Equality | Relational | Ne | Integral | Sum: ... def marginalise_out(self, expr, rv) -> Equality | Relational | Ne | Integral | Sum: ...