<commit_before># MIT License
# Copyright (c) 2017 MassChallenge, Inc.

from django.db import models


class ProfileManager(models.Manager):
    """provide a customized queryset
    """

    def get_queryset(self):
        # Breaking a circular reference:
        #   BaseProfile => ProfileManager => ProfileQuerySet => BaseProfile
        from accelerator.models.profile_query_set import (
            ProfileQuerySet
        )
        return ProfileQuerySet(self.model, using=self._db)<commit_msg>[AC-6622] override create method on objects manager to delete existing profile before creating another<commit_after># MIT License
# Copyright (c) 2017 MassChallenge, Inc.

from django.db import models


class ProfileManager(models.Manager):
    """provide a customized queryset
    """

    def get_queryset(self):
        # Breaking a circular reference:
        #   BaseProfile => ProfileManager => ProfileQuerySet => BaseProfile
        from accelerator.models.profile_query_set import (
            ProfileQuerySet
        )
        return ProfileQuerySet(self.model, using=self._db)

    def create(self, *args, **kwargs):
        profile = self.filter(user=kwargs['user']).first()
        if profile:
            profile.delete()
        return super(ProfileManager, self).create(*args, **kwargs)
{'fraction_non_alphanumeric': 0.09307692307692307, 'fraction_numerical': 0.009230769230769232, 'mean_word_length': 3.143312101910828, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7543532', 'n_tokens_mistral': 354, 'n_tokens_neox': 326, 'n_words': 95}