#NEWLINE# def _permuteSequence( self , seq ) : #NEWLINE# #INDENT# ' Helper function for calculating the job list\n        ' #NEWLINE# n = len ( seq ) #NEWLINE# if ( n <= 1 ) : #NEWLINE# #INDENT# return seq #NEWLINE# #UNINDENT# mid = int ( ( n / 2 ) ) #NEWLINE# left = self . _permuteSequence ( seq [ : mid ] ) #NEWLINE# right = self . _permuteSequence ( seq [ ( mid + 1 ) : ] ) #NEWLINE# ret = [ seq [ mid ] ] #NEWLINE# while ( left or right ) : #NEWLINE# #INDENT# if left : #NEWLINE# #INDENT# ret . append ( left . pop ( 0 ) ) #NEWLINE# #UNINDENT# if right : #NEWLINE# #INDENT# ret . append ( right . pop ( 0 ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ret