Helper class to wrap backend data The primary purpose of this class is to provide caching outside the ``FromPandas`` class.
| 113 | |
| 114 | |
| 115 | class _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) |
no outgoing calls
no test coverage detected