<commit_before>from .parser cimport Token, BaseDaffodilDelegate


cdef bint _in(a, b):
    return b.__contains__(a)

cdef bint _not_in(a, b):
    return not b.__contains__(a)

cdef bint _eq(a, b):
    return a == b

cdef bint _ne(a, b):
    return a != b

cdef bint _lt(a, b):
    return a < b

cdef bint _le(a, b):
    return a <= b

cdef bint _gt(a, b):
    return a > b

cdef bint _ge(a, b):
    return a >= b


_do_nothing_predicate = lambda: True


# type for a func that takes an object (list in this case) and returns a bool
ctypedef bint (*CMP_Func)(object, object)

cdef class CMPFunctionHandler:
    cdef CMP_Func test
    cdef str key
    cdef object val
    cdef bint err_ret_val

    def __call__(self, object data_point):
        return self._call(data_point)

    cdef bint _call(self, object data_point):
        cdef object dp_val
        cdef object cmp_val

        if data_point is None:<commit_msg>None evaluates to False<commit_after>from .parser cimport Token, BaseDaffodilDelegate


cdef bint _in(a, b):
    return b.__contains__(a)

cdef bint _not_in(a, b):
    return not b.__contains__(a)

cdef bint _eq(a, b):
    return a == b

cdef bint _ne(a, b):
    return a != b

cdef bint _lt(a, b):
    try:
        return a < b
    except TypeError:
        return False

cdef bint _le(a, b):
    try:
        return a <= b
    except TypeError:
        return False

cdef bint _gt(a, b):
    try:
        return a > b
    except TypeError:
        return False

cdef bint _ge(a, b):
    try:
        return a >= b
    except TypeError:
        return False


_do_nothing_predicate = lambda: True


# type for a func that takes an object (list in this case) and returns a bool
ctypedef bint (*CMP_Func)(object, object)

cdef class CMPFunctionHandler:
    cdef CMP_Func test
    cdef str key
    cdef object val
    cdef bint err_ret_val

    def __call__(self, object data_point):
        return self._call(data_point)

    cdef bint _call(self, object data_point):
        cdef object dp_val
        cdef object cmp_val

        if data_point is None:
{'fraction_non_alphanumeric': 0.07818532818532818, 'fraction_numerical': 0.0, 'mean_word_length': 2.6114982578397212, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5734107', 'n_tokens_mistral': 757, 'n_tokens_neox': 737, 'n_words': 260}