Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xcp/cpiofile.py: Fix warning: Reimport 'bz2' (imported line 48) #58

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions xcp/cpiofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,6 @@ def __init__(self, name, mode, comptype, fileobj, bufsize):
self._init_write_gz()

if comptype == "bz2":
try:
import bz2
except ImportError:
raise CompressionError("bz2 module is not available")
if mode == "r":
self.dbuf = b""
self.cmp = bz2.BZ2Decompressor()
Expand Down Expand Up @@ -561,7 +557,6 @@ def __init__(self, fileobj, mode):
self.init()

def init(self):
import bz2
self.pos = 0
if self.mode == "r":
self.cmpobj = bz2.BZ2Decompressor()
Expand Down Expand Up @@ -1106,11 +1101,6 @@ def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9):
if len(mode) > 1 or mode not in "rw":
raise ValueError("mode must be 'r' or 'w'.")

try:
import bz2
except ImportError:
raise CompressionError("bz2 module is not available")

if fileobj is not None:
fileobj = _BZ2Proxy(fileobj, mode)
else:
Expand Down