MCPcopy Create free account
hub / github.com/dask/dask / istask

Function istask

dask/core.py:40–58  ·  view source on GitHub ↗

Is x a runnable task? A task is a tuple with a callable first argument Examples -------- >>> inc = lambda x: x + 1 >>> istask((inc, 1)) True >>> istask(1) False

(x)

Source from the content-addressed store, hash-verified

38
39
40def istask(x):
41 """Is x a runnable task?
42
43 A task is a tuple with a callable first argument
44
45 Examples
46 --------
47
48 >>> inc = lambda x: x + 1
49 >>> istask((inc, 1))
50 True
51 >>> istask(1)
52 False
53 """
54 from dask._task_spec import DataNode, GraphNode
55
56 if isinstance(x, GraphNode):
57 return not isinstance(x, DataNode)
58 return type(x) is tuple and x and callable(x[0])
59
60
61def preorder_traversal(task):

Callers 15

headFunction · 0.90
argsFunction · 0.90
_bottom_upFunction · 0.90
has_sub_tasksFunction · 0.90
to_graphvizFunction · 0.90
_to_cytoscape_jsonFunction · 0.90
orderFunction · 0.90
inlineFunction · 0.90
inlinableFunction · 0.90
functions_ofFunction · 0.90
lazify_taskFunction · 0.90
unquoteFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_istaskFunction · 0.72