Support pylint 2.7.0 (#6726)

This commit is contained in:
Jiaming Yuan 2021-02-25 12:49:58 +08:00 committed by GitHub
parent 17913713b5
commit c375173dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View File

@ -1119,7 +1119,9 @@ class DeviceQuantileDMatrix(DMatrix):
ctypes.byref(handle),
)
if it.exception is not None:
raise it.exception
# pylint 2.7.0 believes `it.exception` can be None even with `assert
# isinstace`
raise it.exception # pylint: disable=raising-bad-type
# delay check_call to throw intermediate exception first
_check_call(ret)
self.handle = handle
@ -1315,7 +1317,7 @@ class Booster(object):
self.handle,
ctypes.byref(length),
ctypes.byref(json_string)))
json_string = json_string.value.decode() # NOLINT
json_string = json_string.value.decode() # pylint: disable=no-member
return json_string
def load_config(self, config):
@ -1508,7 +1510,7 @@ class Booster(object):
dmats, evnames,
c_bst_ulong(len(evals)),
ctypes.byref(msg)))
res = msg.value.decode() # NOLINT
res = msg.value.decode() # pylint: disable=no-member
if feval is not None:
for dmat, evname in evals:
feval_ret = feval(self.predict(dmat, training=False,

View File

@ -712,7 +712,7 @@ def _create_dmatrix(
T = TypeVar('T')
def concat_or_none(data: Tuple[Optional[T], ...]) -> Optional[T]:
if any([part is None for part in data]):
if any(part is None for part in data):
return None
return concat(data)

View File

@ -293,14 +293,12 @@ def _wrap_evaluation_matrices(
evals = list(zip(evals, eval_names))
else:
if any(
[
meta is not None
for meta in [
sample_weight_eval_set,
base_margin_eval_set,
eval_group,
eval_qid,
]
meta is not None
for meta in [
sample_weight_eval_set,
base_margin_eval_set,
eval_group,
eval_qid,
]
):
raise ValueError(