Unverified Commit 2a5e33b7 authored by Oliver Borchert's avatar Oliver Borchert Committed by GitHub
Browse files

[python-package] Fix mypy checks in `compat.py` (#6898)


Co-authored-by: default avatarJames Lamb <jaylamb20@gmail.com>
parent c73a21b3
...@@ -36,16 +36,16 @@ try: ...@@ -36,16 +36,16 @@ try:
# validate_data() was added in scikit-learn 1.6, this function roughly imitates it for older versions. # validate_data() was added in scikit-learn 1.6, this function roughly imitates it for older versions.
# It can be removed when lightgbm's minimum scikit-learn version is at least 1.6. # It can be removed when lightgbm's minimum scikit-learn version is at least 1.6.
def validate_data( def validate_data(
_estimator, _estimator: Any,
X, X: Any,
y="no_validation", y: Any = "no_validation",
accept_sparse: bool = True, accept_sparse: bool = True,
# 'force_all_finite' was renamed to 'ensure_all_finite' in scikit-learn 1.6 # 'force_all_finite' was renamed to 'ensure_all_finite' in scikit-learn 1.6
ensure_all_finite: bool = False, ensure_all_finite: bool = False,
ensure_min_samples: int = 1, ensure_min_samples: int = 1,
# trap other keyword arguments that only work on scikit-learn >=1.6, like 'reset' # trap other keyword arguments that only work on scikit-learn >=1.6, like 'reset'
**ignored_kwargs, **ignored_kwargs: Any,
): ) -> Any:
# it's safe to import _num_features unconditionally because: # it's safe to import _num_features unconditionally because:
# #
# * it was first added in scikit-learn 0.24.2 # * it was first added in scikit-learn 0.24.2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment