

@timed
def gen_predicates(num):
    res = []
    for x in range(num):
        r = random.randint(0, 5)
        if (r == 0):
            p_str = ("name is '%s' and not test" % random.choice(SELECT_WORDS))
        elif (r == 1):
            gender = ('Male' if (random.random() > 0.5) else 'Female')
            age = random.randint(1, 100)
            p_str = ("gender is '%s' and age > %d" % (gender, age))
        elif (r == 2):
            city_letter = chr((97 + random.randint(0, 25)))
            city_reg = ('^%s.*' % city_letter)
            age = random.randint(1, 100)
            p_str = ("age > %d and city matches '%s'" % (age, city_reg))
        elif (r == 3):
            interest = random.choice(SELECT_WORDS)
            p_str = ("interests contains '%s' and test" % interest)
        elif (r == 4):
            gender = ('Male' if random.random() else 'Female')
            p_str = ("name is '%s' or gender is '%s'" % (random.choice(SELECT_WORDS), gender))
        elif (r == 5):
            gender = ('Male' if random.random() else 'Female')
            age = random.randint(1, 100)
            p_str = ("(age > %d and gender is '%s')" % (age, gender))
            gender = ('Male' if random.random() else 'Female')
            age = random.randint(1, 100)
            p_str += (" or (age < %d and gender is '%s')" % (age, gender))
        p = Predicate(p_str)
        res.append(p)
    return res

dataset/ETHPy150Open armon/pypred/bench.py gen_predicates/original