]> Cypherpunks.ru repositories - pyderasn.git/commitdiff
British "colorize" spelling
authorSergey Matveev <stargrave@stargrave.org>
Tue, 7 Aug 2018 18:39:14 +0000 (21:39 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 7 Aug 2018 18:39:14 +0000 (21:39 +0300)
pyderasn.py

index 38b05484720648f7d5242db4f7ade865a85cbd1a..3f0e8caec4e8e33ca804dd34d1cf95656fe50d97 100755 (executable)
@@ -1258,7 +1258,7 @@ def _pp(
     )
 
 
-def _colorize(what, colour, with_colours, attrs=("bold",)):
+def _colourize(what, colour, with_colours, attrs=("bold",)):
     return colored(what, colour, attrs=attrs) if with_colours else what
 
 
@@ -1279,20 +1279,20 @@ def pp_console_row(
             ),
             LENINDEF_PP_CHAR if pp.expl_lenindef else " ",
         )
-        cols.append(_colorize(col, "red", with_colours, ()))
+        cols.append(_colourize(col, "red", with_colours, ()))
         col = "[%d,%d,%4d]%s" % (
             pp.tlen,
             pp.llen,
             pp.vlen,
             LENINDEF_PP_CHAR if pp.lenindef else " "
         )
-        col = _colorize(col, "green", with_colours, ())
+        col = _colourize(col, "green", with_colours, ())
         cols.append(col)
     if len(pp.decode_path) > 0:
         cols.append(" ." * (len(pp.decode_path)))
         ent = pp.decode_path[-1]
         if isinstance(ent, DecodePathDefBy):
-            cols.append(_colorize("DEFINED BY", "red", with_colours, ("reverse",)))
+            cols.append(_colourize("DEFINED BY", "red", with_colours, ("reverse",)))
             value = str(ent.defined_by)
             if (
                     oids is not None and
@@ -1300,42 +1300,42 @@ def pp_console_row(
                     ObjectIdentifier.asn1_type_name and
                     value in oids
             ):
-                cols.append(_colorize("%s:" % oids[value], "green", with_colours))
+                cols.append(_colourize("%s:" % oids[value], "green", with_colours))
             else:
-                cols.append(_colorize("%s:" % value, "white", with_colours, ("reverse",)))
+                cols.append(_colourize("%s:" % value, "white", with_colours, ("reverse",)))
         else:
-            cols.append(_colorize("%s:" % ent, "yellow", with_colours, ("reverse",)))
+            cols.append(_colourize("%s:" % ent, "yellow", with_colours, ("reverse",)))
     if pp.expl is not None:
         klass, _, num = pp.expl
         col = "[%s%d] EXPLICIT" % (TagClassReprs[klass], num)
-        cols.append(_colorize(col, "blue", with_colours))
+        cols.append(_colourize(col, "blue", with_colours))
     if pp.impl is not None:
         klass, _, num = pp.impl
         col = "[%s%d]" % (TagClassReprs[klass], num)
-        cols.append(_colorize(col, "blue", with_colours))
+        cols.append(_colourize(col, "blue", with_colours))
     if pp.asn1_type_name.replace(" ", "") != pp.obj_name.upper():
-        cols.append(_colorize(pp.obj_name, "magenta", with_colours))
+        cols.append(_colourize(pp.obj_name, "magenta", with_colours))
     if pp.bered:
-        cols.append(_colorize("BER", "red", with_colours))
-    cols.append(_colorize(pp.asn1_type_name, "cyan", with_colours))
+        cols.append(_colourize("BER", "red", with_colours))
+    cols.append(_colourize(pp.asn1_type_name, "cyan", with_colours))
     if pp.value is not None:
         value = pp.value
-        cols.append(_colorize(value, "white", with_colours, ("reverse",)))
+        cols.append(_colourize(value, "white", with_colours, ("reverse",)))
         if (
                 oids is not None and
                 pp.asn1_type_name == ObjectIdentifier.asn1_type_name and
                 value in oids
         ):
-            cols.append(_colorize("(%s)" % oids[value], "green", with_colours))
+            cols.append(_colourize("(%s)" % oids[value], "green", with_colours))
     if with_blob:
         if isinstance(pp.blob, binary_type):
             cols.append(hexenc(pp.blob))
         elif isinstance(pp.blob, tuple):
             cols.append(", ".join(pp.blob))
     if pp.optional:
-        cols.append(_colorize("OPTIONAL", "red", with_colours))
+        cols.append(_colourize("OPTIONAL", "red", with_colours))
     if pp.default:
-        cols.append(_colorize("DEFAULT", "red", with_colours))
+        cols.append(_colourize("DEFAULT", "red", with_colours))
     return " ".join(cols)