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, nadeem.vawda, pitrou
Date 2013-10-25.21:04:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1382735099.12.0.33397571711.issue19395@psf.upfronthosting.co.za>
In-reply-to
Content
just to mention that map() (i.e. the non parallel version) works:

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)]



sequence='AAAAAJKDDDDDDDDDDDDDDDDDDDDDDDDDDDDGJFKSHFKLHALWEHAIHWEOIAH IOAHIOWEHIOHEIOFEAFEASFEAFWEWWWWWWWWWWWWWWWWWWWWWWWWWWWWWEWFQWEWQWQGEWQFEWFDWEWEGEFGWEG'
threads=3
blocksize = int(round(len(sequence)/threads))
strings = split_len(sequence, blocksize)


#map works

lzc = lzma.LZMACompressor()
out = list(map(lzc.compress,strings))
out_flush = lzc.flush()
result = b"".join(out + [out_flush])
lzma.compress(str.encode(sequence))
lzma.compress(str.encode(sequence)) == result
True

# map with the use of partial function works as well 
lzc = lzma.LZMACompressor()
lzc_partial = partial(run_lzma,c=lzc)
out = list(map(lzc_partial,strings))
out_flush = lzc.flush()
result = b"".join(out + [out_flush])
lzma.compress(str.encode(sequence)) == result
History
Date User Action Args
2013-10-25 21:04:59cantorsetrecipients: + cantor, pitrou, nadeem.vawda
2013-10-25 21:04:59cantorsetmessageid: <1382735099.12.0.33397571711.issue19395@psf.upfronthosting.co.za>
2013-10-25 21:04:59cantorlinkissue19395 messages
2013-10-25 21:04:59cantorcreate