Skip to content

Commit abfbcbb

Browse files
committed
add typehint
1 parent a52f97c commit abfbcbb

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
@@ -16,6 +16,7 @@
1616
TYPE_CHECKING,
1717
Any,
1818
Literal,
19+
Self,
1920
TypeAlias,
2021
TypeVar,
2122
cast,
@@ -115,15 +116,21 @@
115116
class NamedAgg(tuple):
116117
__slots__ = ()
117118

118-
def __new__(cls, column, aggfunc, *args, **kwargs):
119+
def __new__(
120+
cls,
121+
column: Hashable,
122+
aggfunc: Callable[..., Any] | str,
123+
*args: Any,
124+
**kwargs: Any,
125+
) -> Self:
119126
if (
120127
callable(aggfunc)
121128
and not getattr(aggfunc, "_is_wrapped", False)
122129
and (args or kwargs)
123130
):
124131
original_func = aggfunc
125132

126-
def wrapped(*call_args, **call_kwargs):
133+
def wrapped(*call_args: Any, **call_kwargs: Any) -> Any:
127134
series = call_args[0]
128135
final_args = call_args[1:] + args
129136
final_kwargs = {**kwargs, **call_kwargs}

0 commit comments

Comments
 (0)