<commit_before>from django.core.management.base import BaseCommand

from hordak.models import Account


class Command(BaseCommand):
    help = 'Create the initial chart of accounts'

    def add_arguments(self, parser):
        super(Command, self).add_arguments(parser)
        parser.add_argument(
            '--preserve', dest='preserve', default=False, action='store_true',
            help='Exit normally if any accounts already exist.',
        )
        parser.add_argument(
            '--currency', dest='currency', default='USD', action='store',
            help='Account currencies.',
        )

    def handle(self, *args, **options):
        if options.get('preserve') and Account.objects.count():
            self.stdout.write('Exiting normally because accounts already exist and --preserve flag was present')

        kw = dict(currencies=[options.get('currency', 'USD')])

        assets = Account.objects.create(name='Assets', code='1', _type='AS', **kw)
        liabilities = Account.objects.create(name='Liabilities', code='1', _type='AS', **kw)
        equity = Account.objects.create(name='Equity', code='1', _type='AS', **kw)
        income = Account.objects.create(name='Income', code='1', _type='AS', **kw)
        expenses = Account.objects.create(name='Expenses', code='1', _type='AS', **kw)

        bank = Account.objects.create(name='Bank Account', code='1', is_bank_account=True, _type='AS', parent=assets, **kw)

        housemate_income = Account.objects.create(name='Housemate Income', code='1', parent=income, **kw)
        other_income = Account.objects.create(name='Other Income', code='2', parent=income, **kw)

        current_liabilities = Account.objects.create(name='Current Liabilities', code='1', parent=liabilities, **kw)
        long_term_liabilities = Account.objects.create(name='Long Term Liabilities', code='2', parent=liabilities, **kw)

        gas_payable = Account.objects.create(name='Gas Payable', code='1', parent=current_liabilities, **kw)
        electricity_payable = Account.objects.create(name='Electricity Payable', code='2', parent=current_liabilities, **kw)
        council_tax_payable = Account.objects.create(name='Council Tax Payable', code='3', parent=current_liabilities, **kw)
        internet_payable = Account.objects.create(name='Internet Payable', code='4', parent=current_liabilities, **kw)

        retained_earnings = Account.objects.create(name='Retained Earnings', code='1', parent=equity, **kw)
<commit_msg>Fixing account name<commit_after>from django.core.management.base import BaseCommand

from hordak.models import Account


class Command(BaseCommand):
    help = 'Create the initial chart of accounts'

    def add_arguments(self, parser):
        super(Command, self).add_arguments(parser)
        parser.add_argument(
            '--preserve', dest='preserve', default=False, action='store_true',
            help='Exit normally if any accounts already exist.',
        )
        parser.add_argument(
            '--currency', dest='currency', default='USD', action='store',
            help='Account currencies.',
        )

    def handle(self, *args, **options):
        if options.get('preserve') and Account.objects.count():
            self.stdout.write('Exiting normally because accounts already exist and --preserve flag was present')

        kw = dict(currencies=[options.get('currency', 'USD')])

        assets = Account.objects.create(name='Assets', code='1', _type='AS', **kw)
        liabilities = Account.objects.create(name='Liabilities', code='1', _type='AS', **kw)
        equity = Account.objects.create(name='Equity', code='1', _type='AS', **kw)
        income = Account.objects.create(name='Income', code='1', _type='AS', **kw)
        expenses = Account.objects.create(name='Expenses', code='1', _type='AS', **kw)

        bank = Account.objects.create(name='Bank', code='1', is_bank_account=True, _type='AS', parent=assets, **kw)

        housemate_income = Account.objects.create(name='Housemate Income', code='1', parent=income, **kw)
        other_income = Account.objects.create(name='Other Income', code='2', parent=income, **kw)

        current_liabilities = Account.objects.create(name='Current Liabilities', code='1', parent=liabilities, **kw)
        long_term_liabilities = Account.objects.create(name='Long Term Liabilities', code='2', parent=liabilities, **kw)

        gas_payable = Account.objects.create(name='Gas Payable', code='1', parent=current_liabilities, **kw)
        electricity_payable = Account.objects.create(name='Electricity Payable', code='2', parent=current_liabilities, **kw)
        council_tax_payable = Account.objects.create(name='Council Tax Payable', code='3', parent=current_liabilities, **kw)
        internet_payable = Account.objects.create(name='Internet Payable', code='4', parent=current_liabilities, **kw)

        retained_earnings = Account.objects.create(name='Retained Earnings', code='1', parent=equity, **kw)

{'fraction_non_alphanumeric': 0.15359871330920788, 'fraction_numerical': 0.006031363088057901, 'mean_word_length': 4.150103519668737, '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': '4669353', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1398, 'n_words': 305}