Skip to content

Commit 0ecf529

Browse files
committed
Merge branch 'main' of https://github.com/microsoft/python-type-stubs into remove-networkx
2 parents 1adb0c1 + ee6d039 commit 0ecf529

File tree

31 files changed

+68
-297
lines changed

31 files changed

+68
-297
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ tests = [
2626
# The libraries we're stubbing.
2727
# Needed for stubtest and downloads their dependencies to get known import symbols
2828
"scikit-image",
29-
"scikit-learn",
29+
"scikit-learn <1.7.0", # TODO: Update stubs for sklearn
3030
"sympy",
3131
"vispy",
3232
]

stubs/sklearn/_config.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ def set_config(
1616
enable_cython_pairwise_dist: None | bool = None,
1717
array_api_dispatch: None | bool = None,
1818
transform_output: None | str = None,
19+
enable_metadata_routing: None | bool = None,
20+
skip_parameter_validation: None | bool = None,
1921
) -> None: ...
2022
def config_context(
2123
*,
@@ -27,4 +29,6 @@ def config_context(
2729
enable_cython_pairwise_dist: None | bool = None,
2830
array_api_dispatch: None | bool = None,
2931
transform_output: None | str = None,
32+
enable_metadata_routing: None | bool = None,
33+
skip_parameter_validation: None | bool = None,
3034
) -> Iterator[None]: ...

stubs/sklearn/base.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ from ._config import get_config as get_config
1515
from ._typing import ArrayLike, Float, Int, MatrixLike
1616
from .metrics import accuracy_score as accuracy_score, r2_score as r2_score
1717
from .utils._estimator_html_repr import estimator_html_repr as estimator_html_repr
18+
from .utils._metadata_requests import _MetadataRequester
1819
from .utils._param_validation import validate_parameter_constraints as validate_parameter_constraints
1920
from .utils._set_output import _SetOutputMixin
2021
from .utils.validation import check_array as check_array, check_is_fitted as check_is_fitted, check_X_y as check_X_y
@@ -24,7 +25,7 @@ from .utils.validation import check_array as check_array, check_is_fitted as che
2425

2526
def clone(estimator: BaseEstimator | Iterable[BaseEstimator], *, safe: bool = True) -> Any: ...
2627

27-
class BaseEstimator:
28+
class BaseEstimator(_MetadataRequester):
2829
def get_params(self, deep: bool = True) -> dict: ...
2930
def set_params(self, **params) -> Self: ...
3031
def __repr__(self, N_CHAR_MAX: int = 700) -> str: ...

stubs/sklearn/cluster/_agglomerative.pyi

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ class AgglomerativeClustering(ClusterMixin, BaseEstimator):
4949
self,
5050
n_clusters: None | int = 2,
5151
*,
52-
affinity: str | Callable = "deprecated", # TODO(1.4): Remove
53-
metric: None | str | Callable = None, # TODO(1.4): Set to "euclidean"
52+
metric: str | Callable = "euclidean",
5453
memory: None | Memory | str = None,
5554
connectivity: None | ArrayLike | Callable = None,
5655
compute_full_tree: Literal["auto"] | bool = "auto",
@@ -77,8 +76,7 @@ class FeatureAgglomeration(ClassNamePrefixFeaturesOutMixin, AgglomerativeCluster
7776
self,
7877
n_clusters: None | int = 2,
7978
*,
80-
affinity: str | Callable = "deprecated", # TODO(1.4): Remove
81-
metric: None | str | Callable = None, # TODO(1.4): Set to "euclidean"
79+
metric: str | Callable = "euclidean",
8280
memory: None | Memory | str = None,
8381
connectivity: None | ArrayLike | Callable = None,
8482
compute_full_tree: Literal["auto"] | bool = "auto",

stubs/sklearn/covariance/_robust_covariance.pyi

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@ from numpy.random import RandomState
77
from .._typing import Float, Int, MatrixLike
88
from . import EmpiricalCovariance
99

10-
# Author: Virgile Fritsch <[email protected]>
11-
#
12-
# License: BSD 3 clause
13-
14-
# Minimum Covariance Determinant
15-
# Implementing of an algorithm by Rousseeuw & Van Driessen described in
16-
# (A Fast Algorithm for the Minimum Covariance Determinant Estimator,
17-
# 1999, American Statistical Association and the American Society
18-
# for Quality, TECHNOMETRICS)
19-
# XXX Is this really a public function? It's not listed in the docs or
20-
# exported by sklearn.covariance. Deprecate?
2110
def c_step(
2211
X: MatrixLike,
2312
n_support: Int,

stubs/sklearn/datasets/_samples_generator.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ def make_low_rank_matrix(
110110
tail_strength: Float = 0.5,
111111
random_state: RandomState | None | Int = None,
112112
) -> ndarray: ...
113-
114-
# TODO(1.3): Change argument `data_transposed` default from True to False.
115-
# TODO(1.3): Deprecate data_transposed, always return data not transposed.
116113
def make_sparse_coded_signal(
117114
n_samples: Int,
118115
*,

stubs/sklearn/ensemble/_gb.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ class GradientBoostingClassifier(ClassifierMixin, BaseGradientBoosting):
7070
feature_importances_: ndarray = ...
7171
n_estimators_: int = ...
7272

73-
# TODO(1.3): remove "deviance"
7473
_parameter_constraints: ClassVar[dict] = ...
7574

7675
def __init__(

stubs/sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ class HistGradientBoostingClassifier(ClassifierMixin, BaseHistGradientBoosting):
9696
do_early_stopping_: bool = ...
9797
classes_: ndarray = ...
9898

99-
# TODO(1.3): Remove "binary_crossentropy", "categorical_crossentropy", "auto"
10099
_parameter_constraints: ClassVar[dict] = ...
101100

102101
def __init__(

stubs/sklearn/feature_selection/_univariate_selection.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ class SelectFwe(_BaseFilter):
9292
# Generic filter
9393
######################################################################
9494

95-
# TODO this class should fit on either p-values or scores,
96-
# depending on the mode.
9795
class GenericUnivariateSelect(_BaseFilter):
9896
feature_names_in_: ndarray = ...
9997
n_features_in_: int = ...

stubs/sklearn/linear_model/_stochastic_gradient.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def fit_binary(
8686
) -> tuple[ndarray, float, int]: ...
8787

8888
class BaseSGDClassifier(LinearClassifierMixin, BaseSGD, metaclass=ABCMeta):
89-
# TODO(1.3): Remove "log""
9089
loss_functions: ClassVar[dict] = ...
9190

9291
_parameter_constraints: ClassVar[dict] = ...

0 commit comments

Comments
 (0)