<commit_before>import os
from celery.task import task
from dropbox import Dropbox
from dropbox.exceptions import ApiError
from dropbox.files import UploadSessionCursor, CommitInfo, WriteMode
from dropbox.sharing import SharedLinkSettings, RequestedVisibility

from django.conf import settings
from django.template.loader import render_to_string
from django.utils.translation import ugettext as _

from corehq.apps.users.models import CouchUser
from corehq.util.translation import localize
from corehq.util.log import send_HTML_email

CHUNK_SIZE = 5000000  # Read file in 5 MB chunks


@task
def upload(dropbox_helper_id, access_token, size, max_retries):
    from .models import DropboxUploadHelper
    helper = DropboxUploadHelper.objects.get(id=dropbox_helper_id)
    dbx = Dropbox(access_token)

    try:
        with open(helper.src, 'rb') as f:
            chunk = f.read(CHUNK_SIZE)<commit_msg>dimagimon<commit_after>import os
from celery.task import task
from dropbox import Dropbox
from dropbox.files import UploadSessionCursor, CommitInfo, WriteMode
from dropbox.sharing import SharedLinkSettings, RequestedVisibility

from django.conf import settings
from django.template.loader import render_to_string
from django.utils.translation import ugettext as _

from corehq.apps.users.models import CouchUser
from corehq.util.translation import localize
from corehq.util.log import send_HTML_email

CHUNK_SIZE = 5000000  # Read file in 5 MB chunks


@task
def upload(dropbox_helper_id, access_token, size, max_retries):
    from .models import DropboxUploadHelper
    helper = DropboxUploadHelper.objects.get(id=dropbox_helper_id)
    dbx = Dropbox(access_token)

    try:
        with open(helper.src, 'rb') as f:
            chunk = f.read(CHUNK_SIZE)
{'fraction_non_alphanumeric': 0.05979498861047836, 'fraction_numerical': 0.009111617312072893, 'mean_word_length': 4.976190476190476, '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': '4795384', 'n_tokens_mistral': 540, 'n_tokens_neox': 518, 'n_words': 155}