<s> from suplemon . suplemon_module import Module <EOL> class Eval ( Module ) : <EOL> def run ( self , app , editor , args ) : <EOL> if not args : <EOL> return self . evaluate_lines ( editor ) <EOL> else : <EOL> return self . evaluate_input ( args ) <EOL> def evaluate_input ( self , inp ) : <EOL> try : <EOL> value = eval ( inp ) <EOL> except : <EOL> self . app . set_status ( "<STR_LIT>" ) <EOL> return False <EOL> self . app . set_status ( "<STR_LIT>" . format ( value ) ) <EOL> return True <EOL> def evaluate_lines ( self , editor ) : <EOL> line_nums = editor . get_lines_with_cursors ( ) <EOL> for num in line_nums : <EOL> line = editor . get_line ( num ) <EOL> try : <EOL> value = eval ( line . get_data ( ) ) <EOL> except : <EOL> continue <EOL> line . set_data ( str ( value ) ) <EOL> module = { <EOL> "<STR_LIT:class>" : Eval , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> } </s>
