<commit_before>import cw
import pika

def open_connection (cfg):
    return pika.BlockingConnection(
        pika.ConnectionParameters(host=cfg['rabbit-host'],
                                  port=cfg['rabbit-port'],
                                  ssl=cfg['rabbit-ssl']))

def close_connection(conn):
    if conn is not None and conn.is_open():
        try:
            conn.close()
        except Exception as e:
            pass
    return True
    
def listen(cfg, callback_handler):<commit_msg>fixed bug with attempting to call is_open on pika connection.<commit_after>import cw
import pika

def open_connection (cfg):
    return pika.BlockingConnection(
        pika.ConnectionParameters(host=cfg['rabbit-host'],
                                  port=cfg['rabbit-port'],
                                  ssl=cfg['rabbit-ssl']))

def close_connection(conn):
    if conn is not None and conn.is_open:
        try:
            conn.close()
        except Exception as e:
            pass
    return True

def listen(cfg, callback_handler):
{'fraction_non_alphanumeric': 0.09064885496183206, 'fraction_numerical': 0.0, 'mean_word_length': 1.9549295774647888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6224307', 'n_tokens_mistral': 286, 'n_tokens_neox': 273, 'n_words': 74}