<commit_before>#! /usr/bin/python

'''Some utility and debugging functions for the Dropbox Bot'''

import time
import hashlib

def generate_thing_ids(n):
    '''
    Generate random, valid reddit thing_ids

    @param n: number of thing_ids to generate
    @param output: either string or list
    @return: a list of thing_ids
    '''

    def thing_id(seed):
        random = hashlib.md5(str(time.time() + seed))
        return 't3_' + random.hexdigest()[:7]
        

    output = []

    for i in range(n):
        output.append(thing_id(i))

    return output

if __name__ == '__main__':
    print generate_thing_ids(5)<commit_msg>Added a utility file to delete temporary files.<commit_after>#! /usr/bin/python

'''Some utility and debugging functions for the Dropbox Bot'''

import hashlib
import logging
import os
import time

def generate_thing_ids(n):
    '''
    Generate random, valid reddit thing_ids

    @param n: number of thing_ids to generate
    @param output: either string or list
    @return: a list of thing_ids
    '''

    def thing_id(seed):
        random = hashlib.md5(str(time.time() + seed))
        return 't3_' + random.hexdigest()[:7]
        

    output = []

    for i in range(n):
        output.append(thing_id(i))

    return output

def delete_tmp_files(directory):

    files_to_delete = os.listdir(directory)
    i = 0
    t = time.strftime('%H:%M:%S')

    if files_to_delete:
        for tmp_file in files_to_delete:
            os.remove(directory + '/' + tmp_file)
            i += 1

        logging.info('[%s] Temporary Files Clear! %s files deleted', t, i)
        return
    else:
        logging.info('[%s] Temporary Files Clear! No Files to delete', t) 
        return

if __name__ == '__main__':
    print generate_thing_ids(5)
{'fraction_non_alphanumeric': 0.10967379077615298, 'fraction_numerical': 0.00562429696287964, 'mean_word_length': 2.7373949579831933, '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': '386299', 'n_tokens_mistral': 578, 'n_tokens_neox': 557, 'n_words': 171}