def __call__(self, test, file, regex=None, match_type=None, threshold=None, expected=None):
    regex = re.compile(regex)
    matches = []
    for line in file.readlines():
        matches.extend(regex.findall(line))
    if (threshold and (int(threshold) > 0)):
        return (len(matches) >= int(threshold))
    elif (match_type == result_parsers.MATCH_FIRST):
        matches = (None if (not matches) else matches[0])
    elif (match_type == result_parsers.MATCH_LAST):
        matches = (None if (not matches) else matches[(- 1)])
    elif (match_type == result_parsers.MATCH_ALL):
        pass
    else:
        raise result_parsers.ResultParserError("Invalid 'matches' value '{}'".format('matches'))
    if (not expected):
        return matches
    else:
        if (not isinstance(matches, list)):
            matches = [matches]
        ret_vals = []
        for i in range(0, len(matches)):
            match = matches[i]
            if ('.' in match):
                match = float(match)
            elif (match != ''):
                match = int(match)
            for j in range(0, len(expected)):
                if (':' not in expected[j]):
                    expect = expected[j]
                    if ('.' in expect):
                        expect = float(expect)
                    elif (expect != ''):
                        expect = int(expect)
                    if (match == expect):
                        ret_vals.append(True)
                elif (':' in expected[j]):
                    (low, high) = self.range_re.search(expected[j]).groups()
                    if ('.' in low):
                        low = float(low)
                    elif (low != ''):
                        low = int(low)
                    if ('.' in high):
                        high = float(high)
                    elif (high != ''):
                        high = int(high)
                    if ((low is '') and (match <= high)):
                        ret_vals.append(True)
                    elif ((high is '') and (match >= low)):
                        ret_vals.append(True)
                    elif (low <= match <= high):
                        ret_vals.append(True)
        return ret_vals
def __call__(self, test, file, regex=None, match_type=None, threshold=None, expected=None):
    regex = re.compile(regex)
    matches = []
    for line in file.readlines():
        matches.extend(regex.findall(line))
    if (threshold and (int(threshold) > 0)):
        return (len(matches) >= int(threshold))
    elif (match_type == result_parsers.MATCH_FIRST):
        matches = (None if (not matches) else matches[0])
    elif (match_type == result_parsers.MATCH_LAST):
        matches = (None if (not matches) else matches[(- 1)])
    elif (match_type == result_parsers.MATCH_ALL):
        pass
    else:
        raise result_parsers.ResultParserError("Invalid 'matches' value '{}'".format('matches'))
    if (not expected):
        return matches
    else:
        if (not isinstance(matches, list)):
            matches = [matches]
        ret_vals = []
        for i in range(0, len(matches)):
            match = matches[i]
            if ('.' in match):
                match = float(match)
            elif (match != ):
                match = int(match)
            for j in range(0, len(expected)):
                if (':' not in expected[j]):
                    expect = expected[j]
                    if ('.' in expect):
                        expect = float(expect)
                    elif (expect != ):
                        expect = int(expect)
                    if (match == expect):
                        ret_vals.append(True)
                elif (':' in expected[j]):
                    (low, high) = self.range_re.search(expected[j]).groups()
                    if ('.' in low):
                        low = float(low)
                    elif (low != ):
                        low = int(low)
                    if ('.' in high):
                        high = float(high)
                    elif (high != ):
                        high = int(high)
                    if ((low is ) and (match <= high)):
                        ret_vals.append(True)
                    elif ((high is ) and (match >= low)):
                        ret_vals.append(True)
                    elif (low <= match <= high):
                        ret_vals.append(True)
        return ret_vals