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