(func, args, kwargs, shape)
| 16 | |
| 17 | |
| 18 | def _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 | |
| 48 | def wrap_func_shape_as_first_arg(func, *args, **kwargs): |
no test coverage detected
searching dependent graphs…