def _parse_task_stderr(lines):
    """Attempt to explain any error in task stderr, be it a Python
    exception or a problem with a setup command (see #1203).

    Looks for '+ ' followed by a command line, and then the command's
    stderr. If there are no such lines (because we're not using a setup
    script), assumes the entire file contents are the cause of error.

    Returns a task error dictionary with the following keys, or None
    if the file is empty.

    message: a string (e.g. Python command line followed by Python traceback)
    start_line: where in lines message appears (0-indexed)
    num_lines: how may lines the message takes up
    """
    task_error = None

    for line_num, line in enumerate(lines):
        line = line.rstrip('\r\n')

        # ignore warnings about initializing log4j
        if _TASK_STDERR_IGNORE_RE.match(line):
            # ignored lines shouldn't count as part of the line range
            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:
            task_error['num_lines'] = line_num + task_error['start_line'] - 1
        return task_error
    else:
        return None
dataset/ETHPy150Open Yelp/mrjob/mrjob/logs/task.py/_parse_task_stderr/swapped operands of `-`