Skip to content

Commit

Permalink
[python] Prefix basic.is_numeric() with _ (#5421)
Browse files Browse the repository at this point in the history
  • Loading branch information
ak04p authored Aug 15, 2022
1 parent 5ef46f9 commit 6b695c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python-package/lightgbm/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def _safe_call(ret: int) -> None:
raise LightGBMError(_LIB.LGBM_GetLastError().decode('utf-8'))


def is_numeric(obj: Any) -> bool:
def _is_numeric(obj: Any) -> bool:
"""Check whether object is a number or not, include numpy number, etc."""
try:
float(obj)
Expand Down Expand Up @@ -189,7 +189,7 @@ def cast_numpy_array_to_dtype(array, dtype):

def is_1d_list(data: Any) -> bool:
"""Check whether data is a 1-D list."""
return isinstance(data, list) and (not data or is_numeric(data[0]))
return isinstance(data, list) and (not data or _is_numeric(data[0]))


def _is_1d_collection(data: Any) -> bool:
Expand Down Expand Up @@ -317,7 +317,7 @@ def to_string(x):
else:
return str(x)
pairs.append(f"{key}={','.join(map(to_string, val))}")
elif isinstance(val, (str, Path, _NUMERIC_TYPES)) or is_numeric(val):
elif isinstance(val, (str, Path, _NUMERIC_TYPES)) or _is_numeric(val):
pairs.append(f"{key}={val}")
elif val is not None:
raise TypeError(f'Unknown type of parameter:{key}, got:{type(val).__name__}')
Expand Down

0 comments on commit 6b695c2

Please sign in to comment.