| 779 | self.eof = False |
| 780 | |
| 781 | def decompress(self, data): |
| 782 | if self._decomp is None: |
| 783 | self._unconsumed += data |
| 784 | if len(self._unconsumed) <= 4: |
| 785 | return b'' |
| 786 | psize, = struct.unpack('<H', self._unconsumed[2:4]) |
| 787 | if len(self._unconsumed) <= 4 + psize: |
| 788 | return b'' |
| 789 | |
| 790 | self._decomp = lzma.LZMADecompressor(lzma.FORMAT_RAW, filters=[ |
| 791 | lzma._decode_filter_properties(lzma.FILTER_LZMA1, |
| 792 | self._unconsumed[4:4 + psize]) |
| 793 | ]) |
| 794 | data = self._unconsumed[4 + psize:] |
| 795 | del self._unconsumed |
| 796 | |
| 797 | result = self._decomp.decompress(data) |
| 798 | self.eof = self._decomp.eof |
| 799 | return result |
| 800 | |
| 801 | |
| 802 | compressor_names = { |