<s> import argparse <EOL> import processor <EOL> import sys <EOL> import json <EOL> import os <EOL> def emit ( * ents ) : <EOL> for ent in ents : <EOL> if type ( ent ) != type ( [ ] ) : <EOL> ent = [ ent ] <EOL> for k in ent : <EOL> print json . dumps ( k ) <EOL> class ProcessorMapper ( processor . Processor ) : <EOL> def __init__ ( self , mapper , kinds = [ ] ) : <EOL> super ( ProcessorMapper , self ) . __init__ ( kinds ) <EOL> self . mapper = mapper <EOL> def resolve ( self ) : <EOL> print >> sys . stderr , '<STR_LIT>' , self . processed <EOL> for ent in self . block : <EOL> exec ( self . mapper ) <EOL> def argparse_prepare ( sub ) : <EOL> sub . add_argument ( '<STR_LIT>' , '<STR_LIT>' , nargs = '<STR_LIT:+>' , help = '<STR_LIT>' ) <EOL> def argparse_exec ( args ) : <EOL> try : <EOL> with os . fdopen ( <NUM_LIT:3> , '<STR_LIT:r>' ) as f : <EOL> mapper = f . read ( ) <EOL> except OSError as e : <EOL> print >> sys . stderr , '<STR_LIT>' <EOL> return sys . exit ( <NUM_LIT:1> ) <EOL> processor = ProcessorMapper ( mapper , args . kinds ) <EOL> processor . process ( ) </s>
