<commit_before>import os

from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from django.db import transaction

from binalerts import models

import binalerts

class Command(BaseCommand):
    def handle(self, *args, **options):
        if len(args) != 1:
            raise CommandError("Only argument is name of .xml file in fixtures directory to load, e.g. garden_sample_pdf.xml")

        transaction.enter_transaction_management()
        transaction.managed(True)
        
        file_to_load = os.path.join(os.path.dirname(binalerts.__file__), 'fixtures/', args[0])
        models.BinCollection.objects.load_from_pdf_xml(file_to_load)

<commit_msg>Transaction didn't commit, just disable it for now.<commit_after>import os

from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from django.db import transaction

from binalerts import models

import binalerts

class Command(BaseCommand):
    def handle(self, *args, **options):
        if len(args) != 1:
            raise CommandError("Only argument is name of .xml file in fixtures directory to load, e.g. garden_sample_pdf.xml")

        #transaction.enter_transaction_management()
        #transaction.managed(True)
        
        file_to_load = os.path.join(os.path.dirname(binalerts.__file__), 'fixtures/', args[0])
        models.BinCollection.objects.load_from_pdf_xml(file_to_load)


{'fraction_non_alphanumeric': 0.08997252747252747, 'fraction_numerical': 0.0027472527472527475, 'mean_word_length': 3.840531561461794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '7484600', 'n_tokens_mistral': 419, 'n_tokens_neox': 416, 'n_words': 109}