]> Cypherpunks.ru repositories - pyderasn.git/blobdiff - pyderasn.py
Unnecessary list usage
[pyderasn.git] / pyderasn.py
index 1c7f3ed94603bda04df4aa52c38e8f2d293c0055..cc33073279913c78a25e69d2d5681dde0d995d10 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):
@@ -3355,7 +3355,10 @@ class Enumerated(Integer):
         if isinstance(value, self.__class__):
             value = value._value
         elif isinstance(value, integer_types):
-            if value not in list(self.specs.values()):
+            for _value in self.specs.values():
+                if _value == value:
+                    break
+            else:
                 raise DecodeError(
                     "unknown integer value: %s" % value,
                     klass=self.__class__,
@@ -5431,7 +5434,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),