Skip to content

ENH: Improve Styler typing #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Sep 12, 2022
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: 'Test'

on:
[push, pull_request, workflow_dispatch]

env:
MPLBACKEND: 'Agg'

jobs:
released:
runs-on: ${{ matrix.os }}
Expand Down
11 changes: 11 additions & 0 deletions pandas-stubs/_typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ from typing import (
Optional,
Protocol,
Sequence,
TypedDict,
TypeVar,
Union,
)
Expand Down Expand Up @@ -249,4 +250,14 @@ FileWriteMode = Literal[
]
ColspaceArgType = str | int | Sequence[int | str] | Mapping[Hashable, str | int]

class StyleExportDict(TypedDict, total=False):
apply: Any
table_attributes: Any
table_styles: Any
hide_index: bool
hide_columns: bool
hide_index_names: bool
hide_column_names: bool
css: dict[str, str | int]

__all__ = ["npt", "type_t"]
12 changes: 10 additions & 2 deletions pandas-stubs/core/indexing.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
from typing import (
Generic,
TypeVar,
Union,
)

import numpy as np
from pandas.core.indexes.api import Index

Expand All @@ -7,8 +13,10 @@ from pandas._typing import (
StrLike,
)

class _IndexSlice:
def __getitem__(self, arg) -> tuple[StrLike | Scalar | slice, ...]: ...
_IndexSliceT = TypeVar("_IndexSliceT", bound=Union[StrLike, Scalar, slice])

class _IndexSlice(Generic[_IndexSliceT]):
def __getitem__(self, arg) -> tuple[_IndexSliceT, ...]: ...

IndexSlice: _IndexSlice

Expand Down
Loading