@@ -8,7 +8,6 @@ from typing import (
88 Any ,
99 Concatenate ,
1010 Literal ,
11- Protocol ,
1211 Self ,
1312 overload ,
1413)
@@ -52,26 +51,6 @@ from pandas.io.formats.style_render import (
5251 Subset ,
5352)
5453
55- class _SeriesFunc (Protocol ):
56- def __call__ (
57- self , series : Series , / , * args : Any , ** kwargs : Any
58- ) -> list [Any ] | Series : ...
59-
60- class _SeriesStrFunc (Protocol ):
61- def __call__ (
62- self , series : Series [str ], / , * args : Any , ** kwargs : Any
63- ) -> list [str ] | Series [str ]: ...
64-
65- class _DataFrameFunc (Protocol ):
66- def __call__ (
67- self , series : DataFrame , / , * args : Any , ** kwargs : Any
68- ) -> np_ndarray | DataFrame : ...
69-
70- class _MapCallable (Protocol ):
71- def __call__ (
72- self , first_arg : Scalar , / , * args : Any , ** kwargs : Any
73- ) -> str | None : ...
74-
7554class Styler (StylerRenderer ):
7655 def __init__ (
7756 self ,
@@ -90,16 +69,12 @@ class Styler(StylerRenderer):
9069 formatter : ExtFormatter | None = ...,
9170 ) -> None : ...
9271 def concat (self , other : Styler ) -> Styler : ...
93- @overload
94- def map (
95- self ,
96- func : Callable [[Scalar ], str | None ],
97- subset : Subset [Hashable ] | None = ...,
98- ) -> Styler : ...
99- @overload
10072 def map (
10173 self ,
102- func : _MapCallable ,
74+ func : (
75+ Callable [[Scalar ], str | None ]
76+ | Callable [Concatenate [Scalar , ...], str | None ]
77+ ),
10378 subset : Subset [Hashable ] | None = ...,
10479 ** kwargs : Any ,
10580 ) -> Styler : ...
@@ -267,32 +242,43 @@ class Styler(StylerRenderer):
267242 @overload
268243 def apply (
269244 self ,
270- func : _SeriesFunc | Callable [[Series ], list [Any ] | Series ],
245+ func : (
246+ Callable [[Series ], list [Any ] | Series ]
247+ | Callable [Concatenate [Series , ...], list [Any ] | Series ]
248+ ),
271249 axis : Axis = ...,
272250 subset : Subset [Hashable ] | None = ...,
273251 ** kwargs : Any ,
274252 ) -> Styler : ...
275253 @overload
276254 def apply (
277255 self ,
278- func : _DataFrameFunc | Callable [[DataFrame ], np_ndarray | DataFrame ],
256+ func : (
257+ Callable [[DataFrame ], np_ndarray | DataFrame ]
258+ | Callable [Concatenate [DataFrame , ...], np_ndarray | DataFrame ]
259+ ),
279260 axis : None ,
280261 subset : Subset [Hashable ] | None = ...,
281262 ** kwargs : Any ,
282263 ) -> Styler : ...
283264 def apply_index (
284265 self ,
285266 func : (
286- _SeriesStrFunc
287- | Callable [[Series ], list [str ] | np_ndarray_str | Series [str ]]
267+ Callable [[Series ], list [str ] | np_ndarray_str | Series [str ]]
268+ | Callable [
269+ Concatenate [Series , ...], list [str ] | np_ndarray_str | Series [str ]
270+ ]
288271 ),
289272 axis : Axis = ...,
290273 level : Level | list [Level ] | None = ...,
291274 ** kwargs : Any ,
292275 ) -> Styler : ...
293276 def map_index (
294277 self ,
295- func : _MapCallable | Callable [[Scalar ], str | None ],
278+ func : (
279+ Callable [[Scalar ], str | None ]
280+ | Callable [Concatenate [Scalar , ...], str | None ]
281+ ),
296282 axis : Axis = ...,
297283 level : Level | list [Level ] | None = ...,
298284 ** kwargs : Any ,
0 commit comments