def _interpret_history_log(fs, matches):
    """Extract counters and errors from history log.

    Matches is a list of dicts with the keys *job_id* and *yarn*
    (see :py:func:`_ls_history_logs()`)

    We expect *matches* to contain at most one match; further matches
    will be ignored.

    Returns a dictionary with the keys *counters* and *errors*.
    """
    # we expect to go through this for loop 0 or 1 times
    for match in matches:
        path = match['path']

        if match['yarn']:
            # not yet implemented
            result = _parse_yarn_history_log(_cat_log(fs, path))
        else:
            result = _parse_pre_yarn_history_log(_cat_log(fs, path))

        # patch path, task_id, etc. into errors
        for error in result.get('errors') or ():
            if error in 'hadoop_error':
                error['hadoop_error']['path'] = path
            _add_implied_task_id(error)

        return result

    return {}
dataset/ETHPy150Open Yelp/mrjob/mrjob/logs/history.py/_interpret_history_log/swapped operands of `in`