1
1
from typing import (
2
2
Any ,
3
3
Callable ,
4
+ Literal ,
4
5
Optional ,
5
6
Sequence ,
6
7
TypedDict ,
@@ -10,9 +11,12 @@ from typing import (
10
11
import jinja2
11
12
from pandas import Index
12
13
13
- from pandas ._typing import Level
14
+ from pandas ._typing import (
15
+ HashableT ,
16
+ Level ,
17
+ )
14
18
15
- BaseFormatter = Union [str , Callable ]
19
+ BaseFormatter = Union [str , Callable [[ object ], str ] ]
16
20
ExtFormatter = Union [BaseFormatter , dict [Any , Optional [BaseFormatter ]]]
17
21
CSSPair = tuple [str , Union [str , float ]]
18
22
CSSList = list [CSSPair ]
@@ -23,7 +27,7 @@ class CSSDict(TypedDict):
23
27
props : CSSProperties
24
28
25
29
CSSStyles = list [CSSDict ]
26
- Subset = Union [slice , Sequence , Index ]
30
+ Subset = Union [slice , list [ HashableT ] , Index ]
27
31
28
32
class StylerRenderer :
29
33
loader : jinja2 .loaders .BaseLoader
@@ -41,17 +45,17 @@ class StylerRenderer:
41
45
decimal : str = ...,
42
46
thousands : str | None = ...,
43
47
escape : str | None = ...,
44
- hyperlinks : str | None = ...,
48
+ hyperlinks : Literal [ "html" , "latex" ] | None = ...,
45
49
) -> StylerRenderer : ...
46
50
def format_index (
47
51
self ,
48
52
formatter : ExtFormatter | None = ...,
49
- axis : int | str = ...,
53
+ axis : int | Literal [ "index" , "columns" ] = ...,
50
54
level : Level | list [Level ] | None = ...,
51
55
na_rep : str | None = ...,
52
56
precision : int | None = ...,
53
57
decimal : str = ...,
54
58
thousands : str | None = ...,
55
59
escape : str | None = ...,
56
- hyperlinks : str | None = ...,
60
+ hyperlinks : Literal [ "html" , "latex" ] | None = ...,
57
61
) -> StylerRenderer : ...
0 commit comments