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

Method _from_collection

dask/highlevelgraph.py:451–467  ·  view source on GitHub ↗

`from_collections` optimized for a single collection

(cls, name, layer, collection)

Source from the content-addressed store, hash-verified

449
450 @classmethod
451 def _from_collection(cls, name, layer, collection):
452 """`from_collections` optimized for a single collection"""
453 if not is_dask_collection(collection):
454 raise TypeError(type(collection))
455
456 graph = collection.__dask_graph__()
457 if isinstance(graph, HighLevelGraph):
458 layers = ensure_dict(graph.layers, copy=True)
459 layers[name] = layer
460 deps = ensure_dict(graph.dependencies, copy=True)
461 deps[name] = set(collection.__dask_layers__())
462 else:
463 key = _get_some_layer_name(collection)
464 layers = {name: layer, key: graph}
465 deps = {name: {key}, key: set()}
466
467 return cls(layers, deps)
468
469 @classmethod
470 def from_collections(

Callers 1

from_collectionsMethod · 0.80

Calls 6

is_dask_collectionFunction · 0.90
ensure_dictFunction · 0.90
setClass · 0.85
_get_some_layer_nameFunction · 0.85
__dask_graph__Method · 0.45
__dask_layers__Method · 0.45

Tested by

no test coverage detected