<s> r"""<STR_LIT>""" <EOL> from __future__ import with_statement <EOL> import sys <EOL> import simplejson as json <EOL> def main ( ) : <EOL> if len ( sys . argv ) == <NUM_LIT:1> : <EOL> infile = sys . stdin <EOL> outfile = sys . stdout <EOL> elif len ( sys . argv ) == <NUM_LIT:2> : <EOL> infile = open ( sys . argv [ <NUM_LIT:1> ] , '<STR_LIT:r>' ) <EOL> outfile = sys . stdout <EOL> elif len ( sys . argv ) == <NUM_LIT:3> : <EOL> infile = open ( sys . argv [ <NUM_LIT:1> ] , '<STR_LIT:r>' ) <EOL> outfile = open ( sys . argv [ <NUM_LIT:2> ] , '<STR_LIT:w>' ) <EOL> else : <EOL> raise SystemExit ( sys . argv [ <NUM_LIT:0> ] + "<STR_LIT>" ) <EOL> with infile : <EOL> try : <EOL> obj = json . load ( infile , <EOL> object_pairs_hook = json . OrderedDict , <EOL> use_decimal = True ) <EOL> except ValueError : <EOL> raise SystemExit ( sys . exc_info ( ) [ <NUM_LIT:1> ] ) <EOL> with outfile : <EOL> json . dump ( obj , outfile , sort_keys = True , indent = '<STR_LIT:U+0020>' , use_decimal = True ) <EOL> outfile . write ( '<STR_LIT:\n>' ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
