diff options
author | Jeff Widman <jeff@jeffwidman.com> | 2017-02-28 10:18:02 -0800 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2017-02-28 10:18:02 -0800 |
commit | 2c23a27483e7b131e8cf3f9c879344cdc497e60e (patch) | |
tree | bb9718827e2eb69452aa06a51bc3fab78bc08c9e /kafka/util.py | |
parent | 432f00eb669550c75fa75e8efa56d5d80cda18a5 (diff) | |
download | kafka-python-2c23a27483e7b131e8cf3f9c879344cdc497e60e.tar.gz |
Remove dead code (#967)
Diffstat (limited to 'kafka/util.py')
-rw-r--r-- | kafka/util.py | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/kafka/util.py b/kafka/util.py index bc01154..de8f228 100644 --- a/kafka/util.py +++ b/kafka/util.py @@ -4,7 +4,6 @@ import atexit import binascii import collections import struct -import sys from threading import Thread, Event import weakref @@ -33,19 +32,6 @@ def write_int_string(s): return struct.pack('>i%ds' % len(s), len(s), s) -def write_short_string(s): - if s is not None and not isinstance(s, six.binary_type): - raise TypeError('Expected "%s" to be bytes\n' - 'data=%s' % (type(s), repr(s))) - if s is None: - return struct.pack('>h', -1) - elif len(s) > 32767 and sys.version_info < (2, 7): - # Python 2.6 issues a deprecation warning instead of a struct error - raise struct.error(len(s)) - else: - return struct.pack('>h%ds' % len(s), len(s), s) - - def read_short_string(data, cur): if len(data) < cur + 2: raise BufferUnderflowError("Not enough data left") @@ -62,24 +48,6 @@ def read_short_string(data, cur): return out, cur + strlen -def read_int_string(data, cur): - if len(data) < cur + 4: - raise BufferUnderflowError( - "Not enough data left to read string len (%d < %d)" % - (len(data), cur + 4)) - - (strlen,) = struct.unpack('>i', data[cur:cur + 4]) - if strlen == -1: - return None, cur + 4 - - cur += 4 - if len(data) < cur + strlen: - raise BufferUnderflowError("Not enough data left") - - out = data[cur:cur + strlen] - return out, cur + strlen - - def relative_unpack(fmt, data, cur): size = struct.calcsize(fmt) if len(data) < cur + size: |