Skip to content

Commit

Permalink
[python-package] simplify Dataset._compare_params_for_warning() (#6120)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb authored Oct 3, 2023
1 parent 63a882b commit f175ceb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions python-package/lightgbm/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2200,8 +2200,8 @@ def __init_from_csc(

@staticmethod
def _compare_params_for_warning(
params: Optional[Dict[str, Any]],
other_params: Optional[Dict[str, Any]],
params: Dict[str, Any],
other_params: Dict[str, Any],
ignore_keys: Set[str]
) -> bool:
"""Compare two dictionaries with params ignoring some keys.
Expand All @@ -2210,9 +2210,9 @@ def _compare_params_for_warning(
Parameters
----------
params : dict or None
params : dict
One dictionary with parameters to compare.
other_params : dict or None
other_params : dict
Another dictionary with parameters to compare.
ignore_keys : set
Keys that should be ignored during comparing two dictionaries.
Expand All @@ -2222,10 +2222,6 @@ def _compare_params_for_warning(
compare_result : bool
Returns whether two dictionaries with params are equal.
"""
if params is None:
params = {}
if other_params is None:
other_params = {}
for k in other_params:
if k not in ignore_keys:
if k not in params or params[k] != other_params[k]:
Expand Down

0 comments on commit f175ceb

Please sign in to comment.