<s> import jasy . js . optimize . CryptPrivates as CryptPrivates <EOL> import jasy . js . optimize . BlockReducer as BlockReducer <EOL> import jasy . js . optimize . LocalVariables as LocalVariables <EOL> import jasy . js . optimize . CombineDeclarations as CombineDeclarations <EOL> import jasy . js . optimize . ClosureWrapper as ClosureWrapper <EOL> __all__ = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> class Error ( Exception ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , msg ) : <EOL> self . __msg = msg <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % ( self . __msg ) <EOL> class Optimization : <EOL> """<STR_LIT>""" <EOL> __key = None <EOL> def __init__ ( self , * args ) : <EOL> self . __optimizations = set ( ) <EOL> for flag in args : <EOL> self . __optimizations . add ( flag ) <EOL> def has ( self , flag ) : <EOL> """<STR_LIT>""" <EOL> return flag in self . __optimizations <EOL> def enable ( self , flag ) : <EOL> self . __optimizations . add ( flag ) <EOL> self . __key = None <EOL> def disable ( self , flag ) : <EOL> self . __optimizations . remove ( flag ) <EOL> self . __key = None <EOL> def apply ( self , tree ) : <EOL> """<STR_LIT>""" <EOL> enabled = self . __optimizations <EOL> if "<STR_LIT>" in enabled : <EOL> try : <EOL> ClosureWrapper . optimize ( tree ) <EOL> except CryptPrivates . Error as err : <EOL> raise Error ( err ) <EOL> if "<STR_LIT>" in enabled : <EOL> try : <EOL> CombineDeclarations . optimize ( tree ) <EOL> except CombineDeclarations . Error as err : <EOL> raise Error ( err ) <EOL> if "<STR_LIT>" in enabled : <EOL> try : <EOL> BlockReducer . optimize ( tree ) <EOL> except BlockReducer . Error as err : <EOL> raise Error ( err ) <EOL> if "<STR_LIT>" in enabled : <EOL> try : <EOL> LocalVariables . optimize ( tree ) <EOL> except LocalVariables . Error as err : <EOL> raise Error ( err ) <EOL> if "<STR_LIT>" in enabled : <EOL> try : <EOL> CryptPrivates . optimize ( tree , tree . fileId ) <EOL> except CryptPrivates . Error as err : <EOL> raise Error ( err ) <EOL> def getKey ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . __key is None : <EOL> self . __key = "<STR_LIT:+>" . join ( sorted ( self . __optimizations ) ) <EOL> return self . __key <EOL> __repr__ = getKey <EOL> __str__ = getKey </s>
