<commit_before>from django.db import models

from django_extensions.db.fields import AutoSlugField

import mptt

from urlparse import urljoin

class Category(models.Model):
    parent = models.ForeignKey('self',
                               null=True,
                               blank=True,
                               related_name='children')
    name = models.CharField(max_length=50)
    slug = AutoSlugField(max_length=50,
                         overwrite=True,
                         populate_from='name')
    url = models.TextField(editable=False)

    class Meta:
        verbose_name_plural = "categories"
        unique_together = (("name", "slug", "parent"), )
        ordering = ("tree_id", "lft")

    def __unicode__(self):
        return self.url

    @models.permalink
    def get_absolute_url(self):
        # Our url doesn't end with `/`, but our absolute_url should
        return ('categories_detail', (self.url.lstrip('/').rstrip('/'),))

    def save(self, force_insert=False, force_update=False, **kwargs):
        super(Category, self).save(
            force_insert=force_insert,
            force_update=force_update,
            **kwargs)
        self.update_url()

    def get_tree(self, *args):
        """<commit_msg>Removed unneeded method<commit_after>from django.db import models

from django_extensions.db.fields import AutoSlugField

import mptt

from urlparse import urljoin

class Category(models.Model):
    parent = models.ForeignKey('self',
                               null=True,
                               blank=True,
                               related_name='children')
    name = models.CharField(max_length=50)
    slug = AutoSlugField(max_length=50,
                         overwrite=True,
                         populate_from='name')
    url = models.TextField(editable=False)

    class Meta:
        verbose_name_plural = "categories"
        unique_together = (("name", "slug", "parent"), )
        ordering = ("tree_id", "lft")

    def __unicode__(self):
        return self.url

    def save(self, force_insert=False, force_update=False, **kwargs):
        super(Category, self).save(
            force_insert=force_insert,
            force_update=force_update,
            **kwargs)
        self.update_url()

    def get_tree(self, *args):
        """
{'fraction_non_alphanumeric': 0.10553410553410554, 'fraction_numerical': 0.003432003432003432, 'mean_word_length': 2.092838196286472, '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': '4212014', 'n_tokens_mistral': 663, 'n_tokens_neox': 635, 'n_words': 133}