MCPcopy Index your code
hub / github.com/pydata/xarray / InaccessibleVariableDataStore

Class InaccessibleVariableDataStore

xarray/tests/test_dataset.py:214–236  ·  view source on GitHub ↗

Store that does not allow any data access.

Source from the content-addressed store, hash-verified

212
213
214class InaccessibleVariableDataStore(backends.InMemoryDataStore):
215 """
216 Store that does not allow any data access.
217 """
218
219 def __init__(self):
220 super().__init__()
221 self._indexvars = set()
222
223 def store(self, variables, *args, **kwargs) -> None:
224 super().store(variables, *args, **kwargs)
225 for k, v in variables.items():
226 if isinstance(v, IndexVariable):
227 self._indexvars.add(k)
228
229 def get_variables(self):
230 def lazy_inaccessible(k, v):
231 if k in self._indexvars:
232 return v
233 data = indexing.LazilyIndexedArray(InaccessibleArray(v.values))
234 return Variable(v.dims, data, v.attrs)
235
236 return {k: lazy_inaccessible(k, v) for k, v in self._variables.items()}
237
238
239class DuckBackendArrayWrapper(backends.common.BackendArray):

Callers 3

test_dask_is_lazyMethod · 0.85
test_lazy_loadMethod · 0.85

Calls

no outgoing calls

Tested by 3

test_dask_is_lazyMethod · 0.68
test_lazy_loadMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…