示例#1
0
 def load_data(self, result):
     #Overwrite :meth:`stdnet.odm.PairMixin.load_data` method
     loads = self.pickler.loads
     vloads = self.value_pickler.loads
     dt = [loads(t) for t in result[0]]
     vals = {}
     for f, data in iterpair(result[1]):
         vals[f] = [vloads(d) for d in data]
     return (dt, vals)
示例#2
0
 def load_data(self, result):
     #Overwrite :meth:`stdnet.odm.PairMixin.load_data` method
     loads = self.pickler.loads
     vloads = self.value_pickler.loads
     dt = [loads(t) for t in result[0]]
     vals = {}
     for f, data in iterpair(result[1]):
         vals[f] = [vloads(d) for d in data]
     return (dt, vals)
示例#3
0
    def load_data(self, mapping, callback=None):
        loads = self.pickler.loads
        if self.value_pickler.require_session():
            data1 = []

            def _iterable():
                for k, v in iterpair(mapping):
                    data1.append(loads(k))
                    yield v
            res = self.value_pickler.load_iterable(_iterable(), self.session)
            callback = callback or passthrough
            return self.backend.execute(
                res, lambda data2: callback(zip(data1, data2)))
        else:
            vloads = self.value_pickler.loads
            data = [(loads(k), vloads(v)) for k, v in iterpair(mapping)]
            return callback(data) if callback else data
示例#4
0
    def load_data(self, mapping, callback=None):
        loads = self.pickler.loads
        if self.value_pickler.require_session():
            data1 = []

            def _iterable():
                for k, v in iterpair(mapping):
                    data1.append(loads(k))
                    yield v

            res = self.value_pickler.load_iterable(_iterable(), self.session)
            callback = callback or passthrough
            return self.backend.execute(
                res, lambda data2: callback(zip(data1, data2)))
        else:
            vloads = self.value_pickler.loads
            data = [(loads(k), vloads(v)) for k, v in iterpair(mapping)]
            return callback(data) if callback else data
示例#5
0
 def _iterable():
     for k, v in iterpair(mapping):
         data1.append(loads(k))
         yield v
示例#6
0
 def load_data(self, mapping):
     loads = self.pickler.loads
     vloads = self.value_pickler.loads
     return ((loads(k), vloads(v)) for k,v in iterpair(mapping))
示例#7
0
 def load_get_data(self, result):
     vloads = self.value_pickler.loads
     return dict(((f, vloads(v)) for f, v in iterpair(result)))
示例#8
0
 def _iterable():
     for k, v in iterpair(mapping):
         data1.append(loads(k))
         yield v
示例#9
0
 def load_get_data(self, result):
     vloads = self.value_pickler.loads
     return dict(((f, vloads(v)) for f, v in iterpair(result)))