Skip to content

Commit

Permalink
[python-package] add more type hints on Booster (#5432)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb authored Aug 23, 2022
1 parent 865c126 commit 78f95e4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions python-package/lightgbm/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2760,7 +2760,7 @@ def __deepcopy__(self, _) -> "Booster":
booster = Booster(model_str=model_str)
return booster

def __getstate__(self):
def __getstate__(self) -> Dict[str, Any]:
this = self.__dict__.copy()
handle = this['handle']
this.pop('train_set', None)
Expand All @@ -2769,7 +2769,7 @@ def __getstate__(self):
this["handle"] = self.model_to_string(num_iteration=-1)
return this

def __setstate__(self, state):
def __setstate__(self, state: Dict[str, Any]) -> None:
model_str = state.get('handle', None)
if model_str is not None:
handle = ctypes.c_void_p()
Expand Down Expand Up @@ -3663,16 +3663,16 @@ def refit(
self,
data,
label,
decay_rate=0.9,
reference=None,
decay_rate: float = 0.9,
reference: Optional[Dataset] = None,
weight=None,
group=None,
init_score=None,
feature_name='auto',
categorical_feature='auto',
dataset_params=None,
free_raw_data=True,
validate_features=False,
feature_name: Union[str, List[str]] = 'auto',
categorical_feature: Union[str, List[str], List[int]] = 'auto',
dataset_params: Optional[Dict[str, Any]] = None,
free_raw_data: bool = True,
validate_features: bool = False,
**kwargs
):
"""Refit the existing Booster by new data.
Expand Down

0 comments on commit 78f95e4

Please sign in to comment.