MCPcopy Index your code
hub / github.com/dask/dask / _is_getter_task

Function _is_getter_task

dask/array/optimization.py:68–91  ·  view source on GitHub ↗

Check if a value in a Dask graph looks like a getter. 1. Is it a tuple with the first element a known getter. If a getter is found, it returns a tuple with (getter, array, index, asarray, lock). Otherwise it returns ``None``.

(
    value: GraphNode,
)

Source from the content-addressed store, hash-verified

66
67
68def _is_getter_task(
69 value: GraphNode,
70) -> tuple[Callable, Any, Any, bool, bool | None] | None:
71 """Check if a value in a Dask graph looks like a getter.
72 1. Is it a tuple with the first element a known getter.
73 If a getter is found, it returns a tuple with (getter, array, index, asarray, lock).
74 Otherwise it returns ``None``.
75 """
76 if not isinstance(value, Task):
77 return None
78 func = value.func
79 if func in GETTERS:
80 get = func
81 else:
82 return None
83
84 length = len(value.args)
85 if length == 2:
86 # getter defaults to asarray=True, getitem is semantically False
87 return get, value.args[0], value.args[1], get is not getitem, None
88 elif length == 4:
89 return get, *list(value.args)
90
91 return None
92
93
94def _optimize_slices(dsk):

Callers 1

_optimize_slicesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…