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

logger = logging.getLogger(__name__)

from django.dispatch import receiver
from django.conf import settings
from django.db.models.signals import pre_save, post_save
from django.contrib.auth.signals import user_logged_in

from .models import TickleUser, Person, Discount, Holding, ShoppingCart


@receiver(pre_save, sender=TickleUser)
def generate_and_send_password_user(sender, instance, **kwargs):
    # Do this only for non-LiU id users.
    if not instance.person.liu_id and not instance.password and instance.id != settings.ANONYMOUS_USER_ID:
        instance.generate_and_send_password()


@receiver(pre_save, sender=Person)
def generate_and_send_password_person(sender, instance, **kwargs):
    # Do this only for non-LiU id users.
    if not instance.liu_id and hasattr(instance, 'user') and not instance.user.password and instance.id != settings.ANONYMOUS_USER_ID:
        instance.user.generate_and_send_password()


@receiver(user_logged_in)
def map_discount_eligibilities(sender, **kwargs):
    person = kwargs['user'].person
    Discount.objects.map_eligibilities(person)


@receiver(user_logged_in)
def create_shopping_cart(sender, **kwargs):
    person = kwargs['user'].person
    ShoppingCart.objects.get_or_create(person=person)


@receiver(post_save, sender=Holding)
def send_ticket(sender, instance, **kwargs):
    print('hej')
    if instance.product.is_ticket_type and getattr(instance, 'purchase'):
        instance.send_ticket()<commit_msg>Removed implicit creation of passwords<commit_after># -*- coding: utf-8 -*-
import logging

logger = logging.getLogger(__name__)

from django.dispatch import receiver
from django.conf import settings
from django.db.models.signals import pre_save, post_save
from django.contrib.auth.signals import user_logged_in

from .models import TickleUser, Person, Discount, Holding, ShoppingCart


@receiver(user_logged_in)
def map_discount_eligibilities(sender, **kwargs):
    person = kwargs['user'].person
    Discount.objects.map_eligibilities(person)


@receiver(user_logged_in)
def create_shopping_cart(sender, **kwargs):
    person = kwargs['user'].person
    ShoppingCart.objects.get_or_create(person=person)


@receiver(post_save, sender=Holding)
def send_ticket(sender, instance, **kwargs):
    if instance.product.is_ticket_type and getattr(instance, 'purchase'):
        instance.send_ticket()
{'fraction_non_alphanumeric': 0.10203235172127748, 'fraction_numerical': 0.0008295313148071339, 'mean_word_length': 5.662983425414365, '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': '5768509', 'n_tokens_mistral': 761, 'n_tokens_neox': 743, 'n_words': 169}