<commit_before>from django.contrib.gis.db import models

class Generation(models.Model):
    active = models.BooleanField(default=False)
    created = models.DateTimeField()

class Area(models.Model):
    parent_area = models.ForeignKey('self', related_name='children', null=True)
    type = models.CharField(max_length=3)
    country = models.CharField(max_length=1, choices=(
        ('E', 'England'),
        ('W', 'Wales'),
        ('S', 'Scotland'),
        ('N', 'Northern Ireland'),
    ))
    generation_low = models.ForeignKey(Generation)
    generation_high = models.ForeignKey(Generation)
    polygon = models.MultiPolygonField(srid=27700, null=True)

    objects = models.GeoManager()

    def name(self):
        return self.names.get(type='F')

    def __unicode__(self):
        return '%s' self.name()

    #def save(self, *args, **kwargs):
    #    super(Area, self).save(*args, **kwargs)

class Name(models.Model):
    area = models.ForeignKey(Area, related_name='names')
    type = models.CharField(max_length=1, choices=(
        ('O', 'Ordnance Survey'),
        ('S', 'ONS (SNAC/GSS)'),
        ('F', 'Display name'),
        ('M', 'mySociety override'),
    ))
    name = models.CharField(max_length=100)

    class Meta:
        unique_together = ('area', 'type')

    def __unicode__(self):
        return '%s (%s) [%s]' % (self.name, self.type, self.area.id)

class Code(models.Model):
    area = models.ForeignKey(Area, related_name='codes')
    type = models.CharField(max_length=10, choices=(
        ('ons_code', 'SNAC'),
        ('gss', 'GSS (SNAC replacement)'),
        ('unit_id', 'Boundary-Line (OS Admin Area ID)')<commit_msg>Typo.<commit_after>from django.contrib.gis.db import models

class Generation(models.Model):
    active = models.BooleanField(default=False)
    created = models.DateTimeField()

class Area(models.Model):
    parent_area = models.ForeignKey('self', related_name='children', null=True)
    type = models.CharField(max_length=3)
    country = models.CharField(max_length=1, choices=(
        ('E', 'England'),
        ('W', 'Wales'),
        ('S', 'Scotland'),
        ('N', 'Northern Ireland'),
    ))
    generation_low = models.ForeignKey(Generation)
    generation_high = models.ForeignKey(Generation)
    polygon = models.MultiPolygonField(srid=27700, null=True)

    objects = models.GeoManager()

    def name(self):
        return self.names.get(type='F')

    def __unicode__(self):
        return '%s' % self.name()

    #def save(self, *args, **kwargs):
    #    super(Area, self).save(*args, **kwargs)

class Name(models.Model):
    area = models.ForeignKey(Area, related_name='names')
    type = models.CharField(max_length=1, choices=(
        ('O', 'Ordnance Survey'),
        ('S', 'ONS (SNAC/GSS)'),
        ('F', 'Display name'),
        ('M', 'mySociety override'),
    ))
    name = models.CharField(max_length=100)

    class Meta:
        unique_together = ('area', 'type')

    def __unicode__(self):
        return '%s (%s) [%s]' % (self.name, self.type, self.area.id)

class Code(models.Model):
    area = models.ForeignKey(Area, related_name='codes')
    type = models.CharField(max_length=10, choices=(
        ('ons_code', 'SNAC'),
        ('gss', 'GSS (SNAC replacement)'),
        ('unit_id', 'Boundary-Line (OS Admin Area ID)')
{'fraction_non_alphanumeric': 0.1675708257986739, 'fraction_numerical': 0.007836045810729355, 'mean_word_length': 3.338562091503268, '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': '4524691', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1064, 'n_words': 221}