<commit_before>import logging
import re
import datetime
import urllib

from pytz import utc

from google.appengine.api.labs import taskqueue
from google.appengine.api import memcache
from google.appengine.ext import db

from django.core.urlresolvers import reverse
from django.conf import settings

from helper.string_utils import normalize
from helper.dateutils import get_timezone_for_gmt_offset

from series.tvrage import TVRage

class Show(db.Model):
    name =          db.StringProperty()
    normalized_name = db.StringProperty()
    alt_names =     db.StringProperty()
    slug =          db.StringProperty()
    description =   db.StringProperty(indexed=False)
    genres      =   db.StringProperty(indexed=False)
    network =       db.StringProperty(indexed=False)
    active =        db.BooleanProperty()
    country =       db.StringProperty(indexed=False)
    runtime =       db.IntegerProperty()
    timezone =      db.StringProperty(indexed=False)
    tvrage_id =     db.IntegerProperty()
    added =         db.DateTimeProperty()
    
    # amazon_title =  db.StringProperty(indexed=False)
    # amazon_url =  db.StringProperty(indexed=False)
    
    _memkey_all_shows_ordered = "all_shows_ordered"
    _memkey_shows_dict = "all_shows_dict"
    re_find_the = re.compile("^The (.*)$")
    
    @classmethod
    def kind(cls):
        return "series_show"
    
    def __unicode__(self):
        return self.name
    
    @property
    def idnr(self):
        return self.key().id()
    
    @property
    def amazon(self, tld="com"):
        if settings.AMAZON_ENABLED:
            return "http://www.amazon.%s/exec/obidos/external-search/?mode=dvd&keyword=%s&tag=%s" % \
                (tld, urllib.quote_plus(self.name), settings.AMAZON_ASSOCIATE_TAG)
        return None

    @property
    def amazon_de(self):
        return self.amazon(tld="de")

    @property
    def amazon_uk(self):
        return self.amazon(tld="co.uk")

    @property
    def amazon_fr(self):
        return self.amazon(tld="fr")

    def alternative_names(self):
        if self.alt_names is None:
            return []
        return self.alt_names.split("|")
    
    @classmethod<commit_msg>amazon links as model fields<commit_after>import logging
import re
import datetime
import urllib

from pytz import utc

from google.appengine.api.labs import taskqueue
from google.appengine.api import memcache
from google.appengine.ext import db

from django.core.urlresolvers import reverse
from django.conf import settings

from helper.string_utils import normalize
from helper.dateutils import get_timezone_for_gmt_offset

from series.tvrage import TVRage

class Show(db.Model):
    name =          db.StringProperty()
    normalized_name = db.StringProperty()
    alt_names =     db.StringProperty()
    slug =          db.StringProperty()
    description =   db.StringProperty(indexed=False)
    genres      =   db.StringProperty(indexed=False)
    network =       db.StringProperty(indexed=False)
    active =        db.BooleanProperty()
    country =       db.StringProperty(indexed=False)
    runtime =       db.IntegerProperty()
    timezone =      db.StringProperty(indexed=False)
    tvrage_id =     db.IntegerProperty()
    added =         db.DateTimeProperty()
    
    # amazon_title =  db.StringProperty(indexed=False)
    # amazon_url =  db.StringProperty(indexed=False)
    
    _memkey_all_shows_ordered = "all_shows_ordered"
    _memkey_shows_dict = "all_shows_dict"
    re_find_the = re.compile("^The (.*)$")
    
    @classmethod
    def kind(cls):
        return "series_show"
    
    def __unicode__(self):
        return self.name
    
    @property
    def idnr(self):
        return self.key().id()
    
    def amazon_link(self, tld="com"):
        return "http://www.amazon.%s/exec/obidos/external-search/?mode=dvd&keyword=%s&tag=%s" % \
                (tld, urllib.quote_plus(self.name), settings.AMAZON_ASSOCIATE_TAG[tld])
    
    @property
    def amazon(self):
        return self.amazon_link()
    
    @property
    def amazon_de(self):
        return self.amazon_link(tld="de")
    
    @property
    def amazon_uk(self):
        return self.amazon_link(tld="co.uk")
    
    @property
    def amazon_fr(self):
        return self.amazon_link(tld="fr")
    
    def alternative_names(self):
        if self.alt_names is None:
            return []
        return self.alt_names.split("|")
    
    @classmethod
{'fraction_non_alphanumeric': 0.09822031989186754, 'fraction_numerical': 0.0, 'mean_word_length': 2.7436762225969646, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3594454', 'n_tokens_mistral': 1415, 'n_tokens_neox': 1403, 'n_words': 271}