diff --git a/pyproject.toml b/pyproject.toml index 9de6847f..c483eb68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,13 +55,9 @@ ignore = [ "F401", # TODO: Investigate and fix or configure - "PYI001", - "PYI002", - "PYI017", "PYI024", "PYI048", "PYI051", # Request for autofix: https://github.com/astral-sh/ruff/issues/14185 - "PYI052", ] [tool.ruff.lint.per-file-ignores] "*.pyi" = [ diff --git a/stubs/sklearn/model_selection/_search.pyi b/stubs/sklearn/model_selection/_search.pyi index bd01bc25..79e19e97 100644 --- a/stubs/sklearn/model_selection/_search.pyi +++ b/stubs/sklearn/model_selection/_search.pyi @@ -29,7 +29,7 @@ from ..utils.validation import check_is_fitted as check_is_fitted, indexable as from . import BaseCrossValidator from ._split import check_cv as check_cv -BaseEstimatorT = TypeVar("BaseEstimatorT", bound=BaseEstimator, default=BaseEstimator, covariant=True) +_BaseEstimatorT = TypeVar("_BaseEstimatorT", bound=BaseEstimator, default=BaseEstimator, covariant=True) __all__ = ["GridSearchCV", "ParameterGrid", "ParameterSampler", "RandomizedSearchCV"] @@ -84,7 +84,7 @@ class BaseSearchCV(MetaEstimatorMixin, BaseEstimator, metaclass=ABCMeta): **fit_params, ) -> Self: ... -class GridSearchCV(BaseSearchCV, Generic[BaseEstimatorT]): +class GridSearchCV(BaseSearchCV, Generic[_BaseEstimatorT]): feature_names_in_: ndarray = ... n_features_in_: int = ... classes_: ndarray = ... @@ -95,14 +95,14 @@ class GridSearchCV(BaseSearchCV, Generic[BaseEstimatorT]): best_index_: int = ... best_params_: dict = ... best_score_: float = ... - best_estimator_: BaseEstimatorT = ... + best_estimator_: _BaseEstimatorT = ... cv_results_: dict[str, ndarray] = ... _required_parameters: ClassVar[list] = ... def __init__( self, - estimator: BaseEstimatorT, + estimator: _BaseEstimatorT, param_grid: Mapping | Sequence[dict], *, scoring: ArrayLike | None | tuple | Callable | Mapping | str = None, diff --git a/stubs/sympy-stubs/codegen/ast.pyi b/stubs/sympy-stubs/codegen/ast.pyi index bb5e593b..5232064a 100644 --- a/stubs/sympy-stubs/codegen/ast.pyi +++ b/stubs/sympy-stubs/codegen/ast.pyi @@ -147,7 +147,9 @@ class FloatBaseType(Type): class FloatType(FloatBaseType): __slots__ = ... _fields = ... - _construct_nexp = _construct_nmant = _construct_nbits = Integer + _construct_nexp = Integer + _construct_nmant = Integer + _construct_nbits = Integer @property def max_exponent(self) -> Expr: ... @property diff --git a/stubs/sympy-stubs/matrices/dense.pyi b/stubs/sympy-stubs/matrices/dense.pyi index 5162e0d5..f968325c 100644 --- a/stubs/sympy-stubs/matrices/dense.pyi +++ b/stubs/sympy-stubs/matrices/dense.pyi @@ -21,7 +21,8 @@ class DenseMatrix(RepMatrix): class MutableDenseMatrix(DenseMatrix, MutableRepMatrix): def simplify(self, **kwargs) -> None: ... -Matrix = MutableMatrix = MutableDenseMatrix +Matrix = MutableDenseMatrix +MutableMatrix = MutableDenseMatrix def list2numpy(l, dtype=...) -> NDArray[Any, Any]: ... def matrix2numpy(m, dtype=...) -> NDArray[Any, Any]: ... diff --git a/stubs/sympy-stubs/polys/domains/simpledomain.pyi b/stubs/sympy-stubs/polys/domains/simpledomain.pyi index 0827432f..649dba2e 100644 --- a/stubs/sympy-stubs/polys/domains/simpledomain.pyi +++ b/stubs/sympy-stubs/polys/domains/simpledomain.pyi @@ -3,5 +3,5 @@ from typing_extensions import Self from sympy.polys.domains.domain import Domain class SimpleDomain(Domain): - is_Simple = True + is_Simple: bool = True def inject(self, *gens) -> Self: ... diff --git a/stubs/sympy-stubs/polys/matrices/dense.pyi b/stubs/sympy-stubs/polys/matrices/dense.pyi index 469c002d..d737ca12 100644 --- a/stubs/sympy-stubs/polys/matrices/dense.pyi +++ b/stubs/sympy-stubs/polys/matrices/dense.pyi @@ -3,8 +3,8 @@ from typing import Any, TypeVar from sympy.polys.matrices._typing import RingElement -T = TypeVar("T") -R = TypeVar("R", bound=RingElement) +T = TypeVar("T") # noqa: PYI001 # Exists at runtime +R = TypeVar("R", bound=RingElement) # noqa: PYI001 # Exists at runtime def ddm_transpose(matrix: Sequence[Sequence[T]]) -> list[list[T]]: ... def ddm_iadd(a: list[list[R]], b: Sequence[Sequence[R]]) -> None: ... diff --git a/stubs/sympy-stubs/polys/polymatrix.pyi b/stubs/sympy-stubs/polys/polymatrix.pyi index d1f262e1..a377e0b2 100644 --- a/stubs/sympy-stubs/polys/polymatrix.pyi +++ b/stubs/sympy-stubs/polys/polymatrix.pyi @@ -39,4 +39,5 @@ class MutablePolyDenseMatrix: def nullspace(self) -> list[Self]: ... def rank(self): ... -PolyMatrix = MutablePolyMatrix = MutablePolyDenseMatrix +PolyMatrix = MutablePolyDenseMatrix +MutablePolyMatrix = MutablePolyDenseMatrix diff --git a/tests/run_tests.py b/tests/run_tests.py index 2695f798..e82b4357 100644 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -14,14 +14,14 @@ def install_requirements(test_folder: Path): def run_pyright(): print("\nRunning Pyright...") # https://github.com/RobertCraigie/pyright-python#keeping-pyright-and-pylance-in-sync - del os.environ["PYRIGHT_PYTHON_FORCE_VERSION"] + os.environ.pop("PYRIGHT_PYTHON_FORCE_VERSION", None) os.environ["PYRIGHT_PYTHON_PYLANCE_VERSION"] = "latest-prerelease" return subprocess.run((sys.executable, "-m", "pyright")) def run_mypy(): print("\nRunning mypy...") - return subprocess.run((sys.executable, "-m", "mypy")) + return subprocess.run((sys.executable, "-m", "mypy", ".")) def main():