Skip to content

Commit 62f5b8c

Browse files
authored
Small fixes to re-enable a few PYI rules (#359)
1 parent 1fb1225 commit 62f5b8c

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,9 @@ ignore = [
5555
"F401",
5656

5757
# TODO: Investigate and fix or configure
58-
"PYI001",
59-
"PYI002",
60-
"PYI017",
6158
"PYI024",
6259
"PYI048",
6360
"PYI051", # Request for autofix: https://github.com/astral-sh/ruff/issues/14185
64-
"PYI052",
6561
]
6662
[tool.ruff.lint.per-file-ignores]
6763
"*.pyi" = [

stubs/sklearn/model_selection/_search.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ from ..utils.validation import check_is_fitted as check_is_fitted, indexable as
2929
from . import BaseCrossValidator
3030
from ._split import check_cv as check_cv
3131

32-
BaseEstimatorT = TypeVar("BaseEstimatorT", bound=BaseEstimator, default=BaseEstimator, covariant=True)
32+
_BaseEstimatorT = TypeVar("_BaseEstimatorT", bound=BaseEstimator, default=BaseEstimator, covariant=True)
3333

3434
__all__ = ["GridSearchCV", "ParameterGrid", "ParameterSampler", "RandomizedSearchCV"]
3535

@@ -84,7 +84,7 @@ class BaseSearchCV(MetaEstimatorMixin, BaseEstimator, metaclass=ABCMeta):
8484
**fit_params,
8585
) -> Self: ...
8686

87-
class GridSearchCV(BaseSearchCV, Generic[BaseEstimatorT]):
87+
class GridSearchCV(BaseSearchCV, Generic[_BaseEstimatorT]):
8888
feature_names_in_: ndarray = ...
8989
n_features_in_: int = ...
9090
classes_: ndarray = ...
@@ -95,14 +95,14 @@ class GridSearchCV(BaseSearchCV, Generic[BaseEstimatorT]):
9595
best_index_: int = ...
9696
best_params_: dict = ...
9797
best_score_: float = ...
98-
best_estimator_: BaseEstimatorT = ...
98+
best_estimator_: _BaseEstimatorT = ...
9999
cv_results_: dict[str, ndarray] = ...
100100

101101
_required_parameters: ClassVar[list] = ...
102102

103103
def __init__(
104104
self,
105-
estimator: BaseEstimatorT,
105+
estimator: _BaseEstimatorT,
106106
param_grid: Mapping | Sequence[dict],
107107
*,
108108
scoring: ArrayLike | None | tuple | Callable | Mapping | str = None,

stubs/sympy-stubs/codegen/ast.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ class FloatBaseType(Type):
147147
class FloatType(FloatBaseType):
148148
__slots__ = ...
149149
_fields = ...
150-
_construct_nexp = _construct_nmant = _construct_nbits = Integer
150+
_construct_nexp = Integer
151+
_construct_nmant = Integer
152+
_construct_nbits = Integer
151153
@property
152154
def max_exponent(self) -> Expr: ...
153155
@property

stubs/sympy-stubs/matrices/dense.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class DenseMatrix(RepMatrix):
2121
class MutableDenseMatrix(DenseMatrix, MutableRepMatrix):
2222
def simplify(self, **kwargs) -> None: ...
2323

24-
Matrix = MutableMatrix = MutableDenseMatrix
24+
Matrix = MutableDenseMatrix
25+
MutableMatrix = MutableDenseMatrix
2526

2627
def list2numpy(l, dtype=...) -> NDArray[Any, Any]: ...
2728
def matrix2numpy(m, dtype=...) -> NDArray[Any, Any]: ...

stubs/sympy-stubs/polys/domains/simpledomain.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ from typing_extensions import Self
33
from sympy.polys.domains.domain import Domain
44

55
class SimpleDomain(Domain):
6-
is_Simple = True
6+
is_Simple: bool = True
77
def inject(self, *gens) -> Self: ...

stubs/sympy-stubs/polys/matrices/dense.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ from typing import Any, TypeVar
33

44
from sympy.polys.matrices._typing import RingElement
55

6-
T = TypeVar("T")
7-
R = TypeVar("R", bound=RingElement)
6+
T = TypeVar("T") # noqa: PYI001 # Exists at runtime
7+
R = TypeVar("R", bound=RingElement) # noqa: PYI001 # Exists at runtime
88

99
def ddm_transpose(matrix: Sequence[Sequence[T]]) -> list[list[T]]: ...
1010
def ddm_iadd(a: list[list[R]], b: Sequence[Sequence[R]]) -> None: ...

stubs/sympy-stubs/polys/polymatrix.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ class MutablePolyDenseMatrix:
3939
def nullspace(self) -> list[Self]: ...
4040
def rank(self): ...
4141

42-
PolyMatrix = MutablePolyMatrix = MutablePolyDenseMatrix
42+
PolyMatrix = MutablePolyDenseMatrix
43+
MutablePolyMatrix = MutablePolyDenseMatrix

tests/run_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ def install_requirements(test_folder: Path):
1414
def run_pyright():
1515
print("\nRunning Pyright...")
1616
# https://github.com/RobertCraigie/pyright-python#keeping-pyright-and-pylance-in-sync
17-
del os.environ["PYRIGHT_PYTHON_FORCE_VERSION"]
17+
os.environ.pop("PYRIGHT_PYTHON_FORCE_VERSION", None)
1818
os.environ["PYRIGHT_PYTHON_PYLANCE_VERSION"] = "latest-prerelease"
1919
return subprocess.run((sys.executable, "-m", "pyright"))
2020

2121

2222
def run_mypy():
2323
print("\nRunning mypy...")
24-
return subprocess.run((sys.executable, "-m", "mypy"))
24+
return subprocess.run((sys.executable, "-m", "mypy", "."))
2525

2626

2727
def main():

0 commit comments

Comments
 (0)