<commit_before>import datetime
import logging

import mysite.search.models
import mysite.customs.bugtrackers.trac

### Twisted
def look_at_one_twisted_bug(bug_id):
    logging.info("Was asked to look at bug %d in Twisted" % bug_id)
    tb = mysite.customs.bugtrackers.trac.TracBug(
        bug_id=bug_id,
        BASE_URL='http://twistedmatrix.com/trac/')

    bug_url = tb.as_bug_specific_url()

    # If bug is already in our database, and we looked at
    # it within the past day, skip the request.
    try:
        bug_obj = mysite.search.models.Bug.all_bugs.get(
            canonical_bug_link=bug_url)
    except mysite.search.models.Bug.MultipleObjectsReturned:
        # delete all but the first
        bug_objs = mysite.search.models.Bug.all_bugs.filter(
            canonical_bug_link=bug_url)
        bug_obj = bug_objs[0]
        for stupid_dup in bug_objs[1:]:
            stupid_dup.delete()

    except mysite.search.models.Bug.DoesNotExist:
        bug_obj = mysite.search.models.Bug(
            canonical_bug_link=bug_url)

    # Is that bug fresh enough?
    if bug_obj.data_is_more_fresh_than_one_day():
        pass
    else: # it is stale.
        logging.info("Refreshing bug %d from Twisted." %
                     bug_id)
        # if the delta is greater than a day, refresh it.
        data = tb.as_data_dict_for_bug_object()<commit_msg>For fresh Twisted bugs, log a message saying we skipped tehm.<commit_after>import datetime
import logging

import mysite.search.models
import mysite.customs.bugtrackers.trac

### Twisted
def look_at_one_twisted_bug(bug_id):
    logging.info("Was asked to look at bug %d in Twisted" % bug_id)
    tb = mysite.customs.bugtrackers.trac.TracBug(
        bug_id=bug_id,
        BASE_URL='http://twistedmatrix.com/trac/')

    bug_url = tb.as_bug_specific_url()

    # If bug is already in our database, and we looked at
    # it within the past day, skip the request.
    try:
        bug_obj = mysite.search.models.Bug.all_bugs.get(
            canonical_bug_link=bug_url)
    except mysite.search.models.Bug.MultipleObjectsReturned:
        # delete all but the first
        bug_objs = mysite.search.models.Bug.all_bugs.filter(
            canonical_bug_link=bug_url)
        bug_obj = bug_objs[0]
        for stupid_dup in bug_objs[1:]:
            stupid_dup.delete()

    except mysite.search.models.Bug.DoesNotExist:
        bug_obj = mysite.search.models.Bug(
            canonical_bug_link=bug_url)

    # Is that bug fresh enough?
    if bug_obj.data_is_more_fresh_than_one_day():
        logging.info("Skipping! It's fresh.")
        return
    else: # it is stale.
        logging.info("Refreshing bug %d from Twisted." %
                     bug_id)
        # if the delta is greater than a day, refresh it.
        data = tb.as_data_dict_for_bug_object()
{'fraction_non_alphanumeric': 0.08763250883392226, 'fraction_numerical': 0.0014134275618374558, 'mean_word_length': 2.6341463414634148, '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': '6422934', 'n_tokens_mistral': 957, 'n_tokens_neox': 925, 'n_words': 216}