]> Cypherpunks.ru repositories - pyderasn.git/blobdiff - pyderasn.py
Fix defines_by_path example usage
[pyderasn.git] / pyderasn.py
index 814d85fba9113ef595bdbd326a93c3c60382b5ca..3868b61f60874d7c95b39e451be894cbe2f95258 100755 (executable)
@@ -429,7 +429,7 @@ For example, again for CMS, you want to automatically decode
 structures it may hold. Also, automatically decode ``controlSequence``
 of ``PKIResponse``::
 
-    content_info, tail = ContentInfo().decode(data, defines_by_path=(
+    content_info, tail = ContentInfo().decode(data, ctx={"defines_by_path": (
         (
             ("contentType",),
             ((("content",), {id_signedData: SignedData()}),),
@@ -464,7 +464,7 @@ of ``PKIResponse``::
                 id_cmc_transactionId: TransactionId(),
             })),
         ),
-    ))
+    )})
 
 Pay attention for :py:class:`pyderasn.DecodePathDefBy` and ``any``.
 First function is useful for path construction when some automatic
@@ -670,7 +670,7 @@ from six.moves import xrange as six_xrange
 try:
     from termcolor import colored
 except ImportError:  # pragma: no cover
-    def colored(what, *args):
+    def colored(what, *args, **kwargs):
         return what
 
 
@@ -5700,7 +5700,10 @@ def main():  # pragma: no cover
     args.DERFile.seek(args.skip)
     der = memoryview(args.DERFile.read())
     args.DERFile.close()
-    oid_maps = [obj_by_path(_path) for _path in (args.oids or "").split(",")]
+    oid_maps = (
+        [obj_by_path(_path) for _path in (args.oids or "").split(",")]
+        if args.oids else ()
+    )
     if args.schema:
         schema = obj_by_path(args.schema)
         from functools import partial