<s> import sublime <EOL> import sublime_plugin <EOL> import bh_wrapping <EOL> class SwapBrackets ( bh_wrapping . WrapBrackets ) : <EOL> def wrap ( self , wrap_entry ) : <EOL> if wrap_entry < <NUM_LIT:0> : <EOL> return <EOL> self . _style = [ "<STR_LIT>" ] <EOL> self . brackets = self . _brackets [ wrap_entry ] <EOL> self . wrap_brackets ( <NUM_LIT:0> ) <EOL> class SwapBracketsCommand ( sublime_plugin . WindowCommand ) : <EOL> def finalize ( self , callback ) : <EOL> if self . view is not None : <EOL> if not self . view . settings ( ) . get ( "<STR_LIT>" , False ) : <EOL> callback ( ) <EOL> else : <EOL> sublime . set_timeout ( lambda : self . finalize ( callback ) , <NUM_LIT:100> ) <EOL> def swap_brackets ( self , value ) : <EOL> if value < <NUM_LIT:0> : <EOL> return <EOL> self . brackets = self . wrap . _brackets [ value ] <EOL> self . window . run_command ( <EOL> "<STR_LIT>" , <EOL> { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:type>" : [ "<STR_LIT>" ] , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> } <EOL> ) <EOL> self . view = self . window . active_view ( ) <EOL> sublime . set_timeout ( lambda : self . finalize ( lambda : self . wrap . wrap ( value ) ) , <NUM_LIT:100> ) <EOL> def run ( self ) : <EOL> view = self . window . active_view ( ) <EOL> if view is None : <EOL> return <EOL> self . wrap = SwapBrackets ( view , "<STR_LIT>" , "<STR_LIT>" ) <EOL> if len ( self . wrap . _menu ) : <EOL> self . window . show_quick_panel ( <EOL> self . wrap . _menu , <EOL> self . swap_brackets <EOL> ) </s>
