Fix bad end of iterator and unused variable
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 9 Apr 2019 09:50:11 +0000 (11:50 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Tue, 9 Apr 2019 09:50:11 +0000 (11:50 +0200)
The StopIteration is a real error in python 3.7

src/text_helpers.py

index d60f165..3b21141 100644 (file)
@@ -114,7 +114,7 @@ def head_and_tail(iterable, n_head=20, n_tail=20, n_elems=None,
             else:
                 yield skip_elem
     elif n_elems <= n_head:
-        raise StopIteration()
+        return
 
     # yield end
     try:
@@ -154,7 +154,6 @@ def size_str(byte_number, is_diff=False):
         sign_str = '+'
     else:
         sign_str = ''
-    curr_fac = 1
     curr_num = abs(float(byte_number))
 
     # loop