Skip to content

Commit b6b01ad

Browse files
committed
try lawrences fix
1 parent baaaa03 commit b6b01ad

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

dask/dataframe/accessor.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import functools
34
import warnings
45

56
import numpy as np
@@ -28,8 +29,15 @@ def func(self):
2829

2930
func.__name__ = attr
3031
func.__qualname__ = f"{cls.__name__}.{attr}"
32+
original_prop = getattr(pd_cls, attr)
33+
if isinstance(original_prop, property):
34+
method = original_prop.fget
35+
elif isinstance(original_prop, functools.cached_property):
36+
method = original_prop.func
37+
else:
38+
raise TypeError("bind_property expects original class to provide a property")
3139
try:
32-
func.__wrapped__ = getattr(pd_cls, attr)
40+
func.__wrapped__ = method
3341
except Exception:
3442
pass
3543
setattr(cls, attr, property(derived_from(pd_cls, version=min_version)(func)))

dask/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,7 @@ def _derived_from(
940940
method_args = get_named_args(method)
941941
original_args = get_named_args(original_method)
942942
not_supported = [m for m in original_args if m not in method_args]
943-
except (TypeError, ValueError):
944-
# Python 3.11.9 returns TypeError when method is a property
943+
except ValueError:
945944
not_supported = []
946945
if len(ua_args) > 0:
947946
not_supported.extend(ua_args)

0 commit comments

Comments
 (0)