Ejemplo n.º 1
0
 def pagesReceived(self):
     metadataString = self.pages[0]
     dataString = ''.join(self.pages[1:])
     try:
         metadata = pickle.loads(metadataString)
     except:
         self._deferred.errback(failure.Failure())
     else:
         typeDescriptor = metadata.pop('type')
         serial = newserialized.Serialized(dataString, typeDescriptor,
                                           metadata)
         self._deferred.callback(serial)
Ejemplo n.º 2
0
def unserialize(headers, data):
    # print headers, data
    h = getPrefixedHeaders(headers)
    typeDescriptor = h['serial-type']
    md = {}
    if typeDescriptor == 'pickle':
        pass
    elif typeDescriptor == 'ndarray':
        md['dtype'] = h['dtype']
        md['shape'] = strToShape(h['shape'])
    serial = newserialized.Serialized(data, typeDescriptor, md)
    return newserialized.unserialize(serial)
Ejemplo n.º 3
0
 def handleArray_buffer(self, arrayBuffer):
     self.nextHandler = self.handleIncomingSerialized
     serial = newserialized.Serialized(arrayBuffer, 'ndarray',
                                       self.workVars['serial'])
     self.workVars['serialsDict'][self.workVars['serialKey']] = serial
Ejemplo n.º 4
0
 def handleSerial_PICKLE(self, package):
     self.nextHandler = self.handleIncomingSerialized
     serial = newserialized.Serialized(package, typeDescriptor='pickle')
     self.workVars['serialsDict'][self.workVars['serialKey']] = serial
Ejemplo n.º 5
0
 def handlePushingArray_buffer(self, arrayBuffer):
     self.nextHandler = self.handlePushing
     serial = newserialized.Serialized(arrayBuffer, 'ndarray',
                                       self.workVars['pushSerial'])
     self.workVars['pushSerialsDict'][self.workVars['pushKey']] = serial
Ejemplo n.º 6
0
 def handlePushing_PICKLE(self, package):
     self.nextHandler = self.handlePushing
     serial = newserialized.Serialized(package, typeDescriptor='pickle')
     self.workVars['pushSerialsDict'][self.workVars['pushKey']] = serial