<commit_before># coding=UTF-8

from django.dispatch import receiver
from django.db.models.signals import Signal

from attendee import Attend

request_attendee_pks_signal = Signal(providing_args=['attendee'])
find_attendee_signal = Signal(providing_args=['pk'])


@receiver(request_attendee_pks_signal)
def basic_pks_handler(sender, **kwargs):
    attendee = kwargs['attendee']
    return 'Attendee ID', str(attendee.pk)


@receiver(find_attendee_signal)
def basic_find_attendee_handler(sender, **kwargs):
    try:
        pk = int(kwargs['pk'])
        return 'Attendee ID', Attend.objects.get(pk=pk)

    except:
        return None


def eua_pks_handler(sender, **kwargs):
    attendee = kwargs['attendee']
    key = 'EUA.%s.%s.%s' % (attendee.event.pk,
                            attendee.user.pk,
                            attendee.pk)

    return 'EUA ID', key

request_attendee_pks_signal.connect(eua_pks_handler)


def eua_find_attendee_handler(sender, **kwargs):
    pk = kwargs['pk']

    try:
        label, event_pk, user_pk, attendee_pk = pk.split('.')

        if label != 'EUA':
            return None

        attendee = Attend.objects.get(
            pk=attendee_pk,
            user__pk=user_pk,
            event__pk=event_pk)

        return 'EUA', attendee

    except:
        return None

find_attendee_signal.connect(eua_find_attendee_handler)<commit_msg>Another rework of imports<commit_after># coding=UTF-8

from django.dispatch import receiver
from django.db.models.signals import Signal

from selvbetjening.core.events.models.attendee import Attend

request_attendee_pks_signal = Signal(providing_args=['attendee'])
find_attendee_signal = Signal(providing_args=['pk'])


@receiver(request_attendee_pks_signal)
def basic_pks_handler(sender, **kwargs):
    attendee = kwargs['attendee']
    return 'Attendee ID', str(attendee.pk)


@receiver(find_attendee_signal)
def basic_find_attendee_handler(sender, **kwargs):
    try:
        pk = int(kwargs['pk'])
        return 'Attendee ID', Attend.objects.get(pk=pk)

    except:
        return None


def eua_pks_handler(sender, **kwargs):
    attendee = kwargs['attendee']
    key = 'EUA.%s.%s.%s' % (attendee.event.pk,
                            attendee.user.pk,
                            attendee.pk)

    return 'EUA ID', key

request_attendee_pks_signal.connect(eua_pks_handler)


def eua_find_attendee_handler(sender, **kwargs):
    pk = kwargs['pk']

    try:
        label, event_pk, user_pk, attendee_pk = pk.split('.')

        if label != 'EUA':
            return None

        attendee = Attend.objects.get(
            pk=attendee_pk,
            user__pk=user_pk,
            event__pk=event_pk)

        return 'EUA', attendee

    except:
        return None

find_attendee_signal.connect(eua_find_attendee_handler)
{'fraction_non_alphanumeric': 0.1095695482034863, 'fraction_numerical': 0.000711490572749911, 'mean_word_length': 3.0286532951289398, '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': '247362', 'n_tokens_mistral': 995, 'n_tokens_neox': 970, 'n_words': 172}