<s> import sys <EOL> import ast <EOL> import pythonjs <EOL> class TransformSuperCalls ( ast . NodeVisitor ) : <EOL> def __init__ ( self , node , class_names ) : <EOL> self . _class_names = class_names <EOL> self . visit ( node ) <EOL> def visit_Call ( self , node ) : <EOL> if isinstance ( node . func , ast . Attribute ) and isinstance ( node . func . value , ast . Name ) and node . func . value . id in self . _class_names : <EOL> node . func . attr = '<STR_LIT>' + node . func . attr <EOL> class CollectNames ( ast . NodeVisitor ) : <EOL> def __init__ ( self ) : <EOL> self . _names = [ ] <EOL> def visit_Name ( self , node ) : <EOL> self . _names . append ( node ) <EOL> def collect_names ( node ) : <EOL> a = CollectNames ( ) <EOL> a . visit ( node ) <EOL> return a . _names <EOL> class DartGenerator ( pythonjs . JSGenerator ) : <EOL> def __init__ ( self , requirejs = False , insert_runtime = False ) : <EOL> pythonjs . JSGenerator . __init__ ( self , requirejs = False , insert_runtime = False ) <EOL> self . _classes = dict ( ) <EOL> self . _class_props = dict ( ) <EOL> self . _raw_dict = False <EOL> def visit_With ( self , node ) : <EOL> s = [ ] <EOL> for b in node . body : <EOL> a = self . visit ( b ) <EOL> a = a . replace ( '<STR_LIT>' , '<STR_LIT:\n>' ) <EOL> a = a . strip ( ) [ <NUM_LIT:1> : - <NUM_LIT:2> ] <EOL> s . append ( a ) <EOL> return '<STR_LIT:\n>' . join ( s ) <EOL> def _visit_subscript_ellipsis ( self , node ) : <EOL> name = self . visit ( node . value ) <EOL> return '<STR_LIT>' % name <EOL> def visit_List ( self , node ) : <EOL> return '<STR_LIT>' % '<STR_LIT:U+002CU+0020>' . join ( map ( self . visit , node . elts ) ) <EOL> def visit_Dict ( self , node ) : <EOL> a = [ ] <EOL> for i in range ( len ( node . keys ) ) : <EOL> k = self . visit ( node . keys [ i ] ) <EOL> v = self . visit ( node . values [ i ] ) <EOL> a . append ( '<STR_LIT>' % ( k , v ) ) <EOL> b = '<STR_LIT:U+002C>' . join ( a ) <EOL> if self . _raw_dict : <EOL> return '<STR_LIT>' % b <EOL> else : <EOL> return '<STR_LIT>' % b <EOL> def visit_ClassDef ( self , node ) : <EOL> node . _parents = set ( ) <EOL> out = [ ] <EOL> extends = False <EOL> props = set ( [ '<STR_LIT>' ] ) <EOL> bases = set ( ) <EOL> base_classes = set ( ) <EOL> self . _classes [ node . name ] = node <EOL> self . _class_props [ node . name ] = props <EOL> for decor in node . decorator_list : <EOL> if isinstance ( decor , ast . Call ) : <EOL> props . update ( [ self . visit ( a ) for a in decor . args ] ) <EOL> elif isinstance ( decor , ast . Attribute ) and isinstance ( decor . value , ast . Name ) and decor . value . id == '<STR_LIT>' : <EOL> if decor . attr == '<STR_LIT>' : <EOL> extends = True <EOL> props . add ( '<STR_LIT>' ) <EOL> for name_node in collect_names ( node ) : <EOL> if name_node . id == '<STR_LIT>' : <EOL> name_node . id = '<STR_LIT>' <EOL> else : <EOL> raise SyntaxError <EOL> for base in node . bases : <EOL> n = self . visit ( base ) <EOL> if n == '<STR_LIT:object>' : <EOL> continue <EOL> node . _parents . add ( n ) <EOL> bases . add ( n ) <EOL> if n in self . _class_props : <EOL> props . update ( self . _class_props [ n ] ) <EOL> base_classes . add ( self . _classes [ n ] ) <EOL> else : <EOL> continue <EOL> for p in self . _classes [ n ] . _parents : <EOL> bases . add ( p ) <EOL> props . update ( self . _class_props [ p ] ) <EOL> base_classes . add ( self . _classes [ p ] ) <EOL> if bases : <EOL> if extends : <EOL> assert len ( bases ) == <NUM_LIT:1> <EOL> out . append ( '<STR_LIT>' % ( node . name , '<STR_LIT:U+002C>' . join ( bases ) ) ) <EOL> else : <EOL> out . append ( '<STR_LIT>' % ( node . name , '<STR_LIT:U+002CU+0020>' . join ( bases ) ) ) <EOL> else : <EOL> out . append ( '<STR_LIT>' % node . name ) <EOL> self . push ( ) <EOL> for p in props : <EOL> out . append ( self . indent ( ) + '<STR_LIT>' % p ) <EOL> method_names = set ( ) <EOL> for b in node . body : <EOL> if isinstance ( b , ast . With ) : <EOL> out . append ( self . visit ( b ) ) <EOL> elif isinstance ( b , ast . FunctionDef ) and len ( b . decorator_list ) : <EOL> for name_node in collect_names ( b ) : <EOL> if name_node . id == '<STR_LIT>' : <EOL> name_node . id = '<STR_LIT>' <EOL> b . args . args = b . args . args [ <NUM_LIT:1> : ] <EOL> out . append ( self . visit ( b ) ) <EOL> elif extends : <EOL> if isinstance ( b , ast . FunctionDef ) : <EOL> b . args . args = b . args . args [ <NUM_LIT:1> : ] <EOL> if b . name == node . name : <EOL> args = [ self . visit ( a ) for a in b . args . args ] <EOL> args = '<STR_LIT:U+002C>' . join ( args ) <EOL> out . append ( <EOL> self . indent ( ) + '<STR_LIT>' % ( node . name , args , args ) <EOL> ) <EOL> b . name = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> b . name = '<STR_LIT>' <EOL> b . _prefix = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> b . name = '<STR_LIT>' <EOL> b . _prefix = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> b . name = '<STR_LIT>' <EOL> b . _prefix = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> b . name = '<STR_LIT>' <EOL> b . _prefix = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> b . name = '<STR_LIT>' <EOL> b . _prefix = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> b . name = '<STR_LIT>' <EOL> b . _prefix = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> b . name = '<STR_LIT>' <EOL> b . _prefix = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> b . name = '<STR_LIT>' <EOL> b . _prefix = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> b . name = '<STR_LIT>' <EOL> b . _prefix = '<STR_LIT>' <EOL> line = self . visit ( b ) <EOL> out . append ( line ) <EOL> elif isinstance ( b , ast . FunctionDef ) and b . name == node . name : <EOL> args , kwargs = self . get_args_kwargs_from_funcdef ( b , skip_self = True ) <EOL> kwargs_init = [ '<STR_LIT>' % ( x . split ( '<STR_LIT::>' ) [ <NUM_LIT:0> ] , x . split ( '<STR_LIT::>' ) [ <NUM_LIT:0> ] ) for x in kwargs ] <EOL> b . _prefix = '<STR_LIT>' <EOL> b . name = '<STR_LIT>' <EOL> out . append ( self . visit ( b ) ) <EOL> if args : <EOL> args = '<STR_LIT:U+002C>' . join ( args ) <EOL> if kwargs : <EOL> out . append ( <EOL> self . indent ( ) + '<STR_LIT>' % ( node . name , args , '<STR_LIT:U+002C>' . join ( kwargs ) , node . name , args , '<STR_LIT:U+002C>' . join ( kwargs_init ) ) <EOL> ) <EOL> else : <EOL> out . append ( <EOL> self . indent ( ) + '<STR_LIT>' % ( node . name , args , node . name , args ) <EOL> ) <EOL> elif kwargs : <EOL> out . append ( <EOL> self . indent ( ) + '<STR_LIT>' % ( node . name , '<STR_LIT:U+002C>' . join ( kwargs ) , node . name , '<STR_LIT:U+002C>' . join ( kwargs_init ) ) <EOL> ) <EOL> else : <EOL> out . append ( <EOL> self . indent ( ) + '<STR_LIT>' % ( node . name , node . name ) <EOL> ) <EOL> elif isinstance ( b , ast . FunctionDef ) : <EOL> method_names . add ( b . name ) <EOL> TransformSuperCalls ( b , bases ) <EOL> operator = False <EOL> if b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> elif b . name == '<STR_LIT>' : <EOL> operator = '<STR_LIT>' <EOL> args = [ self . visit ( a ) for a in b . args . args ] [ <NUM_LIT:1> : ] <EOL> args = '<STR_LIT:U+002C>' . join ( args ) <EOL> if operator and args : <EOL> out . append ( self . indent ( ) + '<STR_LIT>' % ( operator , args , node . name , b . name , args ) ) <EOL> elif operator : <EOL> out . append ( self . indent ( ) + '<STR_LIT>' % ( operator , node . name , b . name ) ) <EOL> elif args : <EOL> out . append ( self . indent ( ) + '<STR_LIT>' % ( b . name , args , node . name , b . name , args ) ) <EOL> else : <EOL> out . append ( self . indent ( ) + '<STR_LIT>' % ( b . name , node . name , b . name ) ) <EOL> b . _prefix = '<STR_LIT>' <EOL> name = b . name <EOL> b . name = '<STR_LIT>' % name <EOL> out . append ( self . visit ( b ) ) <EOL> b . name = name <EOL> else : <EOL> line = self . visit ( b ) <EOL> if line . startswith ( '<STR_LIT>' ) : <EOL> out . append ( self . indent ( ) + line ) <EOL> else : <EOL> out . append ( line ) <EOL> if not extends and base_classes : <EOL> for bnode in base_classes : <EOL> for b in bnode . body : <EOL> if isinstance ( b , ast . FunctionDef ) : <EOL> if b . name == '<STR_LIT>' : continue <EOL> if b . name in method_names : continue <EOL> args = [ self . visit ( a ) for a in b . args . args ] [ <NUM_LIT:1> : ] <EOL> args = '<STR_LIT:U+002C>' . join ( args ) <EOL> if args : <EOL> out . append ( self . indent ( ) + '<STR_LIT>' % ( b . name , args , bnode . name , b . name , args ) ) <EOL> else : <EOL> out . append ( self . indent ( ) + '<STR_LIT>' % ( b . name , bnode . name , b . name ) ) <EOL> self . pull ( ) <EOL> out . append ( '<STR_LIT:}>' ) <EOL> return '<STR_LIT:\n>' . join ( out ) <EOL> def get_args_kwargs_from_funcdef ( self , node , skip_self = False ) : <EOL> args = [ ] <EOL> kwargs = [ ] <EOL> if skip_self : nargs = node . args . args [ <NUM_LIT:1> : ] <EOL> else : nargs = node . args . args <EOL> offset = len ( nargs ) - len ( node . args . defaults ) <EOL> for i , arg in enumerate ( nargs ) : <EOL> a = arg . id <EOL> dindex = i - offset <EOL> if dindex >= <NUM_LIT:0> and node . args . defaults : <EOL> default_value = self . visit ( node . args . defaults [ dindex ] ) <EOL> kwargs . append ( '<STR_LIT>' % ( a , default_value ) ) <EOL> else : <EOL> args . append ( a ) <EOL> return args , kwargs <EOL> def _visit_for_prep_iter_helper ( self , node , out , iter_name ) : <EOL> out . append ( <EOL> self . indent ( ) + '<STR_LIT>' % ( iter_name , iter_name , iter_name ) <EOL> ) <EOL> def visit_Expr ( self , node ) : <EOL> s = self . visit ( node . value ) <EOL> if isinstance ( node . value , ast . Call ) and isinstance ( node . value . func , ast . Name ) and node . value . func . id == '<STR_LIT>' : <EOL> if s . endswith ( '<STR_LIT:}>' ) and '<STR_LIT>' in s . split ( '<STR_LIT:U+0020>' ) : <EOL> pass <EOL> elif not s . endswith ( '<STR_LIT:;>' ) : <EOL> s += '<STR_LIT:;>' <EOL> elif not s . endswith ( '<STR_LIT:;>' ) : <EOL> s += '<STR_LIT:;>' <EOL> return s <EOL> def visit_Print ( self , node ) : <EOL> args = [ self . visit ( e ) for e in node . values ] <EOL> if len ( args ) > <NUM_LIT:1> : <EOL> s = '<STR_LIT>' % '<STR_LIT:U+002CU+0020>' . join ( args ) <EOL> else : <EOL> s = '<STR_LIT>' % '<STR_LIT:U+002CU+0020>' . join ( args ) <EOL> return s <EOL> def visit_Assign ( self , node ) : <EOL> assert len ( node . targets ) == <NUM_LIT:1> <EOL> target = node . targets [ <NUM_LIT:0> ] <EOL> if isinstance ( target , ast . Tuple ) : <EOL> elts = [ self . visit ( e ) for e in target . elts ] <EOL> if self . indent ( ) : <EOL> return '<STR_LIT>' % ( '<STR_LIT:U+002C>' . join ( elts ) , self . visit ( node . value ) ) <EOL> else : <EOL> return '<STR_LIT>' % ( '<STR_LIT:U+002C>' . join ( elts ) , self . visit ( node . value ) ) <EOL> else : <EOL> target = self . visit ( target ) <EOL> value = self . visit ( node . value ) <EOL> if self . indent ( ) : <EOL> code = '<STR_LIT>' % ( target , value ) <EOL> else : <EOL> code = '<STR_LIT>' % ( target , value ) <EOL> return code <EOL> def _visit_function ( self , node ) : <EOL> getter = False <EOL> setter = False <EOL> args_typedefs = { } <EOL> for decor in node . decorator_list : <EOL> if isinstance ( decor , ast . Name ) and decor . id == '<STR_LIT>' : <EOL> getter = True <EOL> elif isinstance ( decor , ast . Attribute ) and isinstance ( decor . value , ast . Name ) and decor . attr == '<STR_LIT>' : <EOL> setter = True <EOL> elif isinstance ( decor , ast . Call ) and isinstance ( decor . func , ast . Name ) and decor . func . id == '<STR_LIT>' : <EOL> for key in decor . keywords : <EOL> args_typedefs [ key . arg ] = key . value . id <EOL> else : <EOL> raise SyntaxError <EOL> args = [ ] <EOL> oargs = [ ] <EOL> offset = len ( node . args . args ) - len ( node . args . defaults ) <EOL> varargs = False <EOL> varargs_name = None <EOL> for i , arg in enumerate ( node . args . args ) : <EOL> a = arg . id <EOL> if a in args_typedefs : <EOL> a = '<STR_LIT>' % ( args_typedefs [ a ] , a ) <EOL> dindex = i - offset <EOL> if a . startswith ( '<STR_LIT>' ) : <EOL> varargs_name = a . split ( '<STR_LIT>' ) [ - <NUM_LIT:1> ] <EOL> varargs = [ '<STR_LIT>' % n for n in range ( <NUM_LIT:16> ) ] <EOL> args . append ( '<STR_LIT>' % '<STR_LIT:U+002C>' . join ( varargs ) ) <EOL> elif dindex >= <NUM_LIT:0> and node . args . defaults : <EOL> default_value = self . visit ( node . args . defaults [ dindex ] ) <EOL> oargs . append ( '<STR_LIT>' % ( a , default_value ) ) <EOL> else : <EOL> args . append ( a ) <EOL> if oargs : <EOL> args . append ( '<STR_LIT>' % '<STR_LIT:U+002C>' . join ( oargs ) ) <EOL> buffer = self . indent ( ) <EOL> if hasattr ( node , '<STR_LIT>' ) : buffer += node . _prefix + '<STR_LIT:U+0020>' <EOL> if getter : <EOL> buffer += '<STR_LIT>' % node . name <EOL> elif setter : <EOL> buffer += '<STR_LIT>' % ( node . name , '<STR_LIT:U+002CU+0020>' . join ( args ) ) <EOL> else : <EOL> buffer += '<STR_LIT>' % ( node . name , '<STR_LIT:U+002CU+0020>' . join ( args ) ) <EOL> self . push ( ) <EOL> if varargs : <EOL> buffer += '<STR_LIT>' % varargs_name <EOL> for i , n in enumerate ( varargs ) : <EOL> buffer += '<STR_LIT>' % ( n , varargs_name , n ) <EOL> body = list ( ) <EOL> for child in node . body : <EOL> if isinstance ( child , ast . Str ) : <EOL> continue <EOL> else : <EOL> body . append ( self . indent ( ) + self . visit ( child ) ) <EOL> buffer += '<STR_LIT:\n>' . join ( body ) <EOL> self . pull ( ) <EOL> buffer += '<STR_LIT>' % self . indent ( ) <EOL> return buffer <EOL> def visit_Is ( self , node ) : <EOL> return '<STR_LIT>' <EOL> def visit_IsNot ( self , node ) : <EOL> return '<STR_LIT>' <EOL> def visit_NotEq ( self , node ) : <EOL> return '<STR_LIT>' <EOL> def _visit_call_helper ( self , node ) : <EOL> if node . args : <EOL> args = [ self . visit ( e ) for e in node . args ] <EOL> args = '<STR_LIT:U+002CU+0020>' . join ( [ e for e in args if e ] ) <EOL> else : <EOL> args = '<STR_LIT>' <EOL> if isinstance ( node . func , ast . Name ) and node . func . id == '<STR_LIT>' and len ( node . args ) == <NUM_LIT:2> : <EOL> func = '<STR_LIT>' <EOL> else : <EOL> func = self . visit ( node . func ) <EOL> if node . keywords : <EOL> kwargs = '<STR_LIT:U+002C>' . join ( [ '<STR_LIT>' % ( x . arg , self . visit ( x . value ) ) for x in node . keywords ] ) <EOL> if args : <EOL> return '<STR_LIT>' % ( func , '<STR_LIT:U+002C>' . join ( args ) , kwargs ) <EOL> else : <EOL> return '<STR_LIT>' % ( func , kwargs ) <EOL> else : <EOL> return '<STR_LIT>' % ( func , args ) <EOL> def _visit_call_helper_var ( self , node ) : <EOL> args = [ self . visit ( a ) for a in node . args ] <EOL> if self . _function_stack : <EOL> fnode = self . _function_stack [ - <NUM_LIT:1> ] <EOL> rem = [ ] <EOL> for arg in args : <EOL> if arg in fnode . _local_vars : <EOL> rem . append ( arg ) <EOL> else : <EOL> fnode . _local_vars . add ( arg ) <EOL> for arg in rem : <EOL> args . remove ( arg ) <EOL> out = [ ] <EOL> if args : <EOL> out . append ( '<STR_LIT>' + '<STR_LIT:U+002C>' . join ( args ) ) <EOL> if node . keywords : <EOL> for key in node . keywords : <EOL> out . append ( '<STR_LIT>' % ( key . value . id , key . arg ) ) <EOL> return '<STR_LIT:;>' . join ( out ) <EOL> def _visit_call_helper_list ( self , node ) : <EOL> name = self . visit ( node . func ) <EOL> if node . args : <EOL> args = [ self . visit ( e ) for e in node . args ] <EOL> args = '<STR_LIT:U+002CU+0020>' . join ( [ e for e in args if e ] ) <EOL> else : <EOL> args = '<STR_LIT>' <EOL> return '<STR_LIT>' % ( name , args ) <EOL> def _visit_call_helper_numpy_array ( self , node ) : <EOL> simd = { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> arg_name = args = None <EOL> direct = False <EOL> if isinstance ( node . args [ <NUM_LIT:0> ] , ast . Name ) : <EOL> arg_name = node . args [ <NUM_LIT:0> ] . id <EOL> else : <EOL> args = '<STR_LIT:U+002C>' . join ( [ self . visit ( a ) for a in node . args [ <NUM_LIT:0> ] . elts ] ) <EOL> if len ( node . args [ <NUM_LIT:0> ] . elts ) == <NUM_LIT:4> : <EOL> direct = True <EOL> if node . keywords : <EOL> for key in node . keywords : <EOL> if key . arg == '<STR_LIT>' : <EOL> if isinstance ( key . value , ast . Attribute ) and key . value . attr in simd : <EOL> if arg_name : <EOL> return '<STR_LIT>' % arg_name <EOL> elif direct : <EOL> return '<STR_LIT>' % ( simd [ key . value . attr ] , args ) <EOL> else : <EOL> return '<STR_LIT>' % args <EOL> else : <EOL> raise NotImplementedError ( '<STR_LIT>' ) <EOL> def _visit_call_helper_instanceof ( self , node ) : <EOL> args = map ( self . visit , node . args ) <EOL> if len ( args ) == <NUM_LIT:2> : <EOL> if args [ <NUM_LIT:1> ] == '<STR_LIT>' : <EOL> args [ <NUM_LIT:1> ] = '<STR_LIT>' <EOL> return '<STR_LIT>' % tuple ( args ) <EOL> else : <EOL> raise SyntaxError ( args ) <EOL> def visit_ExceptHandler ( self , node ) : <EOL> return '<STR_LIT:\n>' . join ( [ self . visit ( n ) for n in node . body ] ) <EOL> def visit_Compare ( self , node ) : <EOL> specials = { <EOL> '<STR_LIT:<>' : '<STR_LIT>' , <EOL> '<STR_LIT:>>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> comp = [ ] <EOL> if len ( node . ops ) == <NUM_LIT:0> : <EOL> comp . append ( '<STR_LIT:(>' ) <EOL> comp . append ( self . visit ( node . left ) ) <EOL> comp . append ( '<STR_LIT:)>' ) <EOL> else : <EOL> if self . visit ( node . ops [ <NUM_LIT:0> ] ) in specials : <EOL> pass <EOL> else : <EOL> comp . append ( '<STR_LIT:(>' ) <EOL> comp . append ( self . visit ( node . left ) ) <EOL> comp . append ( '<STR_LIT:)>' ) <EOL> for i in range ( len ( node . ops ) ) : <EOL> op = self . visit ( node . ops [ i ] ) <EOL> if op in specials : <EOL> comp . append ( specials [ op ] + '<STR_LIT>' % self . visit ( node . left ) ) <EOL> else : <EOL> comp . append ( op ) <EOL> if isinstance ( node . comparators [ i ] , ast . BinOp ) : <EOL> comp . append ( '<STR_LIT:(>' ) <EOL> comp . append ( self . visit ( node . comparators [ i ] ) ) <EOL> comp . append ( '<STR_LIT:)>' ) <EOL> else : <EOL> comp . append ( self . visit ( node . comparators [ i ] ) ) <EOL> if op in specials : <EOL> comp . append ( '<STR_LIT:)>' ) <EOL> return '<STR_LIT:U+0020>' . join ( comp ) <EOL> def main ( script ) : <EOL> tree = ast . parse ( script ) <EOL> return DartGenerator ( ) . visit ( tree ) <EOL> def command ( ) : <EOL> scripts = [ ] <EOL> if len ( sys . argv ) > <NUM_LIT:1> : <EOL> for arg in sys . argv [ <NUM_LIT:1> : ] : <EOL> if arg . endswith ( '<STR_LIT>' ) : <EOL> scripts . append ( arg ) <EOL> if len ( scripts ) : <EOL> a = [ ] <EOL> for script in scripts : <EOL> a . append ( open ( script , '<STR_LIT:rb>' ) . read ( ) ) <EOL> data = '<STR_LIT:\n>' . join ( a ) <EOL> else : <EOL> data = sys . stdin . read ( ) <EOL> js = main ( data ) <EOL> print ( js ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> command ( ) </s>
