Skip to content

Commit ddcf052

Browse files
committed
Add typing information
1 parent 80409af commit ddcf052

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

pandas/core/groupby/base.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
hold the whitelist of methods that are exposed on the
44
SeriesGroupBy and the DataFrameGroupBy objects.
55
"""
6+
from typing import TYPE_CHECKING, FrozenSet, Iterator, Type, Union
7+
68
from pandas.core.dtypes.common import is_list_like, is_scalar
79

10+
if TYPE_CHECKING:
11+
from pandas import DataFrame, Series
12+
from .groupby import GroupBy
13+
814

915
class GroupByMixin:
1016
"""
@@ -88,19 +94,21 @@ def _gotitem(self, key, ndim, subset=None):
8894
'idxmax'])
8995

9096

91-
def whitelist_method_generator(base, klass, whitelist):
97+
def whitelist_method_generator(base: 'Type[GroupBy]',
98+
klass: 'Union[Type[DataFrame], Type[Series]]',
99+
whitelist: FrozenSet[str],
100+
) -> Iterator[str]:
92101
"""
93102
Yields all GroupBy member defs for DataFrame/Series names in whitelist.
94103
95104
Parameters
96105
----------
97-
base : class
106+
base : Groupby class
98107
base class
99-
klass : class
108+
klass : DataFrame or Series class
100109
class where members are defined.
101-
Should be Series or DataFrame
102-
whitelist : list
103-
list of names of klass methods to be constructed
110+
whitelist : frozenset
111+
Set of names of klass methods to be constructed
104112
105113
Returns
106114
-------

0 commit comments

Comments
 (0)