Python bz2.BZ2Decompressor() Examples
The following are 30
code examples of bz2.BZ2Decompressor().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
bz2
, or try the search function
.
Example #1
Source File: test_tarfile.py From BinderFilter with MIT License | 6 votes |
def test_stream_padding(self): # Test for bug #1543303. tar = tarfile.open(tmpname, self.mode) tar.close() if self.mode.endswith("gz"): fobj = gzip.GzipFile(tmpname) data = fobj.read() fobj.close() elif self.mode.endswith("bz2"): dec = bz2.BZ2Decompressor() data = open(tmpname, "rb").read() data = dec.decompress(data) self.assertTrue(len(dec.unused_data) == 0, "found trailing data") else: fobj = open(tmpname, "rb") data = fobj.read() fobj.close() self.assertTrue(data.count("\0") == tarfile.RECORDSIZE, "incorrect zero padding")
Example #2
Source File: test_tarfile.py From oss-ftp with MIT License | 6 votes |
def test_stream_padding(self): # Test for bug #1543303. tar = tarfile.open(tmpname, self.mode) tar.close() if self.mode.endswith("gz"): fobj = gzip.GzipFile(tmpname) data = fobj.read() fobj.close() elif self.mode.endswith("bz2"): dec = bz2.BZ2Decompressor() data = open(tmpname, "rb").read() data = dec.decompress(data) self.assertTrue(len(dec.unused_data) == 0, "found trailing data") else: fobj = open(tmpname, "rb") data = fobj.read() fobj.close() self.assertTrue(data.count("\0") == tarfile.RECORDSIZE, "incorrect zero padding")
Example #3
Source File: test_tarfile.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_stream_padding(self): # Test for bug #1543303. tar = tarfile.open(tmpname, self.mode) tar.close() if self.mode.endswith("gz"): with gzip.GzipFile(tmpname) as fobj: data = fobj.read() elif self.mode.endswith("bz2"): dec = bz2.BZ2Decompressor() with open(tmpname, "rb") as fobj: data = fobj.read() data = dec.decompress(data) self.assertTrue(len(dec.unused_data) == 0, "found trailing data") else: with open(tmpname, "rb") as fobj: data = fobj.read() self.assertTrue(data.count("\0") == tarfile.RECORDSIZE, "incorrect zero padding")
Example #4
Source File: tarfile.py From stopstalk-deployment with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #5
Source File: bzip2_parser.py From ITWSV with MIT License | 5 votes |
def __init__(self, stream): self.bzip2 = BZ2Decompressor()
Example #6
Source File: tarfile.py From FuYiSpider with Apache License 2.0 | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #7
Source File: tarfile.py From learn_python3_spider with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #8
Source File: bzip2_parser.py From Yuki-Chan-The-Auto-Pentest with MIT License | 5 votes |
def __init__(self, stream): self.bzip2 = BZ2Decompressor()
Example #9
Source File: tarfile.py From meddle with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = "" else: self.bz2obj = bz2.BZ2Compressor()
Example #10
Source File: tarfile.py From Python24 with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #11
Source File: py7zlib.py From romcollectionbrowser with GNU General Public License v2.0 | 5 votes |
def _read_bzip(self, coder, input): dec = bz2.BZ2Decompressor() return self._read_from_decompressor(coder, dec)
Example #12
Source File: tarfile.py From ironpython2 with Apache License 2.0 | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = "" else: self.bz2obj = bz2.BZ2Compressor()
Example #13
Source File: tarfile.py From Hands-On-Application-Development-with-PyCharm with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #14
Source File: tarfile.py From Financial-Portfolio-Flask with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #15
Source File: updater.py From plugin.video.mediathekview with MIT License | 5 votes |
def _decompress_bz2(self, sourcefile, destfile): blocksize = 8192 try: with open(destfile, 'wb') as dstfile, open(sourcefile, 'rb') as srcfile: decompressor = bz2.BZ2Decompressor() for data in iter(lambda: srcfile.read(blocksize), b''): dstfile.write(decompressor.decompress(data)) # pylint: disable=broad-except except Exception as err: self.logger.error('bz2 decompression failed: {}'.format(err)) return -1 return 0
Example #16
Source File: tarfile.py From recruit with Apache License 2.0 | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #17
Source File: tarfile.py From scylla with Apache License 2.0 | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #18
Source File: tarfile.py From Building-Recommendation-Systems-with-Python with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #19
Source File: tarfile.py From Building-Recommendation-Systems-with-Python with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #20
Source File: tarfile.py From pySINDy with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #21
Source File: tarfile.py From hacktoberfest2018 with GNU General Public License v3.0 | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #22
Source File: tarfile.py From hacktoberfest2018 with GNU General Public License v3.0 | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #23
Source File: phishtankbot.py From abusehelper with MIT License | 5 votes |
def __init__(self, fileobj): self._fileobj = fileobj self._bz2 = bz2.BZ2Decompressor() self._line_buffer = collections.deque([""]) self._current_line = "" self._current_offset = 0
Example #24
Source File: tarfile.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #25
Source File: compression.py From prospector with GNU General Public License v3.0 | 5 votes |
def _init__(self, fileobj, chunksize=4096): self.fileobj = fileobj self.decompressor = bz2.BZ2Decompressor() self.chunksize = self.chunksize
Example #26
Source File: tarfile.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #27
Source File: tarfile.py From pipenv with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #28
Source File: tarfile.py From pex with Apache License 2.0 | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #29
Source File: tarfile.py From deepWordBug with Apache License 2.0 | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()
Example #30
Source File: tarfile.py From pipenv with MIT License | 5 votes |
def init(self): import bz2 self.pos = 0 if self.mode == "r": self.bz2obj = bz2.BZ2Decompressor() self.fileobj.seek(0) self.buf = b"" else: self.bz2obj = bz2.BZ2Compressor()