Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Pickles the object and compress the dumped string with zlib

:param obj: the object to be pickled
:param level: the compression level, 9 is the best
                 and -1 is to not compress

        def pickleAndCompress(obj, level=9):
   """ Pickles the object and compress the dumped string with zlib
   
   :param obj: the object to be pickled
   :param level: the compression level, 9 is the best
                    and -1 is to not compress

   """
   pickled = cPickle.dumps(obj)
   if level < 0: return pickled
   else:
      if not ZLIB_SUPPORT:
         Util.raiseException('zlib not found !', ImportError)
      pickled_zlib = zlib.compress(pickled, level)
      return pickled_zlib
        


src/p/y/Pyevolve-HEAD/pyevolve/Migration.py   Pyevolve(Download)
         # (code, group name, individual)
         networkObject = (Consts.CDefNetworkIndividual, self.getGroupName(), individual)
         networkData = Network.pickleAndCompress(networkObject, self.getCompressionLevel())
         # Send the individuals to the topology
         self.clientThread.addData(networkData)