<s> from __future__ import absolute_import <EOL> import snappy <EOL> from . compression import CompressionSocket <EOL> class SnappySocket ( CompressionSocket ) : <EOL> def __init__ ( self , socket ) : <EOL> self . _decompressor = snappy . StreamDecompressor ( ) <EOL> self . _compressor = snappy . StreamCompressor ( ) <EOL> super ( SnappySocket , self ) . __init__ ( socket ) <EOL> def compress ( self , data ) : <EOL> return self . _compressor . add_chunk ( data , compress = True ) <EOL> def decompress ( self , data ) : <EOL> return self . _decompressor . decompress ( data ) </s>
