From 2c257eeb1f02748840a8f4535d8d2a88ef5235f2 Mon Sep 17 00:00:00 2001 From: Mahendra M Date: Wed, 29 May 2013 14:20:58 +0530 Subject: PEP8-ify most of the files consumer.py and conn.py will be done later after pending merges --- kafka/codec.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'kafka/codec.py') diff --git a/kafka/codec.py b/kafka/codec.py index 83f3c0b..c7d3992 100644 --- a/kafka/codec.py +++ b/kafka/codec.py @@ -6,10 +6,11 @@ log = logging.getLogger("kafka.codec") try: import snappy - hasSnappy=True + hasSnappy = True except ImportError: log.warn("Snappy codec not available") - hasSnappy=False + hasSnappy = False + def gzip_encode(payload): buf = StringIO() @@ -21,6 +22,7 @@ def gzip_encode(payload): buf.close() return out + def gzip_decode(payload): buf = StringIO(payload) f = gzip.GzipFile(fileobj=buf, mode='r') @@ -29,11 +31,13 @@ def gzip_decode(payload): buf.close() return out + def snappy_encode(payload): if not hasSnappy: raise NotImplementedError("Snappy codec not available") return snappy.compress(payload) + def snappy_decode(payload): if not hasSnappy: raise NotImplementedError("Snappy codec not available") -- cgit v1.2.1