Skip to content

Commit ded0b0d

Browse files
committed
add whatsnew entry && type annotations
1 parent 9962904 commit ded0b0d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Other enhancements
8383
- Improved deprecation message for offset aliases (:issue:`60820`)
8484
- Multiplying two :class:`DateOffset` objects will now raise a ``TypeError`` instead of a ``RecursionError`` (:issue:`59442`)
8585
- Restore support for reading Stata 104-format and enable reading 103-format dta files (:issue:`58554`)
86+
- Support :class:`DataFrame` plugin accessor via entry points (:issue:`29076`)
8687
- Support passing a :class:`Iterable[Hashable]` input to :meth:`DataFrame.drop_duplicates` (:issue:`59237`)
8788
- Support reading Stata 102-format (Stata 1) dta files (:issue:`58978`)
8889
- Support reading Stata 110-format (Stata 7) dta files (:issue:`47176`)

pandas/core/accessor.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import functools
1111
from typing import (
1212
TYPE_CHECKING,
13+
Any,
1314
final,
1415
)
1516
import warnings
@@ -20,12 +21,12 @@
2021
if TYPE_CHECKING:
2122
from collections.abc import Callable
2223

24+
from pandas.core.frame import DataFrame
2325
from pandas._typing import TypeT
2426

2527
from pandas import Index
2628
from pandas.core.generic import NDFrame
2729

28-
2930
from importlib_metadata import entry_points
3031

3132

@@ -401,18 +402,18 @@ def register_index_accessor(name: str) -> Callable[[TypeT], TypeT]:
401402
class DataFrameAccessorLoader:
402403
"""Loader class for registering DataFrame accessors via entry points."""
403404

404-
ENTRY_POINT_GROUP = "pandas_dataframe_accessor"
405+
ENTRY_POINT_GROUP: str = "pandas_dataframe_accessor"
405406

406407
@classmethod
407-
def load(cls):
408+
def load(cls) -> None:
408409
"""loads and registers accessors defined by 'pandas_dataframe_accessor'."""
409410
eps = entry_points(group=cls.ENTRY_POINT_GROUP)
410411

411412
for ep in eps:
412-
name = ep.name
413+
name: str = ep.name
413414

414-
def make_property(ep):
415-
def accessor(self):
415+
def make_property(ep) -> Callable[[DataFrame], Any]:
416+
def accessor(self) -> Any:
416417
cls_ = ep.load()
417418
return cls_(self)
418419

0 commit comments

Comments
 (0)