-
-
Notifications
You must be signed in to change notification settings - Fork 26.1k
MNT update to mypy=1.3 #26632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
MNT update to mypy=1.3 #26632
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Linting PassedAll linting checks passed. Your pull request is in excellent shape! ☀️ |
thomasjpfan
reviewed
Jun 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the patch to avoid using # type: ignore
:
diff --git a/sklearn/cluster/_hdbscan/hdbscan.py b/sklearn/cluster/_hdbscan/hdbscan.py
index 3d8ec08ac3..f1584f46d6 100644
--- a/sklearn/cluster/_hdbscan/hdbscan.py
+++ b/sklearn/cluster/_hdbscan/hdbscan.py
@@ -62,7 +62,7 @@ FAST_METRICS = set(KDTree.valid_metrics() + BallTree.valid_metrics())
# Encodings are arbitrary but must be strictly negative.
# The current encodings are chosen as extensions to the -1 noise label.
# Avoided enums so that the end user only deals with simple labels.
-_OUTLIER_ENCODING = {
+_OUTLIER_ENCODING: dict = {
"infinite": {
"label": -2,
# The probability could also be 1, since infinite points are certainly
diff --git a/sklearn/cluster/tests/test_hdbscan.py b/sklearn/cluster/tests/test_hdbscan.py
index c21b188fd5..b652a99aa2 100644
--- a/sklearn/cluster/tests/test_hdbscan.py
+++ b/sklearn/cluster/tests/test_hdbscan.py
@@ -34,9 +34,7 @@ ALGORITHMS = [
"auto",
]
-OUTLIER_SET = {-1} | {
- out["label"] for _, out in _OUTLIER_ENCODING.items() # type: ignore
-}
+OUTLIER_SET = {-1} | {out["label"] for _, out in _OUTLIER_ENCODING.items()}
@pytest.mark.parametrize("outlier_type", _OUTLIER_ENCODING)
diff --git a/sklearn/tests/test_metaestimators_metadata_routing.py b/sklearn/tests/test_metaestimators_metadata_routing.py
index 1cd21ae817..5160a4b46b 100644
--- a/sklearn/tests/test_metaestimators_metadata_routing.py
+++ b/sklearn/tests/test_metaestimators_metadata_routing.py
@@ -171,7 +171,7 @@ class ConsumingClassifier(ClassifierMixin, BaseEstimator):
# return np.zeros(shape=(len(X), 2))
-METAESTIMATORS = [
+METAESTIMATORS: list = [
{
"metaestimator": MultiOutputRegressor,
"estimator_name": "estimator",
@@ -232,9 +232,7 @@ The keys are as follows:
"""
# ids used for pytest fixture
-METAESTIMATOR_IDS = [
- str(row["metaestimator"].__name__) for row in METAESTIMATORS # type: ignore
-]
+METAESTIMATOR_IDS = [str(row["metaestimator"].__name__) for row in METAESTIMATORS]
def test_registry_copy():
thomasjpfan
approved these changes
Jun 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ogrisel
approved these changes
Jun 20, 2023
jeremiedbb
pushed a commit
to jeremiedbb/scikit-learn
that referenced
this pull request
Jun 29, 2023
jeremiedbb
pushed a commit
that referenced
this pull request
Jun 29, 2023
REDVM
pushed a commit
to REDVM/scikit-learn
that referenced
this pull request
Nov 16, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
mypy
has gotten a lot faster in the meantime.