This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cantor
Recipients cantor
Date 2013-10-25.19:20:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1382728843.86.0.270938771254.issue19395@psf.upfronthosting.co.za>
In-reply-to
Content
import lzma
from functools import partial
import multiprocessing


def run_lzma(data,c):
    return c.compress(data)


def split_len(seq, length):
    return [str.encode(seq[i:i+length]) for i in range(0, len(seq), length)]



def lzma_mp(sequence,threads=3):
  lzc = lzma.LZMACompressor()
  blocksize = int(round(len(sequence)/threads))
  strings = split_len(sequence, blocksize)
  lzc_partial = partial(run_lzma,c=lzc)
  pool=multiprocessing.Pool()
  lzc_pool = list(pool.map(lzc_partial,strings))
  pool.close()
  pool.join()
  out_flush = lzc.flush()
  return b"".join(lzc_pool + [out_flush])

sequence = 'AAAAAJKDDDDDDDDDDDDDDDDDDDDDDDDDDDDGJFKSHFKLHALWEHAIHWEOIAH IOAHIOWEHIOHEIOFEAFEASFEAFWEWWWWWWWWWWWWWWWWWWWWWWWWWWWWWEWFQWEWQWQGEWQFEWFDWEWEGEFGWEG'


lzma_mp(sequence,threads=3)
History
Date User Action Args
2013-10-25 19:20:43cantorsetrecipients: + cantor
2013-10-25 19:20:43cantorsetmessageid: <1382728843.86.0.270938771254.issue19395@psf.upfronthosting.co.za>
2013-10-25 19:20:43cantorlinkissue19395 messages
2013-10-25 19:20:43cantorcreate