Changed decompressers names.
No longer use new module, decompressers will decorate an un-instantiated class.
This commit is contained in:
parent
c9a622b846
commit
e9d7b71fe8
|
@ -34,26 +34,25 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import gzip, zipfile, bz2
|
import gzip, zipfile, bz2
|
||||||
import new
|
|
||||||
|
|
||||||
def Zip(reader):
|
def Zipped(reader):
|
||||||
"""Blocklist reader for zipped blocklists"""
|
"""Blocklist reader for zipped blocklists"""
|
||||||
def open(self):
|
def open(self):
|
||||||
z = zipfile.ZipFile(self.file)
|
z = zipfile.ZipFile(self.file)
|
||||||
return z.open(z.namelist()[0])
|
return z.open(z.namelist()[0])
|
||||||
setattr(reader, "open", new.instancemethod(open, reader))
|
reader.open = open
|
||||||
return reader
|
return reader
|
||||||
|
|
||||||
def GZip(reader):
|
def GZipped(reader):
|
||||||
"""Blocklist reader for gzipped blocklists"""
|
"""Blocklist reader for gzipped blocklists"""
|
||||||
def open(self):
|
def open(self):
|
||||||
return gzip.open(self.file)
|
return gzip.open(self.file)
|
||||||
setattr(reader, "open", new.instancemethod(open, reader))
|
reader.open = open
|
||||||
return reader
|
return reader
|
||||||
|
|
||||||
def BZip2(reader):
|
def BZipped2(reader):
|
||||||
"""Blocklist reader for bzipped2 blocklists"""
|
"""Blocklist reader for bzipped2 blocklists"""
|
||||||
def open(self):
|
def open(self):
|
||||||
return bz2.BZ2File(self.file)
|
return bz2.BZ2File(self.file)
|
||||||
setattr(reader, "open", new.instancemethod(open, reader))
|
reader.open = open
|
||||||
return reader
|
return reader
|
||||||
|
|
Loading…
Reference in New Issue