<commit_before>from storage import StorageFactory, StorageType
from flask_json import json_response


def _get_storage():
    return StorageFactory.create(StorageType.S3)


def add_image(img_file):
    blob_key = f"imgs/{img_file.filename}"
    img_data = img_file.read()
    print(f"img_data len: {len(img_data)}, type: {type(img_data)}")
    s = _get_storage()
    print(f"img_file type: {type(img_file)}")

    if blob_key in s.list_blobs("imgs/"):
        return json_response(
            ok=False, err=f'Image with name "{blob_key}" already exists.', status=400
        )

        s.put_blob(blob_key, img_data)
    return json_response(ok=True)
<commit_msg>Removed debug statements and fixed indentation issue<commit_after>from storage import StorageFactory, StorageType
from flask_json import json_response


def _get_storage():
    return StorageFactory.create(StorageType.S3)


def add_image(img_file):
    blob_key = f"imgs/{img_file.filename}"
    img_data = img_file.read()
    s = _get_storage()

    if blob_key in s.list_blobs("imgs/"):
        return json_response(
            ok=False, err=f'Image with name "{blob_key}" already exists.', status=400
        )

    s.put_blob(blob_key, img_data)
    return json_response(ok=True)

{'fraction_non_alphanumeric': 0.1088871096877502, 'fraction_numerical': 0.006405124099279423, 'mean_word_length': 3.9019607843137254, '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': '6134457', 'n_tokens_mistral': 422, 'n_tokens_neox': 407, 'n_words': 92}