MCPcopy
hub / github.com/pydata/xarray / f

Function f

xarray/core/duck_array_ops.py:93–107  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

91 """Create a function that dispatches to dask for dask array inputs."""
92
93 def f(*args, **kwargs):
94 if dask_available and any(is_duck_dask_array(a) for a in args):
95 mod = (
96 import_module(dask_module)
97 if isinstance(dask_module, str)
98 else dask_module
99 )
100 wrapped = getattr(mod, name)
101 for kwarg in numpy_only_kwargs:
102 kwargs.pop(kwarg, None)
103 else:
104 wrapped = getattr(eager_module, name)
105 for kwarg in dask_only_kwargs:
106 kwargs.pop(kwarg, None)
107 return wrapped(*args, **kwargs)
108
109 return f
110

Callers

nothing calls this directly

Calls 5

is_duck_dask_arrayFunction · 0.90
get_array_namespaceFunction · 0.90
asarrayFunction · 0.85
astypeFunction · 0.70
funcFunction · 0.50

Tested by

no test coverage detected