def _extract_buffers(commands):
 data_commands = [command for command in commands if (command[0] == 'DATA')]
 buffers = [data_command[3] for data_command in data_commands]
 commands_modified = list(commands)
 buffer_index = 0
 for (i, command) in enumerate(commands_modified):
  if (command[0] == 'DATA'):
   commands_modified[i] = (command[:3] + ({'buffer_index': buffer_index},))
   buffer_index += 1
 return (commands_modified, buffers)

def _extract_buffers ( commands ) : data_commands = [ command for command in commands if ( command [ 0 ] == 'DATA' ) ] buffers = [ data_command [ 3 ] for data_command in data_commands ] commands_modified = list ( commands ) buffer_index = 0 for ( i , command ) in enumerate ( commands_modified ) : if ( command [ 0 ] == 'DATA' ) : commands_modified [ i ] = ( command [ : 3 ] + ( { 'buffer_index' : buffer_index } , ) ) buffer_index += 1 return ( commands_modified , buffers )
extract all data buffers from the list of glir commands .