Skip to content

Commit 0a1f6d6

Browse files
check_untyped_defs pandas.core.groupby.ops
1 parent 3cc93f0 commit 0a1f6d6

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

pandas/core/groupby/ops.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88

99
import collections
10+
from typing import Any, Dict, List, Type, Union
1011

1112
import numpy as np
1213

@@ -285,8 +286,8 @@ def groups(self):
285286
if len(self.groupings) == 1:
286287
return self.groupings[0].groups
287288
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_)
290291
return self.axis.groupby(to_groupby)
291292

292293
@cache_readonly
@@ -436,8 +437,10 @@ def get_func(fname):
436437
f = ftype.get("f")
437438
if f is not None:
438439

440+
# https://github.com/python/mypy/issues/2608
441+
# error: "None" not callable
439442
def wrapper(*args, **kwargs):
440-
return f(afunc, *args, **kwargs)
443+
return f(afunc, *args, **kwargs) # type: ignore
441444

442445
# need to curry our sub-function
443446
func = wrapper
@@ -782,7 +785,7 @@ def get_iterator(self, data, axis=0):
782785

783786
@cache_readonly
784787
def indices(self):
785-
indices = collections.defaultdict(list)
788+
indices: Dict[Any, List] = collections.defaultdict(list)
786789

787790
i = 0
788791
for label, bin in zip(self.binlabels, self.bins):
@@ -929,7 +932,8 @@ def _chop(self, sdata, slice_obj):
929932
return sdata._slice(slice_obj, axis=1)
930933

931934

932-
def get_splitter(data, *args, **kwargs):
935+
def get_splitter(data: Union[Series, DataFrame], *args, **kwargs) -> DataSplitter:
936+
klass: Type[DataSplitter]
933937
if isinstance(data, Series):
934938
klass = SeriesSplitter
935939
elif isinstance(data, DataFrame):

setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ check_untyped_defs=False
206206
[mypy-pandas.core.groupby.groupby]
207207
check_untyped_defs=False
208208

209-
[mypy-pandas.core.groupby.ops]
210-
check_untyped_defs=False
211-
212209
[mypy-pandas.core.indexes.datetimes]
213210
check_untyped_defs=False
214211

0 commit comments

Comments
 (0)