<commit_before>import gridfs
from werkzeug import secure_filename
from pymongo import ASCENDING, DESCENDING
from datetime import datetime
import fnmatch

def store_file(f, username, aes_key, db):
    fname = secure_filename(f.filename)
    
    gfs = gridfs.GridFS(db)
    
    gf = gfs.new_file(filename=fname, contentType=f.content_type)
    
    gf.write(f)
    gf.close()
    f.close()

    date = datetime.utcnow()

    finfo = {'file_id': gf._id, 
             'username': username, 
             'filename': fname,
             'aes_key': aes_key,
             'date': date}

    return db.fileinfo.insert(finfo)

def retrieve_file(db, finfo):
    gfs = gridfs.GridFS(db)
<commit_msg>give interested clients md5 of file<commit_after>import gridfs
from werkzeug import secure_filename
from pymongo import ASCENDING, DESCENDING
from datetime import datetime
import fnmatch

def store_file(f, username, aes_key, db):
    fname = secure_filename(f.filename)
    
    gfs = gridfs.GridFS(db)
    
    gf = gfs.new_file(filename=fname, contentType=f.content_type)
    
    gf.write(f)
    gf.close()
    f.close()

    date = datetime.utcnow()

    finfo = {'file_id': gf._id, 
             'username': username, 
             'filename': fname,
             'aes_key': aes_key,
             'date': date,
             'md5': gf.md5}

    return db.fileinfo.insert(finfo)

def retrieve_file(db, finfo):
    gfs = gridfs.GridFS(db)

{'fraction_non_alphanumeric': 0.10684357541899442, 'fraction_numerical': 0.002094972067039106, 'mean_word_length': 2.674358974358974, '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': '1017648', 'n_tokens_mistral': 512, 'n_tokens_neox': 492, 'n_words': 111}