<commit_before>/**
 * Class responsible for general Utility methods that do not find anywhere else
 * @type {module.Util}
 */
module.exports = class Util
{
    /**
     * Constructs a paginated string list out of array
     * @param list
     * @param page
     * @param perPage
     * @returns string|null
     */
    static getPaginatedList(list, page = 1, perPage = 10)
    {
        let sep = '\n';
        let pages = Math.ceil(list.length / perPage);
        if (page > pages || list.length === 0) return 'Nothing here....';

        // slices array by paginated entries, starting at (perPage) records per page,
        // first arg decides the first index of sliced array
        let startIndex = (page * perPage) <= perPage ?  0 : ((page-1) * perPage);
        let endIndex = startIndex + perPage < list.length ? startIndex + perPage : list.length;
        let queue = list.slice(startIndex, endIndex);
        let str = `Total: ${list.length}, Current page: ${page}, last page: ${pages}`+sep;

        let count = startIndex;
        for (let item of queue) {
            str += `${++count}. ${item.title.replace('\'', '')} [${item.url}]\n`;
        }

        return str + '\n';
    }

    /**
     * DO NOT AWAIT THIS MESSAGE
     * @param message
     * @param append
     * @param maxLen
     * @returns {Promise.<void>}
     */
    static async constructLoadingMessage(message, append = ".", maxLen = 120)
    {
        try {
            message =  await message.channel.fetchMessage(message.id);
            if (message.deletable) {
                let content = message.content + append;
                if (content.length >= maxLen) content = append;

                message =  await message.channel.fetchMessage(message.id);
                if (message.editable) {
                    let editedMessage = (await message.edit(content));
                    setTimeout(async function(){
                        await Util.constructLoadingMessage(editedMessage, append, maxLen);
                    }, 1100);
                    return editedMessage;
                }
            }
            return message;
        } catch (error) {
        }
    }
};<commit_msg>removed misleading comment for util class<commit_after>/**
 * Class responsible for general Utility methods that do not find anywhere else
 * @type {module.Util}
 */
module.exports = class Util
{
    /**
     * Constructs a paginated string list out of array
     * @param list
     * @param page
     * @param perPage
     * @returns string|null
     */
    static getPaginatedList(list, page = 1, perPage = 10)
    {
        let sep = '\n';
        let pages = Math.ceil(list.length / perPage);
        if (page > pages || list.length === 0) return 'Nothing here....';

        // slices array by paginated entries, starting at (perPage) records per page,
        // first arg decides the first index of sliced array
        let startIndex = (page * perPage) <= perPage ?  0 : ((page-1) * perPage);
        let endIndex = startIndex + perPage < list.length ? startIndex + perPage : list.length;
        let queue = list.slice(startIndex, endIndex);
        let str = `Total: ${list.length}, Current page: ${page}, last page: ${pages}`+sep;

        let count = startIndex;
        for (let item of queue) {
            str += `${++count}. ${item.title.replace('\'', '')} [${item.url}]\n`;
        }

        return str + '\n';
    }

    /**
     * @param message
     * @param append
     * @param maxLen
     * @returns {Promise.<void>}
     */
    static async constructLoadingMessage(message, append = ".", maxLen = 120)
    {
        try {
            message =  await message.channel.fetchMessage(message.id);
            if (message.deletable) {
                let content = message.content + append;
                if (content.length >= maxLen) content = append;

                message =  await message.channel.fetchMessage(message.id);
                if (message.editable) {
                    let editedMessage = (await message.edit(content));
                    setTimeout(async function(){
                        await Util.constructLoadingMessage(editedMessage, append, maxLen);
                    }, 1100);
                    return editedMessage;
                }
            }
            return message;
        } catch (error) {
            console.log('Loading message error', e);
        }
    }
};
{'fraction_non_alphanumeric': 0.12143180788400544, 'fraction_numerical': 0.0058903488898957865, 'mean_word_length': 1.844716494845361, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2796846', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1173, 'n_words': 356}