From 37f209ee6455f2bff9cc2ca558747b5c4532e1e5 Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Sun, 8 Dec 2024 22:47:42 +0100 Subject: [PATCH] use vendoring import --- .../lightgbm/{sklearn_compat.py => _sklearn_compat.py} | 1 + python-package/lightgbm/compat.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) rename python-package/lightgbm/{sklearn_compat.py => _sklearn_compat.py} (99%) diff --git a/python-package/lightgbm/sklearn_compat.py b/python-package/lightgbm/_sklearn_compat.py similarity index 99% rename from python-package/lightgbm/sklearn_compat.py rename to python-package/lightgbm/_sklearn_compat.py index e79ce2511900..c1414f1daf5d 100644 --- a/python-package/lightgbm/sklearn_compat.py +++ b/python-package/lightgbm/_sklearn_compat.py @@ -1,3 +1,4 @@ +# coding: utf-8 """Ease developer experience to support multiple versions of scikit-learn. This file is intended to be vendored in your project if you do not want to depend on diff --git a/python-package/lightgbm/compat.py b/python-package/lightgbm/compat.py index d0420ed9a543..45650a93f1a5 100644 --- a/python-package/lightgbm/compat.py +++ b/python-package/lightgbm/compat.py @@ -16,7 +16,7 @@ from sklearn.exceptions import NotFittedError from sklearn.model_selection import BaseCrossValidator, GroupKFold, StratifiedKFold from sklearn.utils.validation import _check_sample_weight - from .sklearn_compat.utils.validation import validate_data + from ._sklearn_compat import validate_data SKLEARN_INSTALLED = True _LGBMBaseCrossValidator = BaseCrossValidator @@ -65,7 +65,7 @@ class _LGBMRegressorBase: # type: ignore # additional scikit-learn imports only for type hints if TYPE_CHECKING: - from .sklearn_compat.utils import Tags as _sklearn_Tags # noqa: F401 + from ._sklearn_compat import Tags as _sklearn_Tags # noqa: F401 """pandas""" try: