Skip to content

Commit

Permalink
try lawrences fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzamora committed Apr 3, 2024
1 parent baaaa03 commit b6b01ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 9 additions & 1 deletion dask/dataframe/accessor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import functools
import warnings

import numpy as np
Expand Down Expand Up @@ -28,8 +29,15 @@ def func(self):

func.__name__ = attr
func.__qualname__ = f"{cls.__name__}.{attr}"
original_prop = getattr(pd_cls, attr)
if isinstance(original_prop, property):
method = original_prop.fget
elif isinstance(original_prop, functools.cached_property):
method = original_prop.func
else:
raise TypeError("bind_property expects original class to provide a property")
try:
func.__wrapped__ = getattr(pd_cls, attr)
func.__wrapped__ = method
except Exception:
pass
setattr(cls, attr, property(derived_from(pd_cls, version=min_version)(func)))
Expand Down
3 changes: 1 addition & 2 deletions dask/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,7 @@ def _derived_from(
method_args = get_named_args(method)
original_args = get_named_args(original_method)
not_supported = [m for m in original_args if m not in method_args]
except (TypeError, ValueError):
# Python 3.11.9 returns TypeError when method is a property
except ValueError:
not_supported = []
if len(ua_args) > 0:
not_supported.extend(ua_args)
Expand Down

0 comments on commit b6b01ad

Please sign in to comment.