##// END OF EJS Templates
util: remove compressorobj API from compression engines...
Gregory Szorc -
r30359:673f0fdc default
parent child Browse files
Show More
@@ -2966,7 +2966,7 b' class compressionengine(object):'
2966 exclude the name from external usage, set the first element to ``None``.
2966 exclude the name from external usage, set the first element to ``None``.
2967
2967
2968 If bundle compression is supported, the class must also implement
2968 If bundle compression is supported, the class must also implement
2969 ``compressstream``, ``compressorobj`` and `decompressorreader``.
2969 ``compressstream`` and `decompressorreader``.
2970 """
2970 """
2971 return None
2971 return None
2972
2972
@@ -2982,14 +2982,6 b' class compressionengine(object):'
2982 """
2982 """
2983 raise NotImplementedError()
2983 raise NotImplementedError()
2984
2984
2985 def compressorobj(self):
2986 """(Temporary) Obtain an object used for compression.
2987
2988 The returned object has ``compress(data)`` and ``flush()`` methods.
2989 These are used to incrementally feed data chunks into a compressor.
2990 """
2991 raise NotImplementedError()
2992
2993 def decompressorreader(self, fh):
2985 def decompressorreader(self, fh):
2994 """Perform decompression on a file object.
2986 """Perform decompression on a file object.
2995
2987
@@ -3006,9 +2998,6 b' class _zlibengine(compressionengine):'
3006 def bundletype(self):
2998 def bundletype(self):
3007 return 'gzip', 'GZ'
2999 return 'gzip', 'GZ'
3008
3000
3009 def compressorobj(self):
3010 return zlib.compressobj()
3011
3012 def compressstream(self, it, opts=None):
3001 def compressstream(self, it, opts=None):
3013 opts = opts or {}
3002 opts = opts or {}
3014
3003
@@ -3039,9 +3028,6 b' class _bz2engine(compressionengine):'
3039 def bundletype(self):
3028 def bundletype(self):
3040 return 'bzip2', 'BZ'
3029 return 'bzip2', 'BZ'
3041
3030
3042 def compressorobj(self):
3043 return bz2.BZ2Compressor()
3044
3045 def compressstream(self, it, opts=None):
3031 def compressstream(self, it, opts=None):
3046 opts = opts or {}
3032 opts = opts or {}
3047 z = bz2.BZ2Compressor(opts.get('level', 9))
3033 z = bz2.BZ2Compressor(opts.get('level', 9))
@@ -3069,7 +3055,7 b' class _truncatedbz2engine(compressioneng'
3069 def bundletype(self):
3055 def bundletype(self):
3070 return None, '_truncatedBZ'
3056 return None, '_truncatedBZ'
3071
3057
3072 # We don't implement compressorobj because it is hackily handled elsewhere.
3058 # We don't implement compressstream because it is hackily handled elsewhere.
3073
3059
3074 def decompressorreader(self, fh):
3060 def decompressorreader(self, fh):
3075 def gen():
3061 def gen():
@@ -3083,13 +3069,6 b' class _truncatedbz2engine(compressioneng'
3083
3069
3084 compengines.register(_truncatedbz2engine())
3070 compengines.register(_truncatedbz2engine())
3085
3071
3086 class nocompress(object):
3087 def compress(self, x):
3088 return x
3089
3090 def flush(self):
3091 return ''
3092
3093 class _noopengine(compressionengine):
3072 class _noopengine(compressionengine):
3094 def name(self):
3073 def name(self):
3095 return 'none'
3074 return 'none'
@@ -3097,9 +3076,6 b' class _noopengine(compressionengine):'
3097 def bundletype(self):
3076 def bundletype(self):
3098 return 'none', 'UN'
3077 return 'none', 'UN'
3099
3078
3100 def compressorobj(self):
3101 return nocompress()
3102
3103 def compressstream(self, it, opts=None):
3079 def compressstream(self, it, opts=None):
3104 return it
3080 return it
3105
3081
General Comments 0
You need to be logged in to leave comments. Login now