Skip to content

Commit bef8a80

Browse files
committed
add typehint
1 parent bf31b35 commit bef8a80

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pandas/core/groupby/generic.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
TYPE_CHECKING,
1818
Any,
1919
Literal,
20+
Self,
2021
TypeAlias,
2122
TypeVar,
2223
cast,
@@ -120,15 +121,21 @@ class NamedAgg:
120121
class NamedAgg(tuple):
121122
__slots__ = ()
122123

123-
def __new__(cls, column, aggfunc, *args, **kwargs):
124+
def __new__(
125+
cls,
126+
column: Hashable,
127+
aggfunc: Callable[..., Any] | str,
128+
*args: Any,
129+
**kwargs: Any,
130+
) -> Self:
124131
if (
125132
callable(aggfunc)
126133
and not getattr(aggfunc, "_is_wrapped", False)
127134
and (args or kwargs)
128135
):
129136
original_func = aggfunc
130137

131-
def wrapped(*call_args, **call_kwargs):
138+
def wrapped(*call_args: Any, **call_kwargs: Any) -> Any:
132139
series = call_args[0]
133140
final_args = call_args[1:] + args
134141
final_kwargs = {**kwargs, **call_kwargs}

0 commit comments

Comments
 (0)