Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Chengyang Gu committed Apr 11, 2022
1 parent c240767 commit 25aa2ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions python-package/xgboost/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
_Score = Union[float, Tuple[float, float]]
_ScoreList = Union[List[float], List[Tuple[float, float]]]

# TODO: A model can be either a booster or a cvpack
_Model = Any # real type is Union[Booster, CVPack]
_Model = Any # real type is Union[Booster, CVPack]; need more work


# pylint: disable=unused-argument
Expand Down
8 changes: 4 additions & 4 deletions python-package/xgboost/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .sklearn import XGBModel

Axes = Any # real type is matplotlib.axes.Axes
Source = Any # real type is graphviz.Source
GraphvizSource = Any # real type is graphviz.Source


def plot_importance(booster: Booster, ax: Optional[Axes] = None, height: float = 0.2,
Expand Down Expand Up @@ -86,9 +86,9 @@ def plot_importance(booster: Booster, ax: Optional[Axes] = None, height: float =
tuples = [(k, importance[k]) for k in importance]
if max_num_features is not None:
# pylint: disable=invalid-unary-operand-type
tuples = sorted(tuples, key=lambda x: x[1])[-max_num_features:]
tuples = sorted(tuples, key=lambda _x: _x[1])[-max_num_features:]
else:
tuples = sorted(tuples, key=lambda x: x[1])
tuples = sorted(tuples, key=lambda _x: _x[1])
labels, values = zip(*tuples)

if ax is None:
Expand Down Expand Up @@ -132,7 +132,7 @@ def to_graphviz(booster: Booster, fmap: PathLike = '', num_trees: int = 0,
rankdir: Optional[str] = None,
yes_color: Optional[str] = None, no_color: Optional[str] = None,
condition_node_params: Optional[dict] = None,
leaf_node_params: Optional[dict] = None, **kwargs: Any) -> Source:
leaf_node_params: Optional[dict] = None, **kwargs: Any) -> GraphvizSource:
"""Convert specified tree to graphviz instance. IPython can automatically plot
the returned graphiz instance. Otherwise, you should call .render() method
of the returned graphiz instance.
Expand Down

0 comments on commit 25aa2ed

Please sign in to comment.