From bb914e7b6df95449ecc80a27a682e628758ed78e Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 2 May 2025 21:15:15 -0400 Subject: [PATCH] stub-body-multiple-statements (PYI048) --- pyproject.toml | 2 +- stubs/sklearn/cluster/_k_means_elkan.pyi | 4 ---- stubs/sklearn/cluster/_k_means_lloyd.pyi | 2 -- stubs/sklearn/decomposition/_online_lda_fast.pyi | 1 - stubs/sklearn/ensemble/_gradient_boosting.pyi | 2 -- .../sklearn/ensemble/_hist_gradient_boosting/histogram.pyi | 2 -- .../sklearn/ensemble/_hist_gradient_boosting/splitting.pyi | 2 -- stubs/sklearn/feature_extraction/_hashing_fast.pyi | 1 - .../metrics/_pairwise_distances_reduction/_dispatcher.pyi | 4 ---- stubs/sklearn/utils/arrayfuncs.pyi | 1 - stubs/sklearn/utils/sparsefuncs_fast.pyi | 7 ------- stubs/sympy-stubs/core/cache.pyi | 4 +--- 12 files changed, 2 insertions(+), 30 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 42a5b3a8..bf0bf973 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,7 @@ extend-select = [ "PYI", # flake8-pyi "UP", # pyupgrade "W", # pycodestyle Warning + "PIE790", # unnecessary-placeholder ] ignore = [ ### @@ -56,7 +57,6 @@ ignore = [ # TODO: Investigate and fix or configure "PYI024", - "PYI048", "PYI051", # Request for autofix: https://github.com/astral-sh/ruff/issues/14185 ] [tool.ruff.lint.per-file-ignores] diff --git a/stubs/sklearn/cluster/_k_means_elkan.pyi b/stubs/sklearn/cluster/_k_means_elkan.pyi index 38daf2ef..e7f2c088 100644 --- a/stubs/sklearn/cluster/_k_means_elkan.pyi +++ b/stubs/sklearn/cluster/_k_means_elkan.pyi @@ -41,7 +41,6 @@ def init_bounds_dense( n_threads : int The number of threads to be used by openmp. """ - ... def init_bounds_sparse( X: spmatrix, @@ -83,7 +82,6 @@ def init_bounds_sparse( n_threads : int The number of threads to be used by openmp. """ - ... def elkan_iter_chunked_dense( X: np.ndarray, @@ -141,7 +139,6 @@ def elkan_iter_chunked_dense( the algorithm. This is useful especially when calling predict on a fitted model. """ - ... def elkan_iter_chunked_sparse( X: spmatrix, @@ -199,4 +196,3 @@ def elkan_iter_chunked_sparse( the algorithm. This is useful especially when calling predict on a fitted model. """ - ... diff --git a/stubs/sklearn/cluster/_k_means_lloyd.pyi b/stubs/sklearn/cluster/_k_means_lloyd.pyi index 5f7a18e3..dcfc2338 100644 --- a/stubs/sklearn/cluster/_k_means_lloyd.pyi +++ b/stubs/sklearn/cluster/_k_means_lloyd.pyi @@ -44,7 +44,6 @@ def lloyd_iter_chunked_dense( the algorithm. This is useful especially when calling predict on a fitted model. """ - ... def lloyd_iter_chunked_sparse( X: np.ndarray, @@ -90,4 +89,3 @@ def lloyd_iter_chunked_sparse( the algorithm. This is useful especially when calling predict on a fitted model. """ - ... diff --git a/stubs/sklearn/decomposition/_online_lda_fast.pyi b/stubs/sklearn/decomposition/_online_lda_fast.pyi index 47da00a0..74a82642 100644 --- a/stubs/sklearn/decomposition/_online_lda_fast.pyi +++ b/stubs/sklearn/decomposition/_online_lda_fast.pyi @@ -5,6 +5,5 @@ def mean_change(arr_1: np.ndarray, arr_2: np.ndarray) -> float: Equivalent to np.abs(arr_1 - arr2).mean(). """ - ... def psi(x: float) -> float: ... diff --git a/stubs/sklearn/ensemble/_gradient_boosting.pyi b/stubs/sklearn/ensemble/_gradient_boosting.pyi index 5e4db39d..faa3c58a 100644 --- a/stubs/sklearn/ensemble/_gradient_boosting.pyi +++ b/stubs/sklearn/ensemble/_gradient_boosting.pyi @@ -5,11 +5,9 @@ def predict_stages(estimators: np.ndarray, X, scale: float, out: np.ndarray) -> Each estimator is scaled by ``scale`` before its prediction is added to ``out``. """ - ... def predict_stage(estimators: np.ndarray, stage: int, X, scale: float, out: np.ndarray) -> None: """Add predictions of ``estimators[stage]`` to ``out``. Each estimator in the stage is scaled by ``scale`` before its prediction is added to ``out``. """ - ... diff --git a/stubs/sklearn/ensemble/_hist_gradient_boosting/histogram.pyi b/stubs/sklearn/ensemble/_hist_gradient_boosting/histogram.pyi index 21d067f1..51509da8 100644 --- a/stubs/sklearn/ensemble/_hist_gradient_boosting/histogram.pyi +++ b/stubs/sklearn/ensemble/_hist_gradient_boosting/histogram.pyi @@ -58,7 +58,6 @@ class HistogramBuilder: histograms : ndarray of HISTOGRAM_DTYPE, shape (n_features, n_bins) The computed histograms of the current node. """ - ... def compute_histograms_subtraction( self, @@ -85,4 +84,3 @@ class HistogramBuilder: histograms : ndarray of HISTOGRAM_DTYPE, shape(n_features, n_bins) The computed histograms of the current node. """ - ... diff --git a/stubs/sklearn/ensemble/_hist_gradient_boosting/splitting.pyi b/stubs/sklearn/ensemble/_hist_gradient_boosting/splitting.pyi index 7e9f8c10..ababf13e 100644 --- a/stubs/sklearn/ensemble/_hist_gradient_boosting/splitting.pyi +++ b/stubs/sklearn/ensemble/_hist_gradient_boosting/splitting.pyi @@ -159,7 +159,6 @@ class Splitter: right_child_position : int The position of the right child in ``sample_indices``. """ - ... def find_node_split( self, @@ -208,4 +207,3 @@ class Splitter: best_split_info : SplitInfo The info about the best possible split among all features. """ - ... diff --git a/stubs/sklearn/feature_extraction/_hashing_fast.pyi b/stubs/sklearn/feature_extraction/_hashing_fast.pyi index 25e2e776..1f93f058 100644 --- a/stubs/sklearn/feature_extraction/_hashing_fast.pyi +++ b/stubs/sklearn/feature_extraction/_hashing_fast.pyi @@ -8,4 +8,3 @@ def transform( indices, indptr, values : lists For constructing a scipy.sparse.csr_matrix. """ - ... diff --git a/stubs/sklearn/metrics/_pairwise_distances_reduction/_dispatcher.pyi b/stubs/sklearn/metrics/_pairwise_distances_reduction/_dispatcher.pyi index 2dcc6ea5..713a7a11 100644 --- a/stubs/sklearn/metrics/_pairwise_distances_reduction/_dispatcher.pyi +++ b/stubs/sklearn/metrics/_pairwise_distances_reduction/_dispatcher.pyi @@ -20,7 +20,6 @@ def sqeuclidean_row_norms(X: np.ndarray | csr_matrix, num_threads: int) -> np.nd sqeuclidean_row_norms : ndarray of shape (n_samples,) Arrays containing the squared euclidean norm of each row of X. """ - ... class BaseDistancesReductionDispatcher: """Abstract base dispatcher for pairwise distance computation & reduction. @@ -53,7 +52,6 @@ class BaseDistancesReductionDispatcher: ------- True if the dispatcher can be used, else False. """ - ... @classmethod @abstractmethod @@ -170,7 +168,6 @@ class ArgKmin(BaseDistancesReductionDispatcher): for the concrete implementation are therefore freed when this classmethod returns. """ - ... class RadiusNeighbors(BaseDistancesReductionDispatcher): """Compute radius-based neighbors for two sets of vectors. @@ -286,4 +283,3 @@ class RadiusNeighbors(BaseDistancesReductionDispatcher): for the concrete implementation are therefore freed when this classmethod returns. """ - ... diff --git a/stubs/sklearn/utils/arrayfuncs.pyi b/stubs/sklearn/utils/arrayfuncs.pyi index ae8501da..58701d70 100644 --- a/stubs/sklearn/utils/arrayfuncs.pyi +++ b/stubs/sklearn/utils/arrayfuncs.pyi @@ -5,6 +5,5 @@ def min_pos(X: np.ndarray) -> float: Returns the maximum representable value of the input dtype if none of the values are positive. """ - ... def cholesky_delete(L: np.ndarray, go_out: int) -> None: ... diff --git a/stubs/sklearn/utils/sparsefuncs_fast.pyi b/stubs/sklearn/utils/sparsefuncs_fast.pyi index 1c7f36c4..461fb197 100644 --- a/stubs/sklearn/utils/sparsefuncs_fast.pyi +++ b/stubs/sklearn/utils/sparsefuncs_fast.pyi @@ -3,7 +3,6 @@ from scipy.sparse import csc_matrix, csr_matrix def csr_row_norms(X: np.ndarray) -> np.ndarray: """Squared L2 norm of each row in CSR matrix X.""" - ... def csr_mean_variance_axis0( X: csr_matrix, weights: np.ndarray | None = None, return_sum_weights: bool = False @@ -29,7 +28,6 @@ def csr_mean_variance_axis0( sum_weights : ndarray of shape (n_features,), dtype=floating Returned if return_sum_weights is True. """ - ... def csc_mean_variance_axis0( X: csc_matrix, weights: np.ndarray | None = None, return_sum_weights: bool = False @@ -55,7 +53,6 @@ def csc_mean_variance_axis0( sum_weights : ndarray of shape (n_features,), dtype=floating Returned if return_sum_weights is True. """ - ... def incr_mean_variance_axis0( X: csr_matrix | csc_matrix, last_mean: np.ndarray, last_var: np.ndarray, last_n: np.ndarray, weights: np.ndarray | None = None @@ -86,15 +83,12 @@ def incr_mean_variance_axis0( updated_n : int array with shape (n_features,) Updated number of samples seen """ - ... def inplace_csr_row_normalize_l1(X: np.ndarray) -> None: """Inplace row normalize using the l1 norm""" - ... def inplace_csr_row_normalize_l2(X: np.ndarray) -> None: """Inplace row normalize using the l2 norm""" - ... def assign_rows_csr( X: csr_matrix, @@ -112,4 +106,3 @@ def assign_rows_csr( out_rows : array, dtype=np.intp, shape=n_rows out : array, shape=(arbitrary, n_features) """ - ... diff --git a/stubs/sympy-stubs/core/cache.pyi b/stubs/sympy-stubs/core/cache.pyi index bb43478f..ef74b3e4 100644 --- a/stubs/sympy-stubs/core/cache.pyi +++ b/stubs/sympy-stubs/core/cache.pyi @@ -13,6 +13,4 @@ SYMPY_CACHE_SIZE = ... cacheit = ... def cached_property(func) -> property: ... -def lazy_function(module: str, name: str) -> Callable: - class LazyFunctionMeta(type): ... - class LazyFunction(metaclass=LazyFunctionMeta): ... +def lazy_function(module: str, name: str) -> Callable: ...