Unverified Commit 23403a7c authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[python-package] make public API members explicit with module-level __all__ variables (#5655)

parent e40c9e29
......@@ -20,6 +20,15 @@ import scipy.sparse
from .compat import PANDAS_INSTALLED, concat, dt_DataTable, pd_CategoricalDtype, pd_DataFrame, pd_Series
from .libpath import find_lib_path
__all__ = [
'Booster',
'Dataset',
'LGBMDeprecationWarning',
'LightGBMError',
'register_logger',
'Sequence',
]
_DatasetHandle = ctypes.c_void_p
_LGBM_EvalFunctionResultType = Tuple[str, float, bool]
_LGBM_BoosterEvalMethodResultType = Tuple[str, str, float, bool]
......
......@@ -6,6 +6,13 @@ from typing import Any, Callable, Dict, List, Tuple, Union
from .basic import _ConfigAliases, _LGBM_BoosterEvalMethodResultType, _log_info, _log_warning
__all__ = [
'early_stopping',
'log_evaluation',
'record_evaluation',
'reset_parameter',
]
_EvalResultTuple = Union[
List[_LGBM_BoosterEvalMethodResultType],
List[Tuple[str, str, float, bool, float]]
......
......@@ -194,3 +194,5 @@ except ImportError:
def _LGBMCpuCount(only_physical_cores: bool = True):
return cpu_count()
__all__ = []
......@@ -25,6 +25,12 @@ from .sklearn import (LGBMClassifier, LGBMModel, LGBMRanker, LGBMRegressor, _LGB
_LGBM_ScikitEvalMetricType, _lgbmmodel_doc_custom_eval_note, _lgbmmodel_doc_fit,
_lgbmmodel_doc_predict)
__all__ = [
'DaskLGBMClassifier',
'DaskLGBMRanker',
'DaskLGBMRegressor',
]
_DaskCollection = Union[dask_Array, dask_DataFrame, dask_Series]
_DaskMatrixLike = Union[dask_Array, dask_DataFrame]
_DaskVectorLike = Union[dask_Array, dask_Series]
......
......@@ -14,6 +14,13 @@ from .basic import (Booster, Dataset, LightGBMError, _choose_param_value, _Confi
_LGBM_CustomObjectiveFunction, _log_warning)
from .compat import SKLEARN_INSTALLED, _LGBMBaseCrossValidator, _LGBMGroupKFold, _LGBMStratifiedKFold
__all__ = [
'cv',
'CVBooster',
'train',
]
_LGBM_CustomMetricFunction = Callable[
[np.ndarray, Dataset],
Tuple[str, float, bool]
......
......@@ -4,6 +4,8 @@ from pathlib import Path
from platform import system
from typing import List
__all__ = []
def find_lib_path() -> List[str]:
"""Find the path to LightGBM library files.
......
......@@ -11,6 +11,14 @@ from .basic import Booster, _data_from_pandas, _is_zero, _log_warning, _MissingT
from .compat import GRAPHVIZ_INSTALLED, MATPLOTLIB_INSTALLED, pd_DataFrame
from .sklearn import LGBMModel
__all__ = [
'create_tree_digraph',
'plot_importance',
'plot_metric',
'plot_split_value_histogram',
'plot_tree',
]
def _check_not_tuple_of_2_elements(obj: Any, obj_name: str = 'obj') -> None:
"""Check object is not tuple or does not have 2 elements."""
......
......@@ -16,6 +16,13 @@ from .compat import (SKLEARN_INSTALLED, LGBMNotFittedError, _LGBMAssertAllFinite
dt_DataTable, pd_DataFrame)
from .engine import train
__all__ = [
'LGBMClassifier',
'LGBMModel',
'LGBMRanker',
'LGBMRegressor',
]
_LGBM_ScikitCustomObjectiveFunction = Union[
Callable[
[np.ndarray, np.ndarray],
......
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