def from_sequence(seq, partition_size=None, npartitions=None):
 seq = list(seq)
 if (npartitions and (not partition_size)):
  partition_size = int(math.ceil((len(seq) / npartitions)))
 if ((npartitions is None) and (partition_size is None)):
  if (len(seq) < 100):
   partition_size = 1
  else:
   partition_size = int((len(seq) / 100))
 parts = list(partition_all(partition_size, seq))
 name = ('from_sequence-' + tokenize(seq, partition_size))
 d = dict((((name, i), list(part)) for (i, part) in enumerate(parts)))
 return Bag(d, name, len(d))

def from_sequence ( seq , partition_size = None , npartitions = None ) : seq = list ( seq ) if ( npartitions and ( not partition_size ) ) : partition_size = int ( math . ceil ( ( len ( seq ) / npartitions ) ) ) if ( ( npartitions is None ) and ( partition_size is None ) ) : if ( len ( seq ) < 100 ) : partition_size = 1 else : partition_size = int ( ( len ( seq ) / 100 ) ) parts = list ( partition_all ( partition_size , seq ) ) name = ( 'from_sequence-' + tokenize ( seq , partition_size ) ) d = dict ( ( ( ( name , i ) , list ( part ) ) for ( i , part ) in enumerate ( parts ) ) ) return Bag ( d , name , len ( d ) )
create dask from python sequence this sequence should be relatively small in memory .