<s> import sys <EOL> import argparse <EOL> import flynn <EOL> import json <EOL> def main ( args = sys . argv [ <NUM_LIT:1> : ] ) : <EOL> formats = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } <EOL> argparser = argparse . ArgumentParser ( ) <EOL> argparser . add_argument ( "<STR_LIT>" , "<STR_LIT>" , choices = formats , default = "<STR_LIT>" ) <EOL> argparser . add_argument ( "<STR_LIT>" , "<STR_LIT>" , choices = formats , default = "<STR_LIT>" ) <EOL> args = argparser . parse_args ( args ) <EOL> if args . input_format in { "<STR_LIT>" , "<STR_LIT>" } : <EOL> input_format = "<STR_LIT>" <EOL> else : <EOL> input_format = args . input_format <EOL> output_format = args . output_format <EOL> intermediate = None <EOL> if input_format in { "<STR_LIT>" , "<STR_LIT>" } : <EOL> intermediate = flynn . load ( sys . stdin . buffer . raw ) <EOL> elif input_format in { "<STR_LIT>" , "<STR_LIT>" } : <EOL> intermediate = flynn . loadh ( sys . stdin . read ( ) ) <EOL> elif input_format == "<STR_LIT>" : <EOL> intermediate = json . load ( sys . stdin ) <EOL> if output_format == "<STR_LIT>" : <EOL> flynn . dump ( intermediate , sys . stdout . buffer . raw ) <EOL> elif output_format == "<STR_LIT>" : <EOL> flynn . dump ( intermediate , sys . stdout . buffer . raw , cls = flynn . encoder . InfiniteEncoder ) <EOL> elif output_format == "<STR_LIT>" : <EOL> sys . stdout . write ( flynn . dumph ( intermediate ) ) <EOL> sys . stdout . write ( "<STR_LIT:\n>" ) <EOL> elif output_format == "<STR_LIT>" : <EOL> sys . stdout . write ( flynn . dumph ( intermediate , cls = flynn . encoder . InfiniteEncoder ) ) <EOL> sys . stdout . write ( "<STR_LIT:\n>" ) <EOL> elif output_format == "<STR_LIT>" : <EOL> json . dump ( intermediate , sys . stdout ) <EOL> sys . stdout . write ( "<STR_LIT:\n>" ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
