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

Class DataNode

dask/_task_spec.py:566–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564
565
566class DataNode(GraphNode):
567 value: Any
568 typ: type
569 __slots__ = tuple(__annotations__)
570
571 def __init__(self, key: Any, value: Any):
572 if key is None:
573 key = (type(value).__name__, next(_anom_count))
574 self.key = key
575 self.value = value
576 self.typ = type(value)
577 self._dependencies = _no_deps
578
579 @property
580 def data_producer(self) -> bool:
581 return True
582
583 def copy(self):
584 return DataNode(self.key, self.value)
585
586 def __call__(self, values=()):
587 return self.value
588
589 def __repr__(self):
590 return f"DataNode({self.value!r})"
591
592 def __reduce__(self):
593 return (DataNode, (self.key, self.value))
594
595 def __dask_tokenize__(self):
596 from dask.base import tokenize
597
598 return (type(self).__name__, tokenize(self.value))
599
600 def substitute(
601 self, subs: dict[KeyType, KeyType | GraphNode], key: KeyType | None = None
602 ) -> DataNode:
603 if key is not None and key != self.key:
604 return DataNode(key, self.value)
605 return self
606
607 def __iter__(self):
608 return iter(self.value)
609
610
611def _get_dependencies(obj: object) -> set | frozenset:

Callers 15

orderFunction · 0.90
daskMethod · 0.90
_unpackFunction · 0.90
repackFunction · 0.90
_make_blockwise_graphFunction · 0.90
_taskMethod · 0.90
_layer_informationMethod · 0.90
_layer_informationMethod · 0.90
_filtered_taskMethod · 0.90
test_tokenizeFunction · 0.90
test_pickle_literalsFunction · 0.90
test_sizeofFunction · 0.90

Calls

no outgoing calls

Tested by 14

test_tokenizeFunction · 0.72
test_pickle_literalsFunction · 0.72
test_sizeofFunction · 0.72
test_linear_fusionFunction · 0.72
test_block_io_fusionFunction · 0.72
test_data_producerFunction · 0.72
_layerMethod · 0.72