<commit_before>class Brush
    module Timecalc
        def calculate_epochms(amount, unit)
            amount = amount.to_i
            now = Time.now().to_i * 1000

            case unit
                when 'hours'
                    return now - (amount * (60 * 60) * 1000)
                when 'days'
                    return now - (amount * 24 * (60 * 60) * 1000)
            end
        end

        def calculate_enddate(days_to_keep)
            seconds_per_day = 24 * 60 * 60
            enddate =  Time.now()
            enddate -= days_to_keep.to_i * seconds_per_day

            return enddate.strftime("%Y.%m.%d")
        end

        def purgeable_indices(days_to_keep, indices)
            seconds_per_day = 24 * 60 * 60
            date_format = "%Y.%m.%d"

            today = Time.now()
            enddate = today - (days_to_keep-= 1) * seconds_per_day
            purgedate = enddate

            while purgedate <= today
                indices.delete("logstash-#{purgedate.strftime(date_format)}")
                purgedate += seconds_per_day
            end

            return indices
        end
    end
end
<commit_msg>small cleanup in time.rb<commit_after>class Brush
    module Timecalc
        def calculate_epochms(amount, unit)
            seconds_per_day = 24 * 60 * 60
            amount = amount.to_i
            now = Time.now().to_i * 1000

            case unit
                when 'hours'
                    return now - (amount * (60 * 60) * 1000)
                when 'days'
                    return now - (amount * seconds_per_day * 1000)
            end
        end

        def calculate_enddate(days_to_keep)
            seconds_per_day = 24 * 60 * 60
            date_format = "%Y.%m.%d"

            enddate =  Time.now()
            enddate -= days_to_keep.to_i * seconds_per_day

            return enddate.strftime(date_format)
        end

        def purgeable_indices(days_to_keep, indices)
            seconds_per_day = 24 * 60 * 60
            date_format = "%Y.%m.%d"

            today = Time.now()
            enddate = today - (days_to_keep-= 1) * seconds_per_day
            purgedate = enddate

            while purgedate <= today
                indices.delete("logstash-#{purgedate.strftime(date_format)}")
                purgedate += seconds_per_day
            end

            return indices
        end
    end
end

{'fraction_non_alphanumeric': 0.08410041841004184, 'fraction_numerical': 0.029288702928870293, 'mean_word_length': 1.3767395626242545, 'pattern_counts': {'":': 0, '<': 5, '<?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': '303028', 'n_tokens_mistral': 778, 'n_tokens_neox': 671, 'n_words': 161}