def _parse_task_stderr(lines):
 task_error = None
 stack_trace_start_line = None
 for (line_num, line) in enumerate(lines):
  line = line.rstrip('\r\n')
  if _SUBPROCESS_FAILED_STACK_TRACE_START.match(line):
   stack_trace_start_line = line_num
   continue
  if (stack_trace_start_line is not None):
   if (line.lstrip() != line):
    continue
   else:
    stack_trace_start_line = None
  if _TASK_STDERR_IGNORE_RE.match(line):
   if (task_error and ('num_lines' not in task_error)):
    task_error['num_lines'] = (line_num - task_error['start_line'])
   continue
  elif ((not task_error) or line.startswith('+ ')):
   task_error = dict(message=line, start_line=line_num)
  else:
   task_error['message'] += ('\n' + line)
 if task_error:
  if ('num_lines' not in task_error):
   end_line = (stack_trace_start_line or (line_num + 1))
   task_error['num_lines'] = (end_line - task_error['start_line'])
  return task_error
 else:
  return None

def _parse_task_stderr ( lines ) : task_error = None stack_trace_start_line = None for ( line_num , line ) in enumerate ( lines ) : line = line . rstrip ( '\r\n' ) if _SUBPROCESS_FAILED_STACK_TRACE_START . match ( line ) : stack_trace_start_line = line_num continue if ( stack_trace_start_line is not None ) : if ( line . lstrip ( ) != line ) : continue else : stack_trace_start_line = None if _TASK_STDERR_IGNORE_RE . match ( line ) : if ( task_error and ( 'num_lines' not in task_error ) ) : task_error [ 'num_lines' ] = ( line_num - task_error [ 'start_line' ] ) continue elif ( ( not task_error ) or line . startswith ( '+ ' ) ) : task_error = dict ( message = line , start_line = line_num ) else : task_error [ 'message' ] += ( '\n' + line ) if task_error : if ( 'num_lines' not in task_error ) : end_line = ( stack_trace_start_line or ( line_num + 1 ) ) task_error [ 'num_lines' ] = ( end_line - task_error [ 'start_line' ] ) return task_error else : return None
attempt to explain any error in task stderr .