<commit_before># -*- coding: utf-8 -*-
'''
This file is part of Habitam.

Habitam is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as 
published by the Free Software Foundation, either version 3 of 
the License, or (at your option) any later version.

Habitam is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public
License along with Habitam. If not, see 
<http://www.gnu.org/licenses/>.
    
Created on Jul 15, 2013

@author: <NAME>
'''
from django.db import models
from habitam.financial.models import Account
import logging

logger = logging.getLogger(__name__)

    
class Entity(models.Model):
    name = models.CharField(max_length=100)

    def __unicode__(self):
        return self.name

    class Meta:
        abstract = True 


class SingleAccountEntity(Entity):   
    account = models.ForeignKey(Account)
    
    def __init__(self, account_type, money_type, *args, **kwargs):
        if 'name' in kwargs.keys():
            account = Account.objects.create(name=kwargs['name'],
                                             type=account_type,
                                             money_type=money_type)
            kwargs.setdefault('account', account)
        super(SingleAccountEntity, self).__init__(*args, **kwargs)

    def balance(self):
        return self.account.balance()

    class Meta:
        abstract = True
        
    def save(self, account_type, money_type, **kwargs):
        try:
            self.account.name = self.__unicode__()
            self.account.save()
        except Account.DoesNotExist:
            self.account = Account.objects.create(name=self.__unicode__(),
                                                  type=account_type,
                                                  money_type=money_type)
        
        self.account.name = self.name
        self.account.type = account_type
        self.account.money_type = money_type
        self.account.save(**kwargs)   
        super(SingleAccountEntity, self).save(**kwargs)
<commit_msg>fixed bootstrap<commit_after># -*- coding: utf-8 -*-
'''
This file is part of Habitam.

Habitam is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as 
published by the Free Software Foundation, either version 3 of 
the License, or (at your option) any later version.

Habitam is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public
License along with Habitam. If not, see 
<http://www.gnu.org/licenses/>.
    
Created on Jul 15, 2013

@author: <NAME>
'''
from django.db import models
from habitam.financial.models import Account
import logging

logger = logging.getLogger(__name__)

    
class Entity(models.Model):
    name = models.CharField(max_length=100)

    def __unicode__(self):
        return self.name

    class Meta:
        abstract = True 


class SingleAccountEntity(Entity):   
    account = models.ForeignKey(Account)
    
    def __init__(self, account_type, money_type, *args, **kwargs):
        if 'name' in kwargs.keys():
            account = Account.objects.create(name=kwargs['name'],
                                             type=account_type,
                                             money_type=money_type)
            kwargs.setdefault('account', account)
        super(SingleAccountEntity, self).__init__(*args, **kwargs)

    def balance(self):
        return self.account.balance()

    class Meta:
        abstract = True
        
    def save(self, account_type, money_type, **kwargs):
        try:
            self.account.name = self.__unicode__()
            self.account.type = account_type
            self.account.money_type = money_type
            self.account.save()
        except Account.DoesNotExist:
            self.account = Account.objects.create(name=self.__unicode__(),
                                                  type=account_type,
                                                  money_type=money_type)
        
        self.account.name = self.name
        self.account.type = account_type
        self.account.money_type = money_type        
        super(SingleAccountEntity, self).save(**kwargs)

{'fraction_non_alphanumeric': 0.08124866367329485, 'fraction_numerical': 0.004703870002138123, 'mean_word_length': 2.2531293463143256, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5290750', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1169, 'n_words': 392}