bundle2: move the 'close' method off the unpackermixin

This method is unrelated to unpacking and only used by the unbundle20 class.
We move it there for clarity.
This commit is contained in:
Pierre-Yves David 2017-04-09 19:08:24 +02:00
parent 72eb1f753d
commit c1bb70eed7

View File

@ -660,11 +660,6 @@ class unpackermixin(object):
raise raise
return None return None
def close(self):
"""close underlying file"""
if util.safehasattr(self._fp, 'close'):
return self._fp.close()
def getunbundler(ui, fp, magicstring=None): def getunbundler(ui, fp, magicstring=None):
"""return a valid unbundler object for a given magicstring""" """return a valid unbundler object for a given magicstring"""
if magicstring is None: if magicstring is None:
@ -817,6 +812,11 @@ class unbundle20(unpackermixin):
self.params # load params self.params # load params
return self._compressed return self._compressed
def close(self):
"""close underlying file"""
if util.safehasattr(self._fp, 'close'):
return self._fp.close()
formatmap = {'20': unbundle20} formatmap = {'20': unbundle20}
b2streamparamsmap = {} b2streamparamsmap = {}