From 0a4227d1322439cddd87af634440699dc9603182 Mon Sep 17 00:00:00 2001 From: Andrey Pokhilko Date: Fri, 27 Dec 2019 22:07:22 +0300 Subject: [PATCH] Refactoring --- pylgbst/utilities.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pylgbst/utilities.py b/pylgbst/utilities.py index 4031576..0f5a7fe 100644 --- a/pylgbst/utilities.py +++ b/pylgbst/utilities.py @@ -20,13 +20,8 @@ queue = queue # just to use it def check_unpack(seq, index, pattern, size): """Check that we got size bytes, if so, unpack using pattern""" data = seq[index: index + size] - if len(data) == size: - return unpack(pattern, data)[0] - else: - log.warning( - "Unpacking of %s bytes failed, insufficient data: %r", size, seq[index:] - ) - raise ValueError(data, "Expected %s bytes" % (size,)) + assert len(data) == size, "Unexpected data len %d, expected %d" % (len(data), size) + return unpack(pattern, data)[0] def usbyte(seq, index):