Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Apr 21, 2019
1 parent 6ffa667 commit 7c4409c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion python-package/xgboost/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def callback(env):
if env.rank != 0 or (not env.evaluation_result_list) or period is False or period == 0:
return
i = env.iteration
if (i % period == 0 or i + 1 == env.begin_iteration or i + 1 == env.end_iteration):
if i % period == 0 or i + 1 == env.begin_iteration or i + 1 == env.end_iteration:
msg = '\t'.join([_fmt_metric(x, show_stdv) for x in env.evaluation_result_list])
rabit.tracker_print('[%d]\t%s\n' % (i, msg))
return callback
Expand Down
4 changes: 2 additions & 2 deletions python-package/xgboost/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def _maybe_pandas_data(data, feature_names, feature_types):
if feature_names is None:
if isinstance(data.columns, MultiIndex):
feature_names = [
' '.join(map(str, i))
' '.join([str(x) for x in i])
for i in data.columns
]
else:
Expand Down Expand Up @@ -1716,7 +1716,7 @@ def get_split_value_histogram(self, feature, fmap='', bins=None, as_pandas=True)
regexp = re.compile(r"\[{0}<([\d.Ee+-]+)\]".format(feature))
for i, _ in enumerate(xgdump):
m = re.findall(regexp, xgdump[i])
values.extend(map(float, m))
values.extend([float(x) for x in m])

n_unique = len(np.unique(values))
bins = max(min(n_unique, bins) if bins is not None else n_unique, 1)
Expand Down
4 changes: 2 additions & 2 deletions python-package/xgboost/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _train_internal(params, dtrain,

# Distributed code: Load the checkpoint from rabit.
version = bst.load_rabit_checkpoint()
assert(rabit.get_world_size() != 1 or version == 0)
assert rabit.get_world_size() != 1 or version == 0
rank = rabit.get_rank()
start_iteration = int(version / 2)
nboost += start_iteration
Expand All @@ -75,7 +75,7 @@ def _train_internal(params, dtrain,
bst.save_rabit_checkpoint()
version += 1

assert(rabit.get_world_size() == 1 or version == rabit.version_number())
assert rabit.get_world_size() == 1 or version == rabit.version_number()

nboost += 1
evaluation_result_list = []
Expand Down
2 changes: 1 addition & 1 deletion tests/travis/setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

if [ ${TASK} == "lint" ]; then
pip3 install --user cpplint 'pylint==1.4.4' 'astroid==1.3.6'
pip3 install --user cpplint 'pylint==1.4.4' 'astroid==1.3.6' numpy scipy
fi


Expand Down

0 comments on commit 7c4409c

Please sign in to comment.