MCPcopy Create free account
hub / github.com/dask/dask / _BackendData

Class _BackendData

dask/dataframe/dask_expr/_util.py:115–146  ·  view source on GitHub ↗

Helper class to wrap backend data The primary purpose of this class is to provide caching outside the ``FromPandas`` class.

Source from the content-addressed store, hash-verified

113
114
115class _BackendData:
116 """Helper class to wrap backend data
117
118 The primary purpose of this class is to provide
119 caching outside the ``FromPandas`` class.
120 """
121
122 def __init__(self, data):
123 self._data = data
124 self._division_info = LRU(10)
125
126 @functools.cached_property
127 def _token(self):
128 from dask.tokenize import _tokenize_deterministic
129
130 return _tokenize_deterministic(self._data)
131
132 def __len__(self):
133 return len(self._data)
134
135 def __getattr__(self, key: str) -> Any:
136 try:
137 return object.__getattribute__(self, key)
138 except AttributeError:
139 # Return the underlying backend attribute
140 return getattr(self._data, key)
141
142 def __reduce__(self):
143 return type(self), (self._data,)
144
145 def __deepcopy__(self, memodict=None):
146 return type(self)(self._data.copy())
147
148
149@normalize_token.register(_BackendData)

Callers 4

_lowerMethod · 0.90
from_pandasFunction · 0.90
repartitionFunction · 0.90
frameMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected