|
7 | 7 | """
|
8 | 8 |
|
9 | 9 | import collections
|
| 10 | +from typing import Any, Dict, List, Type, Union |
10 | 11 |
|
11 | 12 | import numpy as np
|
12 | 13 |
|
@@ -285,8 +286,8 @@ def groups(self):
|
285 | 286 | if len(self.groupings) == 1:
|
286 | 287 | return self.groupings[0].groups
|
287 | 288 | else:
|
288 |
| - to_groupby = zip(*(ping.grouper for ping in self.groupings)) |
289 |
| - to_groupby = Index(to_groupby) |
| 289 | + to_groupby_ = zip(*(ping.grouper for ping in self.groupings)) |
| 290 | + to_groupby = Index(to_groupby_) |
290 | 291 | return self.axis.groupby(to_groupby)
|
291 | 292 |
|
292 | 293 | @cache_readonly
|
@@ -436,8 +437,10 @@ def get_func(fname):
|
436 | 437 | f = ftype.get("f")
|
437 | 438 | if f is not None:
|
438 | 439 |
|
| 440 | + # https://github.com/python/mypy/issues/2608 |
| 441 | + # error: "None" not callable |
439 | 442 | def wrapper(*args, **kwargs):
|
440 |
| - return f(afunc, *args, **kwargs) |
| 443 | + return f(afunc, *args, **kwargs) # type: ignore |
441 | 444 |
|
442 | 445 | # need to curry our sub-function
|
443 | 446 | func = wrapper
|
@@ -782,7 +785,7 @@ def get_iterator(self, data, axis=0):
|
782 | 785 |
|
783 | 786 | @cache_readonly
|
784 | 787 | def indices(self):
|
785 |
| - indices = collections.defaultdict(list) |
| 788 | + indices: Dict[Any, List] = collections.defaultdict(list) |
786 | 789 |
|
787 | 790 | i = 0
|
788 | 791 | for label, bin in zip(self.binlabels, self.bins):
|
@@ -929,7 +932,8 @@ def _chop(self, sdata, slice_obj):
|
929 | 932 | return sdata._slice(slice_obj, axis=1)
|
930 | 933 |
|
931 | 934 |
|
932 |
| -def get_splitter(data, *args, **kwargs): |
| 935 | +def get_splitter(data: Union[Series, DataFrame], *args, **kwargs) -> DataSplitter: |
| 936 | + klass: Type[DataSplitter] |
933 | 937 | if isinstance(data, Series):
|
934 | 938 | klass = SeriesSplitter
|
935 | 939 | elif isinstance(data, DataFrame):
|
|
0 commit comments