Skip to content

Commit e3467c2

Browse files
committed
Use Self
1 parent 2c211e6 commit e3467c2

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

pandas-stubs/io/formats/style.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ from pandas.io.formats.style_render import (
4040
Subset,
4141
)
4242

43-
class Styler(StylerRenderer[Styler]):
43+
class Styler(StylerRenderer):
4444
def __init__(
4545
self,
4646
data: DataFrame | Series,

pandas-stubs/io/formats/style_render.pyi

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ from collections.abc import (
44
)
55
from typing import (
66
Any,
7-
Generic,
87
Literal,
98
TypedDict,
10-
TypeVar,
119
)
1210

1311
import jinja2
1412
from pandas import Index
1513
from pandas.core.indexing import _IndexSlice
16-
from typing_extensions import TypeAlias
14+
from typing_extensions import (
15+
Self,
16+
TypeAlias,
17+
)
1718

1819
from pandas._typing import (
1920
Axis,
@@ -44,9 +45,7 @@ class StyleExportDict(TypedDict, total=False):
4445
CSSStyles: TypeAlias = list[CSSDict]
4546
Subset: TypeAlias = _IndexSlice | slice | tuple[slice, ...] | list[HashableT] | Index
4647

47-
_StylerT = TypeVar("_StylerT", bound=StylerRenderer)
48-
49-
class StylerRenderer(Generic[_StylerT]):
48+
class StylerRenderer:
5049
loader: jinja2.loaders.PackageLoader
5150
env: jinja2.environment.Environment
5251
template_html: jinja2.environment.Template
@@ -63,7 +62,7 @@ class StylerRenderer(Generic[_StylerT]):
6362
thousands: str | None = ...,
6463
escape: str | None = ...,
6564
hyperlinks: Literal["html", "latex"] | None = ...,
66-
) -> _StylerT: ...
65+
) -> Self: ...
6766
def format_index(
6867
self,
6968
formatter: ExtFormatter | None = ...,
@@ -75,10 +74,10 @@ class StylerRenderer(Generic[_StylerT]):
7574
thousands: str | None = ...,
7675
escape: str | None = ...,
7776
hyperlinks: Literal["html", "latex"] | None = ...,
78-
) -> _StylerT: ...
77+
) -> Self: ...
7978
def relabel_index(
8079
self,
8180
labels: Sequence[str] | Index,
8281
axis: Axis = ...,
8382
level: Level | list[Level] | None = ...,
84-
) -> _StylerT: ...
83+
) -> Self: ...

0 commit comments

Comments
 (0)