Skip to content

Commit

Permalink
Fix dask.dataframe import error for Python 3.11.9 (dask#11035)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzamora authored and jtilly committed Apr 25, 2024
1 parent 0496681 commit c5857c2
Showing 1 changed file with 9 additions and 1 deletion.
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

0 comments on commit c5857c2

Please sign in to comment.