<commit_before>%% @copyright 2007 Mochi Media, Inc.
%% @author <NAME> <<EMAIL>>
%%
%% @doc Erlang module for automatically reloading modified modules
%% during development.

-module(reloader).
-author("<NAME> <<EMAIL>>").

-include_lib("kernel/include/file.hrl").

-behaviour(gen_server).
-export([start/0, start_link/0]).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).

-record(state, {last}).

start() ->
    gen_server:start({local, ?MODULE}, ?MODULE, [], []).

start_link() ->
    gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).

init([]) ->
    {ok, _TRef} = timer:send_interval(timer:seconds(1), doit),
    {ok, #state{last = stamp()}}.

handle_call(_Req, _From, State) ->
    {reply, {error, badrequest}, State}.

handle_cast(_Req, State) ->
    {noreply, State}.

handle_info(doit, State) ->
    Now = stamp(),
    doit(State#state.last, Now),
    {noreply, State#state{last = Now}};
handle_info(_Info, State) ->
    {noreply, State}.

terminate(_Reason, _State) ->
    ok.

code_change(_Vsn, State, _Extra) ->
    {ok, State}.
<commit_msg>provide stop() function<commit_after>%% @copyright 2007 Mochi Media, Inc.
%% @author <NAME> <<EMAIL>>
%%
%% @doc Erlang module for automatically reloading modified modules
%% during development.

-module(reloader).
-author("<NAME> <<EMAIL>>").

-include_lib("kernel/include/file.hrl").

-behaviour(gen_server).
-export([start/0, start_link/0]).
-export([stop/0]).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).

-record(state, {last, tref}).

start() ->
    gen_server:start({local, ?MODULE}, ?MODULE, [], []).

start_link() ->
    gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).

init([]) ->
    {ok, TRef} = timer:send_interval(timer:seconds(1), doit),
    {ok, #state{last = stamp(), tref = TRef}}.

stop() ->
    gen_server:call(?MODULE, stop).

handle_call(stop, _From, State) ->
    {stop, shutdown, stopped, State};
handle_call(_Req, _From, State) ->
    {reply, {error, badrequest}, State}.

handle_cast(_Req, State) ->
    {noreply, State}.

handle_info(doit, State) ->
    Now = stamp(),
    doit(State#state.last, Now),
    {noreply, State#state{last = Now}};
handle_info(_Info, State) ->
    {noreply, State}.

terminate(_Reason, State) ->
    {ok, cancel} = timer:cancel(State#state.tref),
    ok.



code_change(_Vsn, State, _Extra) ->
    {ok, State}.

{'fraction_non_alphanumeric': 0.2045360824742268, 'fraction_numerical': 0.0111340206185567, 'mean_word_length': 4.251082251082251, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 35, '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': '6839923', 'n_tokens_mistral': 897, 'n_tokens_neox': 867, 'n_words': 183}