<commit_before>-module(ewg_event).
-export([event/1, list_callbacks/0, delete_callback/1, register_callback/1, reset_callbacks/0]).

event(EventData) ->
    Data = complement_data(EventData),
    CallBacks = ewg_conf:read(ewg_event_callbacks, []),
    [
        case CB of
            {M, F} -> erlang:spawn(M, F, [Data]);
            {M, F, A} -> erlang:spawn(M, F, [Data | A]);
            Fun when is_function(Fun) -> erlang:spawn(fun() -> Fun(Data) end)
        end || CB <- CallBacks
    ],
    ok.

list_callbacks() ->
    ewg_conf:read(ewg_event_callbacks, []).

delete_callback(CB) ->
    CallBacks = ewg_conf:read(ewg_event_callbacks, []),
    ewg_conf:write(ewg_event_callbacks, lists:delete(CB, CallBacks)).<commit_msg>Change callbacks to arity 2: (EventId, Data)<commit_after>-module(ewg_event).
-export([event/1, list_callbacks/0, delete_callback/1, register_callback/1, reset_callbacks/0]).

event(EventData) ->
    EventId = ewg_lib:plget(ewg_event_id, EventData),
    Data = complement_data(EventData),
    CallBacks = ewg_conf:read(ewg_event_callbacks, []),
    [
        case CB of
            {M, F} -> erlang:spawn(M, F, [EventId, Data]);
            {M, F, A} -> erlang:spawn(M, F, [EventId, Data | A]);
            Fun when is_function(Fun) -> erlang:spawn(fun() -> Fun(EventId, Data) end)
        end || CB <- CallBacks
    ],
    ok.

list_callbacks() ->
    ewg_conf:read(ewg_event_callbacks, []).

delete_callback(CB) ->
    CallBacks = ewg_conf:read(ewg_event_callbacks, []),
    ewg_conf:write(ewg_event_callbacks, lists:delete(CB, CallBacks)).
{'fraction_non_alphanumeric': 0.15966921119592875, 'fraction_numerical': 0.006997455470737914, 'mean_word_length': 3.443502824858757, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '6768891', 'n_tokens_mistral': 606, 'n_tokens_neox': 590, 'n_words': 99}