def from_delayed(values):
 from dask.delayed import Delayed
 if isinstance(values, Delayed):
  values = [values]
 dsk = merge((v.dask for v in values))
 name = ('bag-from-delayed-' + tokenize(*values))
 names = [(name, i) for i in range(len(values))]
 values = [v.key for v in values]
 dsk2 = dict(zip(names, values))
 return Bag(merge(dsk, dsk2), name, len(values))

def from_delayed ( values ) : from dask . delayed import Delayed if isinstance ( values , Delayed ) : values = [ values ] dsk = merge ( ( v . dask for v in values ) ) name = ( 'bag-from-delayed-' + tokenize ( * values ) ) names = [ ( name , i ) for i in range ( len ( values ) ) ] values = [ v . key for v in values ] dsk2 = dict ( zip ( names , values ) ) return Bag ( merge ( dsk , dsk2 ) , name , len ( values ) )
create bag from many dask .