<commit_before>from datetime import datetime, date

from celery import task
from geopy import geocoders

from animals.models import Animal

g = geocoders.Google('<KEY>')

@task()
def populate(row):
    animal_id = row[3]
    print "starting to process  %s" % animal_id
    if not Animal.objects.filter(animal_id=animal_id).exists():
        location = row[1]
        location_found = True
        try:
            (place, point) = g.geocode(location)
        except:
            location_found = False
        if location_found:
            a = Animal()
            a.animal_id = animal_id
            intake_date = row[0]
            dt = datetime.strptime(intake_date.strip(), "%m/%d/%y")
            a.intake_date = date(year=dt.year, month=dt.month, day=dt.day)
            a.location = location
            a.intake_condition = row[2]
            a.animal_type = row[4]
            sex = {'UNKNOWN': 'U',
                    'MALE': 'M',
                    'FEMALE': 'F'}
            a.sex = sex[row[5]]
            a.spayed = True if row[6] == 'YES' else False
            a.name = row[7]
            a.age = int(float(row[8].replace(',', '')))
            a.description = row[9]
            a.intake_total = 1<commit_msg>indicate if location not found<commit_after>from datetime import datetime, date

from celery import task
from geopy import geocoders

from animals.models import Animal

g = geocoders.Google('<KEY>')

@task()
def populate(row):
    animal_id = row[3]
    print "starting to process  %s" % animal_id
    if not Animal.objects.filter(animal_id=animal_id).exists():
        location = row[1]
        location_found = True
        try:
            (place, point) = g.geocode(location)
        except:
            location_found = False
            print 'location not found'
        if location_found:
            a = Animal()
            a.animal_id = animal_id
            intake_date = row[0]
            dt = datetime.strptime(intake_date.strip(), "%m/%d/%y")
            a.intake_date = date(year=dt.year, month=dt.month, day=dt.day)
            a.location = location
            a.intake_condition = row[2]
            a.animal_type = row[4]
            sex = {'UNKNOWN': 'U',
                    'MALE': 'M',
                    'FEMALE': 'F'}
            a.sex = sex[row[5]]
            a.spayed = True if row[6] == 'YES' else False
            a.name = row[7]
            a.age = int(float(row[8].replace(',', '')))
            a.description = row[9]
            a.intake_total = 1
{'fraction_non_alphanumeric': 0.1249005568814638, 'fraction_numerical': 0.008750994431185362, 'mean_word_length': 1.8037904124860646, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '605700', 'n_tokens_mistral': 804, 'n_tokens_neox': 781, 'n_words': 185}