Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -156,6 +156,5 @@ disable_error_code = [
"override", # 790 errors in 220 files
"assignment", # 773 errors in 172 files
"misc", # 692 errors in 132 files
"attr-defined", # 202 errors in 75 files
"assert-type", # 6 errors in 1 file
]
3 changes: 1 addition & 2 deletions stubs/matplotlib/backend_tools.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class ToolBase:
def figure(self) -> Figure: ...
@figure.setter
def figure(self, figure: Figure) -> None: ...

set_figure = figure.fset
def set_figure(self, figure: Figure) -> None: ...
def trigger(self, sender: object, event: Event, data: object = ...) -> None: ...
def destroy(self) -> None: ...

Expand Down
18 changes: 9 additions & 9 deletions stubs/matplotlib/transforms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,23 @@ class Bbox(BboxBase):
updatex: bool = True,
updatey: bool = True,
): ...
@BboxBase.x0.setter
@BboxBase.x0.setter # type: ignore[attr-defined] # python/mypy#5936
def x0(self, val: float): ...
@BboxBase.y0.setter
@BboxBase.y0.setter # type: ignore[attr-defined] # python/mypy#5936
def y0(self, val: float): ...
@BboxBase.x1.setter
@BboxBase.x1.setter # type: ignore[attr-defined] # python/mypy#5936
def x1(self, val: float): ...
@BboxBase.y1.setter
@BboxBase.y1.setter # type: ignore[attr-defined] # python/mypy#5936
def y1(self, val: float): ...
@BboxBase.p0.setter
@BboxBase.p0.setter # type: ignore[attr-defined] # python/mypy#5936
def p0(self, val: float): ...
@BboxBase.p1.setter
@BboxBase.p1.setter # type: ignore[attr-defined] # python/mypy#5936
def p1(self, val: float): ...
@BboxBase.intervalx.setter
@BboxBase.intervalx.setter # type: ignore[attr-defined] # python/mypy#5936
def intervalx(self, interval): ...
@BboxBase.intervaly.setter
@BboxBase.intervaly.setter # type: ignore[attr-defined] # python/mypy#5936
def intervaly(self, interval): ...
@BboxBase.bounds.setter
@BboxBase.bounds.setter # type: ignore[attr-defined] # python/mypy#5936
def bounds(self, bounds): ...
@property
def minpos(self) -> float: ...
Expand Down
7 changes: 1 addition & 6 deletions stubs/sklearn/linear_model/_base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ from numpy import ndarray
from numpy.random.mtrand import RandomState

from .._typing import ArrayLike, Int, MatrixLike
from ..base import BaseEstimator, ClassifierMixin, MultiOutputMixin, RegressorMixin
from ..base import BaseEstimator as BaseEstimator, ClassifierMixin, MultiOutputMixin, RegressorMixin
from ..utils._seq_dataset import ArrayDataset64, CSRDataset64
from ._stochastic_gradient import SGDClassifier

# TODO: bayesian_ridge_regression and bayesian_regression_ard
# should be squashed into its respective objects.

SPARSE_INTERCEPT_DECAY: float = ...

def make_dataset(
Expand All @@ -27,8 +24,6 @@ class LinearModel(BaseEstimator, metaclass=ABCMeta):
def fit(self, X, y): ...
def predict(self, X: MatrixLike) -> ndarray: ...

# XXX Should this derive from LinearModel? It should be a mixin, not an ABC.
# Maybe the n_features checking can be moved to LinearModel.
class LinearClassifierMixin(ClassifierMixin):
def decision_function(self, X: MatrixLike | ArrayLike) -> ndarray: ...
def predict(self, X: MatrixLike | ArrayLike) -> ndarray: ...
Expand Down
86 changes: 86 additions & 0 deletions stubs/sklearn/utils/_metadata_requests.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
from typing import Final, NamedTuple

SIMPLE_METHODS = ...
COMPOSITE_METHODS = ...
METHODS = ...

def _routing_enabled(): ...
def _raise_for_params(params, owner, method) -> None: ...
def _raise_for_unsupported_routing(obj, method, **kwargs) -> None: ...

class _RoutingNotSupportedMixin:
def get_metadata_routing(self) -> None: ...

UNUSED: Final = "$UNUSED$"
WARN: Final = "$WARN$"
UNCHANGED: Final = "$UNCHANGED$"
VALID_REQUEST_VALUES = ...

def request_is_alias(item): ...
def request_is_valid(item): ...

class MethodMetadataRequest:
owner = ...
method = ...
def __init__(self, owner, method, requests=None) -> None: ...
@property
def requests(self): ...
def add_request(self, *, param, alias): ...

class MetadataRequest:
owner = ...
def __init__(self, owner) -> None: ...
def consumes(self, method, params): ...
def __getattr__(self, name): ...

class RouterMappingPair(NamedTuple):
mapping = ...
router = ...

class MethodPair(NamedTuple):
caller = ...
callee = ...

class MethodMapping:
def __init__(self) -> None: ...
def __iter__(self): ...
def add(self, *, caller, callee): ...

class MetadataRouter:
owner = ...
def __init__(self, owner) -> None: ...
def add_self_request(self, obj): ...
def add(self, *, method_mapping, **objs): ...
def consumes(self, method, params): ...
def route_params(self, *, caller, params): ...
def validate_metadata(self, *, method, params) -> None: ...
def __iter__(self): ...

def get_routing_for_object(obj=None): ...

REQUESTER_DOC: Final[str]
REQUESTER_DOC_PARAM: Final[str]
REQUESTER_DOC_RETURN: Final[str]

class RequestMethod:
name = ...
keys = ...
validate_keys = ...
def __init__(self, name, keys, validate_keys: bool = True) -> None: ...
def __get__(self, instance, owner): ...

class _MetadataRequester:
def set_fit_request(self, **kwargs): ...
def set_partial_fit_request(self, **kwargs): ...
def set_predict_request(self, **kwargs): ...
def set_predict_proba_request(self, **kwargs): ...
def set_predict_log_proba_request(self, **kwargs): ...
def set_decision_function_request(self, **kwargs): ...
def set_score_request(self, **kwargs): ...
def set_split_request(self, **kwargs): ...
def set_transform_request(self, **kwargs): ...
def set_inverse_transform_request(self, **kwargs): ...
def __init_subclass__(cls, **kwargs): ...
def get_metadata_routing(self): ...

def process_routing(_obj, _method, /, **kwargs): ...
15 changes: 15 additions & 0 deletions stubs/sklearn/utils/metadata_routing.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from ._metadata_requests import (
UNCHANGED as UNCHANGED,
UNUSED as UNUSED,
WARN as WARN,
MetadataRequest as MetadataRequest,
MetadataRouter as MetadataRouter,
MethodMapping as MethodMapping,
_MetadataRequester as _MetadataRequester,
_raise_for_params as _raise_for_params,
_raise_for_unsupported_routing as _raise_for_unsupported_routing,
_routing_enabled as _routing_enabled,
_RoutingNotSupportedMixin as _RoutingNotSupportedMixin,
get_routing_for_object as get_routing_for_object,
process_routing as process_routing,
)
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/assumptions/sathandlers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ClassFactRegistry:
def __getitem__(self, key) -> tuple[frozenset[Any], frozenset[Any]]: ...
def __call__(self, expr) -> set[Any]: ...

class_fact_registry = ...
class_fact_registry: ClassFactRegistry
x = ...

@class_fact_registry.multiregister(Abs)
Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/core/expr.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from typing import Any, Literal
from typing_extensions import Self

from sympy import Derivative, Equality, Integer, Mul, Order, Pow
from sympy.core.basic import Atom, Basic
from sympy.core.basic import Atom as Atom, Basic
from sympy.core.cache import cacheit
from sympy.core.decorators import call_highest_priority, sympify_method_args, sympify_return
from sympy.core.evalf import EvalfMixin
Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/core/numbers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from typing_extensions import Self

from sympy.core.basic import Basic
from sympy.core.cache import cacheit
from sympy.core.decorators import _sympifyit
from sympy.core.decorators import _sympifyit as _sympifyit
from sympy.core.expr import AtomicExpr, Expr
from sympy.core.mul import Mul
from sympy.core.singleton import Singleton
Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/core/relational.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from typing_extensions import Self

from sympy.core.basic import Basic
from sympy.core.evalf import EvalfMixin
from sympy.logic.boolalg import Boolean
from sympy.logic.boolalg import Boolean as Boolean

__all__ = (
"Rel",
Expand Down
1 change: 0 additions & 1 deletion stubs/sympy-stubs/integrals/manualintegrate.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ from sympy.core.expr import Expr
from sympy.core.function import Derivative, UndefinedFunction
from sympy.core.relational import Boolean
from sympy.core.symbol import Symbol, Wild
from sympy.functions.elementary.exponential import exp
from sympy.functions.elementary.piecewise import Piecewise
from sympy.tensor.array.array_derivatives import ArrayDerivative

Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/plotting/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from sympy.plotting import PlotGrid
from sympy.plotting.plot import (
PlotGrid,
plot,
plot3d,
plot3d_parametric_line,
Expand Down
29 changes: 22 additions & 7 deletions stubs/sympy-stubs/polys/domains/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sympy.external.gmpy import GROUND_TYPES
from sympy.external.gmpy import GROUND_TYPES as GROUND_TYPES
from sympy.polys.domains.algebraicfield import AlgebraicField
from sympy.polys.domains.complexfield import CC, ComplexField
from sympy.polys.domains.domain import Domain
Expand Down Expand Up @@ -41,10 +41,25 @@ __all__ = [
"CC",
"EX",
"EXRAW",
"PythonFiniteField",
"GMPYFiniteField",
"PythonIntegerRing",
"GMPYIntegerRing",
"PythonRational",
"GMPYRationalField",
"FF_python",
"FF_gmpy",
"ZZ_python",
"ZZ_gmpy",
"QQ_python",
"QQ_gmpy",
]
FF_python = ...
FF_gmpy = ...
ZZ_python = ...
ZZ_gmpy = ...
QQ_python = ...
QQ_gmpy = ...

FF_python = PythonFiniteField
FF_gmpy = GMPYFiniteField

ZZ_python = PythonIntegerRing
ZZ_gmpy = GMPYIntegerRing

QQ_python = PythonRationalField
QQ_gmpy = GMPYRationalField
5 changes: 3 additions & 2 deletions stubs/sympy-stubs/sets/handlers/add.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from sympy.core import Basic, Expr
from sympy.core.numbers import Infinity, NegativeInfinity
from sympy.multipledispatch import Dispatcher
from sympy.sets import Interval
from sympy.sets.sets import FiniteSet

_set_add = ...
_set_sub = ...
_set_add: Dispatcher
_set_sub: Dispatcher

@_set_add.register(Basic, Basic)
def _(x, y) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/sets/handlers/functions.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from sympy.core.basic import Basic
from sympy.core.function import FunctionClass, Lambda
from sympy.multipledispatch import Dispatcher
from sympy.sets import FiniteSet, Intersection, Interval, Range, Union
from sympy.sets.fancysets import ImageSet, Integers, Naturals, Reals
from sympy.sets.sets import Complement, EmptySet, Set

FunctionUnion = ...
_set_function = ...
_set_function: Dispatcher

@_set_function.register(FunctionClass, Set)
def _(f, x) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/sets/handlers/intersection.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from sympy.multipledispatch import Dispatcher
from sympy.sets.conditionset import ConditionSet
from sympy.sets.fancysets import (
CartesianComplexRegion,
Expand All @@ -12,7 +13,7 @@ from sympy.sets.fancysets import (
)
from sympy.sets.sets import Complement, EmptySet, FiniteSet, Intersection, Interval, ProductSet, Set, Union, UniversalSet

intersection_sets = ...
intersection_sets: Dispatcher

@intersection_sets.register(ConditionSet, ConditionSet)
def _(a, b) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/sets/handlers/issubset.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Literal

from sympy.multipledispatch import Dispatcher
from sympy.sets.fancysets import Complexes, Range, Rationals, Reals
from sympy.sets.sets import FiniteSet, Interval, ProductSet, Set, Union

_inf_sets = ...
is_subset_sets = ...
is_subset_sets: Dispatcher

@is_subset_sets.register(Set, Set)
def _(a, b) -> None: ...
Expand Down
5 changes: 3 additions & 2 deletions stubs/sympy-stubs/sets/handlers/mul.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from typing import Any

from sympy.core import Basic, Expr
from sympy.multipledispatch import Dispatcher
from sympy.sets.fancysets import ImageSet
from sympy.sets.sets import FiniteSet, Interval, Set, Union

_set_mul = ...
_set_div = ...
_set_mul: Dispatcher
_set_div: Dispatcher

@_set_mul.register(Basic, Basic)
def _(x, y) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/sets/handlers/power.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from sympy.core import Basic, Expr
from sympy.core.numbers import Infinity, Integer, NegativeInfinity, Zero
from sympy.multipledispatch import Dispatcher
from sympy.sets.fancysets import ImageSet
from sympy.sets.sets import FiniteSet, Interval, Set, Union

_set_pow = ...
_set_pow: Dispatcher

@_set_pow.register(Basic, Basic)
def _(x, y) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/sets/handlers/union.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Any

from sympy.multipledispatch import Dispatcher
from sympy.sets.fancysets import (
CartesianComplexRegion,
ComplexRegion,
Expand All @@ -12,7 +13,7 @@ from sympy.sets.fancysets import (
)
from sympy.sets.sets import EmptySet, FiniteSet, Interval, ProductSet, Set, UniversalSet

union_sets = ...
union_sets: Dispatcher

@union_sets.register(Naturals0, Naturals)
def _(a, b): ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/stats/joint_rv.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from sympy.core.relational import Relational
from sympy.stats.crv import ProductContinuousDomain, SingleContinuousPSpace
from sympy.stats.drv import ProductDiscreteDomain, SingleDiscretePSpace
from sympy.stats.frv import ProductFiniteDomain
from sympy.stats.rv import Distribution, NamedArgsMixin, ProductDomain, ProductPSpace, RandomSymbol, SingleDomain
from sympy.stats.rv import Distribution, NamedArgsMixin, ProductDomain, ProductPSpace as ProductPSpace, RandomSymbol, SingleDomain

class JointPSpace(ProductPSpace):
def __new__(cls, sym, dist) -> SingleContinuousPSpace | SingleDiscretePSpace | Self: ...
Expand Down
5 changes: 3 additions & 2 deletions stubs/sympy-stubs/utilities/iterables.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from collections import defaultdict
from collections.abc import Generator, Iterator
from itertools import chain, combinations, combinations_with_replacement, permutations, product, product as cartes # noqa: F401
from itertools import chain, combinations, combinations_with_replacement, permutations, product
from typing import Any, Literal, NoReturn
from typing_extensions import Never

from sympy import Basic, Symbol
from sympy.utilities.decorator import deprecated

cartes = product

def is_palindromic(s, i=..., j=...) -> bool: ...
def flatten(iterable, levels=..., cls=...) -> list[Any]: ...
Expand Down
Loading
Loading