Skip to content

Commit 1ba4965

Browse files
authored
Handle Index without arguments, subclassing DataFrame and register accessor arguments (#1091)
* maybe keep these * keep PandasDelegate
1 parent dc636d8 commit 1ba4965

File tree

6 files changed

+189
-176
lines changed

6 files changed

+189
-176
lines changed

pandas-stubs/_typing.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ T = TypeVar("T")
464464
P = ParamSpec("P")
465465
FuncType: TypeAlias = Callable[..., Any]
466466
F = TypeVar("F", bound=FuncType)
467+
TypeT = TypeVar("TypeT", bound=type)
467468
HashableT = TypeVar("HashableT", bound=Hashable)
468469
HashableT1 = TypeVar("HashableT1", bound=Hashable)
469470
HashableT2 = TypeVar("HashableT2", bound=Hashable)

pandas-stubs/core/accessor.pyi

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
from typing import Any
1+
from typing import Callable
22

3-
class PandasDelegate: ...
4-
5-
def delegate_names(
6-
delegate: Any, accessors: Any, typ: str, overwrite: bool = ...
7-
) -> Any: ...
3+
from pandas._typing import TypeT
84

9-
class CachedAccessor:
10-
def __init__(self, name: str, accessor: Any) -> None: ...
11-
def __get__(self, obj: Any, cls: Any): ...
5+
class PandasDelegate: ...
126

13-
def register_dataframe_accessor(name: Any): ...
14-
def register_series_accessor(name: Any): ...
15-
def register_index_accessor(name: Any): ...
7+
def register_dataframe_accessor(name: str) -> Callable[[TypeT], TypeT]: ...
8+
def register_series_accessor(name: str) -> Callable[[TypeT], TypeT]: ...
9+
def register_index_accessor(name: str) -> Callable[[TypeT], TypeT]: ...

0 commit comments

Comments
 (0)