<commit_before># -*- coding: UTF-8 -*-
import sys
from optparse import make_option

from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q

from conference import models
from conference import utils

class Command(BaseCommand):
    """
    """
    option_list = BaseCommand.option_list + (
        make_option('--type',
            action='store',
            dest='type',
            default='conference',
            help='Filter the tickets by type',
        ),
        make_option('--fare',
            action='store',
            dest='fare',
            default=None,
            help='Filter the tickets by fare code',
        ),
        make_option('--names',
            action='store',
            dest='names',
            default=None,
            help='Select tickets by badge name',
        ),
    )
    def handle(self, *args, **options):
        try:
            conference = args[0]
        except IndexError:
            raise CommandError('conference code is missing')

        cmdargs = []
        tickets = models.Ticket.objects.filter(fare__conference=conference, fare__ticket_type=options['type'])
        if options['fare']:
            tickets = tickets.filter(fare__code__startswith=options['fare'])
        if options['names']:
            names = options['names'].split(',')
            q = Q()
            for n in options['names'].split(','):
                q |= Q(name__icontains=n)
            tickets = tickets.filter(q)
            cmdargs.extend(['-e', '0', '-p', '297x210', '-n', '4'])
        files = utils.render_badge(tickets, cmdargs=cmdargs)
        f = files[0]
        f.seek(0)
        while True:
            data = f.read(16*1024)
            if not data:
                break
            sys.stdout.write(data)
<commit_msg>utilizzo "A4" al posto della dimensione in millimetri<commit_after># -*- coding: UTF-8 -*-
import sys
from optparse import make_option

from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q

from conference import models
from conference import utils

class Command(BaseCommand):
    """
    """
    option_list = BaseCommand.option_list + (
        make_option('--type',
            action='store',
            dest='type',
            default='conference',
            help='Filter the tickets by type',
        ),
        make_option('--fare',
            action='store',
            dest='fare',
            default=None,
            help='Filter the tickets by fare code',
        ),
        make_option('--names',
            action='store',
            dest='names',
            default=None,
            help='Select tickets by badge name',
        ),
    )
    def handle(self, *args, **options):
        try:
            conference = args[0]
        except IndexError:
            raise CommandError('conference code is missing')

        cmdargs = []
        tickets = models.Ticket.objects\
            .filter(fare__conference=conference, fare__ticket_type=options['type'])
        if options['fare']:
            tickets = tickets.filter(fare__code__startswith=options['fare'])
        if options['names']:
            q = Q()
            for n in options['names'].split(','):
                q |= Q(name__icontains=n)
            tickets = tickets.filter(q)
            cmdargs.extend(['-e', '0', '-p', 'A4', '-n', '4'])
        files = utils.render_badge(tickets, cmdargs=cmdargs)
        f = files[0]
        f.seek(0)
        while True:
            data = f.read(16*1024)
            if not data:
                break
            sys.stdout.write(data)

{'fraction_non_alphanumeric': 0.1267566822816203, 'fraction_numerical': 0.008817856158721412, 'mean_word_length': 1.862776025236593, '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': '7050577', 'n_tokens_mistral': 1005, 'n_tokens_neox': 992, 'n_words': 236}