]> Cypherpunks.ru repositories - pyderasn.git/commitdiff
xrange is preferrable for dozen-elements lists
authorSergey Matveev <stargrave@stargrave.org>
Wed, 2 Jan 2019 23:30:49 +0000 (02:30 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 3 Jan 2019 09:28:15 +0000 (12:28 +0300)
pyderasn.py

index 1c7f3ed94603bda04df4aa52c38e8f2d293c0055..1245a435792c30b33c733aba5409bdd816173d53 100755 (executable)
@@ -1325,7 +1325,7 @@ def _colourize(what, colour, with_colours, attrs=("bold",)):
 def colonize_hex(hexed):
     """Separate hexadecimal string with colons
     """
-    return ":".join(hexed[i:i + 2] for i in range(0, len(hexed), 2))
+    return ":".join(hexed[i:i + 2] for i in six_xrange(0, len(hexed), 2))
 
 
 def pp_console_row(
@@ -1432,7 +1432,7 @@ def pp_console_blob(pp, decode_path_len_decrease=0):
         cols.append(" ." * (decode_path_len + 1))
     if isinstance(pp.blob, binary_type):
         blob = hexenc(pp.blob).upper()
-        for i in range(0, len(blob), 32):
+        for i in six_xrange(0, len(blob), 32):
             chunk = blob[i:i + 32]
             yield " ".join(cols + [colonize_hex(chunk)])
     elif isinstance(pp.blob, tuple):
@@ -5431,7 +5431,7 @@ def generic_decoder():  # pragma: no cover
     choice = PrimitiveTypes()
     choice.specs["SequenceOf"] = SequenceOf(schema=choice)
     choice.specs["SetOf"] = SetOf(schema=choice)
-    for i in range(31):
+    for i in six_xrange(31):
         choice.specs["SequenceOf%d" % i] = SequenceOf(
             schema=choice,
             expl=tag_ctxc(i),