<commit_before># -*- coding: utf-8 -*-

import os
import random

from django.conf import settings
from django.core.mail import EmailMessage
from django.core.management.base import BaseCommand
from django.template.loader import render_to_string

from apps.events.models import AttendanceEvent


class Command(BaseCommand):
    def add_arguments(self, parser):
        parser.add_argument('event_id')

    def handle(self, *args, **options):
        event_id = options['event_id']
        event = AttendanceEvent.objects.get(event=event_id)
        users = event.attendees_qs
        random_users = self.generate_random_list(users)
        to_from_dict = {}
        for count, user in enumerate(users):
            to_from_dict['Par %s' % (count+1)] = {'To': user.user.get_full_name(),
                                                  'From': users[random_users[count]].user.get_full_name()}
            self.send_mail(user, users[random_users[count]])

        self.write_to_file(to_from_dict)
        self.mail_to_committee()

    # Function for generating a list with random numbers corresponding to
    # the indexes of the list of users attending the event.
    @staticmethod
    def generate_random_list(users):
        to_from = random.sample(range(len(users)), len(users))
        return_list = Command.fix_random_list(list(to_from))
        return return_list

    # Function for checking that the random list of indexes is valid.
    # Checks the index of the original list of users against the randomly
    # generated number. If index and random number is the same, then someone
    # got themselves as secret Santa.
    @staticmethod<commit_msg>removed an unnecessary line<commit_after># -*- coding: utf-8 -*-

import os
import random

from django.conf import settings
from django.core.mail import EmailMessage
from django.core.management.base import BaseCommand
from django.template.loader import render_to_string

from apps.events.models import AttendanceEvent


class Command(BaseCommand):
    def add_arguments(self, parser):
        parser.add_argument('event_id')

    def handle(self, *args, **options):
        event_id = options['event_id']
        event = AttendanceEvent.objects.get(event=event_id)
        users = event.attendees_qs
        random_users = self.generate_random_list(users)
        to_from_dict = {}
        for count, user in enumerate(users):
            to_from_dict['Par %s' % (count+1)] = {'To': user.user.get_full_name(),
                                                  'From': users[random_users[count]].user.get_full_name()}
            self.send_mail(user, users[random_users[count]])

        self.write_to_file(to_from_dict)
        self.mail_to_committee()

    # Function for generating a list with random numbers corresponding to
    # the indexes of the list of users attending the event.
    @staticmethod
    def generate_random_list(users):
        to_from = random.sample(range(len(users)), len(users))
        return Command.fix_random_list(to_from)

    # Function for checking that the random list of indexes is valid.
    # Checks the index of the original list of users against the randomly
    # generated number. If index and random number is the same, then someone
    # got themselves as secret Santa.
    @staticmethod
{'fraction_non_alphanumeric': 0.08667883211678833, 'fraction_numerical': 0.0012165450121654502, 'mean_word_length': 3.085714285714286, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4247209', 'n_tokens_mistral': 901, 'n_tokens_neox': 895, 'n_words': 266}