1010
1111import pdl
1212
13+
1314def main (argv ):
14- parser = argparse .ArgumentParser (description = (
15- "Converts from .pdl to .json by invoking the pdl Python module." ))
16- parser .add_argument ('--map_binary_to_string' , type = bool ,
17- help = ('If set, binary in the .pdl is mapped to a '
18- 'string in .json. Client code will have to '
19- 'base64 decode the string to get the payload.' ))
15+ parser = argparse .ArgumentParser (
16+ description = ("Converts from .pdl to .json by invoking the pdl Python module." )
17+ )
18+ parser .add_argument (
19+ "--map_binary_to_string" ,
20+ type = bool ,
21+ help = (
22+ "If set, binary in the .pdl is mapped to a "
23+ "string in .json. Client code will have to "
24+ "base64 decode the string to get the payload."
25+ ),
26+ )
2027 parser .add_argument ("pdl_file" , help = "The .pdl input file to parse." )
2128 parser .add_argument ("json_file" , help = "The .json output file write." )
2229 args = parser .parse_args (argv )
@@ -26,10 +33,10 @@ def main(argv):
2633 protocol = pdl .loads (pdl_string , file_name , args .map_binary_to_string )
2734 input_file .close ()
2835
29- output_file = open (os .path .normpath (args .json_file ), 'w' )
30- json .dump (protocol , output_file , indent = 4 , separators = (',' , ': ' ))
36+ output_file = open (os .path .normpath (args .json_file ), "w" )
37+ json .dump (protocol , output_file , indent = 4 , separators = ("," , ": " ))
3138 output_file .close ()
3239
3340
34- if __name__ == ' __main__' :
41+ if __name__ == " __main__" :
3542 sys .exit (main (sys .argv [1 :]))
0 commit comments