From f175cebd2d971ca6140455035e526d67f04237eb Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 2 Oct 2023 23:08:32 -0500 Subject: [PATCH] [python-package] simplify Dataset._compare_params_for_warning() (#6120) --- python-package/lightgbm/basic.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/python-package/lightgbm/basic.py b/python-package/lightgbm/basic.py index 3dfa583a62bb..9b833afada84 100644 --- a/python-package/lightgbm/basic.py +++ b/python-package/lightgbm/basic.py @@ -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. @@ -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. @@ -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]: