Unverified Commit 71b6550f authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[python-package] add type hints on empty initializations (#5445)

parent 465989f9
...@@ -2514,7 +2514,7 @@ class Dataset: ...@@ -2514,7 +2514,7 @@ class Dataset:
Chain of references of the Datasets. Chain of references of the Datasets.
""" """
head = self head = self
ref_chain = set() ref_chain: Set[Dataset] = set()
while len(ref_chain) < ref_limit: while len(ref_chain) < ref_limit:
if isinstance(head, Dataset): if isinstance(head, Dataset):
ref_chain.add(head) ref_chain.add(head)
...@@ -2733,8 +2733,8 @@ class Booster: ...@@ -2733,8 +2733,8 @@ class Booster:
ctypes.byref(self.handle))) ctypes.byref(self.handle)))
# save reference to data # save reference to data
self.train_set = train_set self.train_set = train_set
self.valid_sets = [] self.valid_sets: List[Dataset] = []
self.name_valid_sets = [] self.name_valid_sets: List[str] = []
self.__num_dataset = 1 self.__num_dataset = 1
self.__init_predictor = train_set._predictor self.__init_predictor = train_set._predictor
if self.__init_predictor is not None: if self.__init_predictor is not None:
......
...@@ -300,7 +300,7 @@ class CVBooster: ...@@ -300,7 +300,7 @@ class CVBooster:
model_file : str, pathlib.Path or None, optional (default=None) model_file : str, pathlib.Path or None, optional (default=None)
Path to the CVBooster model file. Path to the CVBooster model file.
""" """
self.boosters = [] self.boosters: List[Booster] = []
self.best_iteration = -1 self.best_iteration = -1
if model_file is not None: if model_file is not None:
......
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