<commit_before># Skull Module Executor

import skullpy.txn as Txn
import skullpy.txndata as TxnData

def run_module_init(init_func, config):
    init_func(config)

def run_module_release(release_func):
    release_func()

def run_module_run(run_func, skull_txn):
    try:
        txn = Txn.Txn(skull_txn)
        ret = run_func(txn)

        txn.storeMsgData()
        return ret
    except Exception, e:
        return False

def run_module_unpack(unpack_func, skull_txn, data):
    txn = Txn.Txn(skull_txn)

    try:
        consumed_length = unpack_func(txn, data)

        txn.storeMsgData()
        return consumed_length
    except Exception, e:
        return -1 # Error occurred

def run_module_pack(pack_func, skull_txn, skull_txndata):
    txn = Txn.Txn(skull_txn)
    txndata = TxnData.TxnData(skull_txndata)

    try:
        pack_func(txn, txndata)
    except Exception, e:
        print "Failed to run_module_pack: {}".format(e)
    finally:
        txn.destroyMsgData()<commit_msg>Make module_executor.py robuster<commit_after># Skull Module Executor

import skullpy.txn as Txn
import skullpy.txndata as TxnData

def run_module_init(init_func, config):
    init_func(config)

def run_module_release(release_func):
    release_func()

def run_module_run(run_func, skull_txn):
    try:
        txn = Txn.Txn(skull_txn)
        ret = run_func(txn)

        txn.storeMsgData()
        return ret
    except Exception, e:
        return False

def run_module_unpack(unpack_func, skull_txn, data):
    txn = Txn.Txn(skull_txn)

    try:
        consumed_length = unpack_func(txn, data)
        txn.storeMsgData()

        if consumed_length is None:
            return -1

        return int(consumed_length)
    except Exception, e:
        return -1 # Error occurred

def run_module_pack(pack_func, skull_txn, skull_txndata):
    txn = Txn.Txn(skull_txn)
    txndata = TxnData.TxnData(skull_txndata)

    try:
        pack_func(txn, txndata)
    except Exception, e:
        print "Failed to run_module_pack: {}".format(e)
    finally:
        txn.destroyMsgData()
{'fraction_non_alphanumeric': 0.08530120481927711, 'fraction_numerical': 0.0014457831325301205, 'mean_word_length': 2.946768060836502, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4421449', 'n_tokens_mistral': 766, 'n_tokens_neox': 758, 'n_words': 159}