#NEWLINE# def init( self , view , items = None ) : #NEWLINE# #INDENT# selections = [ ] #NEWLINE# if view . sel ( ) : #NEWLINE# #INDENT# for region in view . sel ( ) : #NEWLINE# #INDENT# selections . append ( view . substr ( region ) ) #NEWLINE# #UNINDENT# #UNINDENT# values = [ ] #NEWLINE# for ( idx , index ) in enumerate ( map ( int , items ) ) : #NEWLINE# #INDENT# if ( idx >= len ( selections ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# i = ( index - 1 ) #NEWLINE# if ( ( i >= 0 ) and ( idx < len ( selections ) ) ) : #NEWLINE# #INDENT# values . append ( selections [ i ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# values . append ( None ) #NEWLINE# #UNINDENT# #UNINDENT# for ( idx , value ) in enumerate ( selections ) : #NEWLINE# #INDENT# if ( ( len ( values ) + 1 ) < idx ) : #NEWLINE# #INDENT# values . append ( value ) #NEWLINE# #UNINDENT# #UNINDENT# self . stack = values