<commit_before>from django.db.models.signals import post_save
from django.dispatch import receiver
from actstream.models import Action
from realtime.helpers import send_message
from django.conf import settings
# from wiki.models import ArticleRevision
# from actstream import action


@receiver(post_save, sender=Action)
def action_save_handler(sender, created, instance, **kwargs):
    is_quiet = instance.data is not None and instance.data.get('quiet', False)
    if not created or is_quiet or not instance.public:
        return

    if instance.target:
        send_message(
            key=type(instance.action_object).__name__ + "." + instance.verb,
            message="{user} {verb} «{action_object}» dans «{target}» ({url})",
            user=instance.actor,
            verb=instance.verb,
            action_object=instance.action_object,
            target=instance.target,
            url=settings.ROOT_URL + instance.target.get_absolute_url()
        )
    else:
        if instance.action_object:
            urltosend = settings.ROOT_URL + instance.action_object.get_absolute_url()
        else:
            urltosend = settings.ROOT_URL
        send_message(
            key=type(instance.action_object).__name__ + "." + instance.verb,
            message="{user} {verb} «{action_object}» ({url})",
            user=instance.actor,
            verb=instance.verb,
            action_object=instance.action_object,
            url=urltosend
        )

'''
@receiver(post_save, sender=ArticleRevision)
def wiki_save_handler(sender, created, instance, **kwargs):
    if not created:
        return

    path = str(instance.article.urlpath_set.first())
    # Root node is presented as "(root)" but may be localized
    if path[0] == '(' and path[-1] == ')':
        path = ''
    url = settings.ROOT_URL + "/wiki/" + path

    if url:
        message = "{user} a édité la page «{title}» du wiki ({url})"
    else:
        message = "{user} a créé la page «{title}» sur le wiki"

    send_message(
        key='wiki.revision',
        message=message,
        user=instance.user,
        title=instance.title,
        url=url
    )
    # Add an actream line
    action.send(instance.user, verb='a édité', action_object=instance.article)
'''<commit_msg>[Upd] fix flake + deleted deprecated view<commit_after>from django.db.models.signals import post_save
from django.dispatch import receiver
from actstream.models import Action
from realtime.helpers import send_message
from django.conf import settings
# from wiki.models import ArticleRevision
# from actstream import action


@receiver(post_save, sender=Action)
def action_save_handler(sender, created, instance, **kwargs):
    is_quiet = instance.data is not None and instance.data.get('quiet', False)
    if not created or is_quiet or not instance.public:
        return

    if instance.target:
        send_message(
            key=type(instance.action_object).__name__ + "." + instance.verb,
            message="{user} {verb} «{action_object}» dans «{target}» ({url})",
            user=instance.actor,
            verb=instance.verb,
            action_object=instance.action_object,
            target=instance.target,
            url=settings.ROOT_URL + instance.target.get_absolute_url()
        )
    else:
        if instance.action_object:
            urltosend = settings.ROOT_URL + instance.action_object.get_absolute_url()
        else:
            urltosend = settings.ROOT_URL
        send_message(
            key=type(instance.action_object).__name__ + "." + instance.verb,
            message="{user} {verb} «{action_object}» ({url})",
            user=instance.actor,
            verb=instance.verb,
            action_object=instance.action_object,
            url=urltosend
        )

{'fraction_non_alphanumeric': 0.10739856801909307, 'fraction_numerical': 0.0005303632988597189, 'mean_word_length': 2.716256157635468, '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': '1259359', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1064, 'n_words': 268}