dexter has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/39194?usp=email )


Change subject: javacard, cosmetic: fix sourcecode fromatting and improve 
docstring
......................................................................

javacard, cosmetic: fix sourcecode fromatting and improve docstring

The line with TAGS is longer than 120 columns and there is some
comment that should be moved to the python docstring.

Related: OS#6679
Change-Id: I1d02098320cfbe17a0eb1bfdcf3bc85034cc8e20
---
M pySim/javacard.py
1 file changed, 7 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/94/39194/1

diff --git a/pySim/javacard.py b/pySim/javacard.py
index 46f6ec0..07b0f39 100644
--- a/pySim/javacard.py
+++ b/pySim/javacard.py
@@ -6,14 +6,16 @@
 import io

 def ijc_to_cap(in_file: io.IOBase, out_zip: zipfile.ZipFile, p : str = "foo"):
-    """Convert an ICJ (Interoperable Java Card) file [back] to a CAP file."""
-    TAGS = ["Header", "Directory", "Applet", "Import", "ConstantPool", 
"Class", "Method", "StaticField", "RefLocation", "Export", "Descriptor", 
"Debug"]
+    """Convert an ICJ (Interoperable Java Card) file [back] to a CAP file.
+    example usage:
+        with io.open(sys.argv[1],"rb") as f, zipfile.ZipFile(sys.argv[2], 
"wb") as z:
+        ijc_to_cap(f, z)
+    """
+    TAGS = ["Header", "Directory", "Applet", "Import", "ConstantPool", 
"Class", "Method", "StaticField", "RefLocation",
+            "Export", "Descriptor", "Debug"]
     b = in_file.read()
     while len(b):
         tag, size = struct.unpack('!BH', b[0:3])
         out_zip.writestr(p+"/javacard/"+TAGS[tag-1]+".cap", b[0:3+size])
         b = b[3+size:]

-# example usage:
-# with io.open(sys.argv[1],"rb") as f, zipfile.ZipFile(sys.argv[2], "wb") as z:
-#     ijc_to_cap(f, z)

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39194?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1d02098320cfbe17a0eb1bfdcf3bc85034cc8e20
Gerrit-Change-Number: 39194
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <[email protected]>

Reply via email to