MCPcopy
hub / github.com/dask/dask / _parse_wrap_args

Function _parse_wrap_args

dask/array/wrap.py:18–45  ·  view source on GitHub ↗
(func, args, kwargs, shape)

Source from the content-addressed store, hash-verified

16
17
18def _parse_wrap_args(func, args, kwargs, shape):
19 if isinstance(shape, np.ndarray):
20 shape = shape.tolist()
21
22 if not isinstance(shape, (tuple, list)):
23 shape = (shape,)
24
25 name = kwargs.pop("name", None)
26 chunks = kwargs.pop("chunks", "auto")
27
28 dtype = kwargs.pop("dtype", None)
29 if dtype is None:
30 dtype = func(shape, *args, **kwargs).dtype
31 dtype = np.dtype(dtype)
32
33 chunks = normalize_chunks(chunks, shape, dtype=dtype)
34
35 name = name or funcname(func) + "-" + tokenize(
36 func, shape, chunks, dtype, args, kwargs
37 )
38
39 return {
40 "shape": shape,
41 "dtype": dtype,
42 "kwargs": kwargs,
43 "chunks": chunks,
44 "name": name,
45 }
46
47
48def wrap_func_shape_as_first_arg(func, *args, **kwargs):

Callers 3

wrap_func_likeFunction · 0.85

Calls 6

normalize_chunksFunction · 0.90
funcnameFunction · 0.90
popMethod · 0.80
funcFunction · 0.70
tokenizeFunction · 0.50
dtypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…