Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#26020 Fixed type annotations for pandas.plotting._core #26021

Merged
merged 3 commits into from
Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,17 @@ ignore_errors=True
[mypy-pandas.io.stata]
ignore_errors=True

<<<<<<< HEAD
[mypy-pandas.tseries.frequencies]
ignore_errors=True

[mypy-pandas.tseries.holiday]
ignore_errors=True

[mypy-pandas.tseries.offsets]
=======
[mypy-pandas.plotting._core]
>>>>>>> origin/master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge conflict vestiges?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Changed IDEs, forgot to turn on autosave.

ignore_errors=True

[mypy-pandas.util._doctools]
Expand Down
6 changes: 4 additions & 2 deletions pandas/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# pylint: disable=E1101
from collections import namedtuple
import re
from typing import List, Optional, Type
import warnings

import numpy as np
Expand Down Expand Up @@ -78,7 +79,7 @@ def _kind(self):

_layout_type = 'vertical'
_default_rot = 0
orientation = None
orientation = None # type: Optional[str]
_pop_attributes = ['label', 'style', 'logy', 'logx', 'loglog',
'mark_right', 'stacked']
_attr_defaults = {'logy': False, 'logx': False, 'loglog': False,
Expand Down Expand Up @@ -1723,7 +1724,8 @@ def result(self):
_all_kinds = _common_kinds + _dataframe_kinds + _series_kinds

_klasses = [LinePlot, BarPlot, BarhPlot, KdePlot, HistPlot, BoxPlot,
ScatterPlot, HexBinPlot, AreaPlot, PiePlot]
ScatterPlot, HexBinPlot, AreaPlot, PiePlot] \
# type: List[Type[MPLPlot]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just be List[MPLPlot] I think - does that give you some kind of error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, _klasses contains the classes/types themselves, not instances of those types, so using List[MPLPlot] errors out with lines like error: List item 0 has incompatible type "Type[LinePlot]"; expected "MPLPlot".


_plot_klass = {klass._kind: klass for klass in _klasses}

Expand Down