<commit_before>from __future__ import with_statement
from google.appengine.api import files
from google.appengine.api.images import get_serving_url
from google.appengine.ext.blobstore import delete, BlobReader

MAX_SIZE_IN_BYTES = 31457280

def get_image_url(blob_key):
    return get_serving_url(blob_key)

def get(blob_key):
    return BlobReader(blob_key).read()

def put(uploaded_file, existing_blob_key):
    # clear existing data
    if existing_blob_key:
        delete(existing_blob_key)
    
    # write new data
    file_name = files.blobstore.create(uploaded_file.content_type)
    with files.open(file_name, 'a') as f:
        f.write(uploaded_file.read())
    files.finalize(file_name)
    
    # return the blob_key for storage to the main datastore
    blob_key = files.blobstore.get_blob_key(file_name)
    return blob_key<commit_msg>generalize comment<commit_after>from __future__ import with_statement
from google.appengine.api import files
from google.appengine.api.images import get_serving_url
from google.appengine.ext.blobstore import delete, BlobReader

MAX_SIZE_IN_BYTES = 31457280

def get_image_url(blob_key):
    return get_serving_url(blob_key)

def get(blob_key):
    return BlobReader(blob_key).read()

def put(uploaded_file, existing_blob_key):
    # clear existing data
    if existing_blob_key:
        delete(existing_blob_key)
    
    # write new data
    file_name = files.blobstore.create(uploaded_file.content_type)
    with files.open(file_name, 'a') as f:
        f.write(uploaded_file.read())
    files.finalize(file_name)
    
    # return the blob_key associated with the new data
    blob_key = files.blobstore.get_blob_key(file_name)
    return blob_key
{'fraction_non_alphanumeric': 0.07411764705882352, 'fraction_numerical': 0.009411764705882352, 'mean_word_length': 4.365930599369086, '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': '2342096', 'n_tokens_mistral': 572, 'n_tokens_neox': 555, 'n_words': 121}