<s> """<STR_LIT>""" <EOL> import os <EOL> import sublime <EOL> import sublime_plugin <EOL> from HackerEarth import HackerEarth <EOL> import HelpGuide <EOL> class HacklimeCompileCommand ( sublime_plugin . TextCommand ) : <EOL> def run ( self , edit ) : <EOL> filepath = self . view . file_name ( ) . encode ( "<STR_LIT:utf-8>" ) <EOL> instance = HackerEarth ( filepath ) <EOL> response = instance . Contact ( ) <EOL> """<STR_LIT>""" <EOL> if ( '<STR_LIT>' in response ) : <EOL> show_error ( self . view . window , [ response [ '<STR_LIT>' ] ] ) <EOL> else : <EOL> output_text = instance . Output ( response ) <EOL> output = HacklimeOutput ( self . view , file_handler ( filepath ) , output_text ) <EOL> output . show ( ) <EOL> class HacklimeRunCommand ( sublime_plugin . TextCommand ) : <EOL> def run ( self , edit ) : <EOL> filepath = self . view . file_name ( ) . encode ( "<STR_LIT:utf-8>" ) <EOL> instance = HackerEarth ( filepath ) <EOL> response = instance . Contact ( ) <EOL> if ( '<STR_LIT>' in response ) : <EOL> show_error ( self . view . window , [ response [ '<STR_LIT>' ] ] ) <EOL> else : <EOL> output_text = instance . Output ( response ) <EOL> output = HacklimeOutput ( self . view , file_handler ( filepath ) , output_text ) <EOL> output . show ( ) <EOL> class HacklimeHelpCommand ( sublime_plugin . WindowCommand ) : <EOL> def run ( self ) : <EOL> self . help_view = self . window . get_output_panel ( "<STR_LIT>" ) <EOL> self . help_view . set_read_only ( False ) <EOL> edit = self . help_view . begin_edit ( ) <EOL> self . help_view . insert ( edit , self . help_view . size ( ) , HelpGuide . helptext ) <EOL> self . help_view . end_edit ( edit ) <EOL> self . help_view . set_read_only ( True ) <EOL> self . window . run_command ( "<STR_LIT>" , { "<STR_LIT>" : "<STR_LIT>" } ) <EOL> class HacklimeOutput : <EOL> def __init__ ( self , view , output_file , text ) : <EOL> self . view = view <EOL> self . filename = output_file <EOL> self . text = text <EOL> def show ( self ) : <EOL> window = self . view . window ( ) <EOL> output_view = window . new_file ( ) <EOL> output_view . set_name ( self . filename ) <EOL> editor = output_view . begin_edit ( ) <EOL> output_view . insert ( editor , output_view . size ( ) , self . text ) <EOL> output_view . end_edit ( editor ) <EOL> def file_handler ( filepath ) : <EOL> File = filepath . split ( '<STR_LIT:/>' ) [ - <NUM_LIT:1> ] <EOL> output_File = '<STR_LIT>' + File . replace ( File . split ( '<STR_LIT:.>' ) [ - <NUM_LIT:1> ] , '<STR_LIT>' ) <EOL> return output_File <EOL> def show_error ( errors , window ) : <EOL> window . show_quick_panel ( errors , None , sublime . MONOSPACE_FONT ) </s>
