Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 5
0
 def _iterable():
     for k, v in iterpair(mapping):
         data1.append(loads(k))
         yield v
Ejemplo n.º 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))
Ejemplo n.º 7
0
 def load_get_data(self, result):
     vloads = self.value_pickler.loads
     return dict(((f, vloads(v)) for f, v in iterpair(result)))
Ejemplo n.º 8
0
 def _iterable():
     for k, v in iterpair(mapping):
         data1.append(loads(k))
         yield v
Ejemplo n.º 9
0
 def load_get_data(self, result):
     vloads = self.value_pickler.loads
     return dict(((f, vloads(v)) for f, v in iterpair(result)))