##// END OF EJS Templates
remove use of utils.flatten...
Min RK -
Show More
@@ -10,9 +10,9 b' except:'
10 10 cPickle = None
11 11 import pickle
12 12
13 # IPython imports
13 from itertools import chain
14
14 15 from IPython.utils.py3compat import PY3, buffer_to_bytes_py2
15 from IPython.utils.data import flatten
16 16 from ipython_kernel.pickleutil import (
17 17 can, uncan, can_sequence, uncan_sequence, CannedObject,
18 18 istype, sequence_types, PICKLE_PROTOCOL,
@@ -138,10 +138,12 b' def pack_apply_message(f, args, kwargs, buffer_threshold=MAX_BYTES, item_thresho'
138 138 With length at least two + len(args) + len(kwargs)
139 139 """
140 140
141 arg_bufs = flatten(serialize_object(arg, buffer_threshold, item_threshold) for arg in args)
141 arg_bufs = list(chain.from_iterable(
142 serialize_object(arg, buffer_threshold, item_threshold) for arg in args))
142 143
143 144 kw_keys = sorted(kwargs.keys())
144 kwarg_bufs = flatten(serialize_object(kwargs[key], buffer_threshold, item_threshold) for key in kw_keys)
145 kwarg_bufs = list(chain.from_iterable(
146 serialize_object(kwargs[key], buffer_threshold, item_threshold) for key in kw_keys))
145 147
146 148 info = dict(nargs=len(args), narg_bufs=len(arg_bufs), kw_keys=kw_keys)
147 149
@@ -12,10 +12,7 b' pieces to individual nodes in a cluster.'
12 12 from __future__ import division
13 13
14 14 import sys
15 from itertools import islice
16
17 from IPython.utils.data import flatten as utils_flatten
18
15 from itertools import islice, chain
19 16
20 17 numpy = None
21 18
@@ -75,7 +72,7 b' class Map(object):'
75 72 return numpy.concatenate(listOfPartitions)
76 73 # Next try for Python sequence types
77 74 if isinstance(testObject, (list, tuple)):
78 return utils_flatten(listOfPartitions)
75 return list(chain.from_iterable(listOfPartitions))
79 76 # If we have scalars, just return listOfPartitions
80 77 return listOfPartitions
81 78
@@ -125,5 +122,3 b' def mappable(obj):'
125 122
126 123 dists = {'b':Map,'r':RoundRobinMap}
127 124
128
129
General Comments 0
You need to be logged in to leave comments. Login now