-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
TYPING: check-untyped-defs for io.formats #28129
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
Changes from 1 commit
31b3c32
50e2678
5f38ee9
865e860
5120925
0e10726
9674c00
b9ed0c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,11 +28,9 @@ | |
from pandas.core.generic import _shared_docs | ||
from pandas.core.indexing import _IndexSlice, _maybe_numeric_slice, _non_reducing_slice | ||
|
||
ApplyArgs = Tuple[Callable[[FrameOrSeries], FrameOrSeries], Axis, Optional[_IndexSlice]] | ||
Kwargs = Dict[str, Any] | ||
|
||
jinja2 = import_optional_dependency("jinja2", extra="DataFrame.style requires jinja2.") | ||
|
||
|
||
try: | ||
import matplotlib.pyplot as plt | ||
from matplotlib import colors | ||
|
@@ -51,6 +49,12 @@ def _mpl(func): | |
raise ImportError(no_mpl_message.format(func.__name__)) | ||
|
||
|
||
_ApplyArgs = Tuple[ | ||
Callable[[FrameOrSeries], FrameOrSeries], Axis, Optional[_IndexSlice] | ||
] | ||
_Kwargs = Dict[str, Any] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should create this for Args and Kwargs. Doesn't PEP 484 have a different way of handling anyway? https://www.python.org/dev/peps/pep-0484/#arbitrary-argument-lists-and-default-argument-values There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Kwargs alias is not for annotating kwargs in function signiture. The kwargs dict is stored in a local variable. I appreciate this could be confusing. It was to make i'll inline _Kwargs to avoid this confusion. |
||
|
||
|
||
class Styler: | ||
""" | ||
Helps style a DataFrame or Series according to the data with HTML and CSS. | ||
|
@@ -127,7 +131,7 @@ def __init__( | |
cell_ids=True, | ||
): | ||
self.ctx = defaultdict(list) # type: DefaultDict[Tuple[int, int], List[str]] | ||
self._todo = [] # type: List[Tuple[Callable, ApplyArgs, Kwargs]] | ||
self._todo = [] # type: List[Tuple[Callable, _ApplyArgs, _Kwargs]] | ||
|
||
if not isinstance(data, (pd.Series, pd.DataFrame)): | ||
raise TypeError("``data`` must be a Series or DataFrame") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is a function of the code itself and not necessarily the annotation, but I find this pretty tough to digest. Is it documented already somewhere how this works? If not can you comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not in this pass. I don't know this module well enough yet.
This pass is just check-untyped-defs as "Working through this flag in advance may lead to less surprises as annotations are added" xref #27568
Also the sooner we resolve these issues, the sooner we can enable this setting in CI to ensure that code modified in functions without annotations is checked for PRs.