* Fix pylint errors. (#7967) * Rebase error.
This commit is contained in:
parent
5973c6e74e
commit
a55d3bdde2
@ -97,7 +97,7 @@ class BuildExt(build_ext.build_ext): # pylint: disable=too-many-ancestors
|
|||||||
|
|
||||||
logger = logging.getLogger('XGBoost build_ext')
|
logger = logging.getLogger('XGBoost build_ext')
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments,no-self-use
|
# pylint: disable=too-many-arguments
|
||||||
def build(
|
def build(
|
||||||
self,
|
self,
|
||||||
src_dir: str,
|
src_dir: str,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
# pylint: disable=invalid-name, too-many-statements, no-self-use
|
# pylint: disable=invalid-name, too-many-statements
|
||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
"""Callback library containing training routines. See :doc:`Callback Functions
|
"""Callback library containing training routines. See :doc:`Callback Functions
|
||||||
</python/callbacks>` for a quick introduction.
|
</python/callbacks>` for a quick introduction.
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
"""Core XGBoost Library."""
|
"""Core XGBoost Library."""
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
|
import copy
|
||||||
from typing import List, Optional, Any, Union, Dict, TypeVar
|
from typing import List, Optional, Any, Union, Dict, TypeVar
|
||||||
from typing import Callable, Tuple, cast, Sequence, Type, Iterable
|
from typing import Callable, Tuple, cast, Sequence, Type, Iterable
|
||||||
import ctypes
|
import ctypes
|
||||||
@ -1577,7 +1578,7 @@ class Booster:
|
|||||||
booster: `Booster`
|
booster: `Booster`
|
||||||
a copied booster model
|
a copied booster model
|
||||||
"""
|
"""
|
||||||
return self.__copy__()
|
return copy.copy(self)
|
||||||
|
|
||||||
def attr(self, key: str) -> Optional[str]:
|
def attr(self, key: str) -> Optional[str]:
|
||||||
"""Get attribute string from the Booster.
|
"""Get attribute string from the Booster.
|
||||||
@ -2309,15 +2310,15 @@ class Booster:
|
|||||||
ret = self.get_dump(fmap, with_stats, dump_format)
|
ret = self.get_dump(fmap, with_stats, dump_format)
|
||||||
if dump_format == 'json':
|
if dump_format == 'json':
|
||||||
fout_obj.write('[\n')
|
fout_obj.write('[\n')
|
||||||
for i, _ in enumerate(ret):
|
for i, val in enumerate(ret):
|
||||||
fout_obj.write(ret[i])
|
fout_obj.write(val)
|
||||||
if i < len(ret) - 1:
|
if i < len(ret) - 1:
|
||||||
fout_obj.write(",\n")
|
fout_obj.write(",\n")
|
||||||
fout_obj.write('\n]')
|
fout_obj.write('\n]')
|
||||||
else:
|
else:
|
||||||
for i, _ in enumerate(ret):
|
for i, val in enumerate(ret):
|
||||||
fout_obj.write(f"booster[{i}]:\n")
|
fout_obj.write(f"booster[{i}]:\n")
|
||||||
fout_obj.write(ret[i])
|
fout_obj.write(val)
|
||||||
if need_close:
|
if need_close:
|
||||||
fout_obj.close()
|
fout_obj.close()
|
||||||
|
|
||||||
@ -2604,8 +2605,8 @@ class Booster:
|
|||||||
values = []
|
values = []
|
||||||
# pylint: disable=consider-using-f-string
|
# pylint: disable=consider-using-f-string
|
||||||
regexp = re.compile(r"\[{0}<([\d.Ee+-]+)\]".format(feature))
|
regexp = re.compile(r"\[{0}<([\d.Ee+-]+)\]".format(feature))
|
||||||
for i, _ in enumerate(xgdump):
|
for i, val in enumerate(xgdump):
|
||||||
m = re.findall(regexp, xgdump[i])
|
m = re.findall(regexp, val)
|
||||||
values.extend([float(x) for x in m])
|
values.extend([float(x) for x in m])
|
||||||
|
|
||||||
n_unique = len(np.unique(values))
|
n_unique = len(np.unique(values))
|
||||||
|
|||||||
@ -1721,7 +1721,7 @@ class DaskScikitLearnBase(XGBModel):
|
|||||||
"""Implementation of the Scikit-Learn API for XGBoost.""", ["estimators", "model"]
|
"""Implementation of the Scikit-Learn API for XGBoost.""", ["estimators", "model"]
|
||||||
)
|
)
|
||||||
class DaskXGBRegressor(DaskScikitLearnBase, XGBRegressorBase):
|
class DaskXGBRegressor(DaskScikitLearnBase, XGBRegressorBase):
|
||||||
# pylint: disable=missing-class-docstring
|
"""dummy doc string to workaround pylint, replaced by the decorator."""
|
||||||
async def _fit_async(
|
async def _fit_async(
|
||||||
self,
|
self,
|
||||||
X: _DaskCollection,
|
X: _DaskCollection,
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
# pylint: disable=too-many-return-statements, import-error
|
# pylint: disable=too-many-return-statements, import-error
|
||||||
'''Data dispatching for DMatrix.'''
|
'''Data dispatching for DMatrix.'''
|
||||||
import ctypes
|
import ctypes
|
||||||
from distutils import version
|
|
||||||
import json
|
import json
|
||||||
import warnings
|
import warnings
|
||||||
import os
|
import os
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user