| 630 | |
| 631 | |
| 632 | class LZMACompressor: |
| 633 | |
| 634 | def __init__(self): |
| 635 | self._comp = None |
| 636 | |
| 637 | def _init(self): |
| 638 | props = lzma._encode_filter_properties({'id': lzma.FILTER_LZMA1}) |
| 639 | self._comp = lzma.LZMACompressor(lzma.FORMAT_RAW, filters=[ |
| 640 | lzma._decode_filter_properties(lzma.FILTER_LZMA1, props) |
| 641 | ]) |
| 642 | return struct.pack('<BBH', 9, 4, len(props)) + props |
| 643 | |
| 644 | def compress(self, data): |
| 645 | if self._comp is None: |
| 646 | return self._init() + self._comp.compress(data) |
| 647 | return self._comp.compress(data) |
| 648 | |
| 649 | def flush(self): |
| 650 | if self._comp is None: |
| 651 | return self._init() + self._comp.flush() |
| 652 | return self._comp.flush() |
| 653 | |
| 654 | |
| 655 | class LZMADecompressor: |
no outgoing calls
no test coverage detected