<commit_before># -*- coding: utf-8 -*-
from django import get_version
from distutils.version import StrictVersion
try:
    from django.urls import reverse
except ImportError:
    from django.core.urlresolvers import reverse
from django.template import Library
from django.utils.html import format_html

register = Library()


def notifications_unread(context):
    user = user_context(context)
    if not user:
        return ''
    return user.notifications.unread().count()


if StrictVersion(get_version()) >= StrictVersion('2.0'):
    notifications_unread = register.simple_tag(takes_context=True)(notifications_unread)
else:
    notifications_unread = register.assignment_tag(takes_context=True)(notifications_unread)


# Requires vanilla-js framework - http://vanilla-js.com/
@register.simple_tag
def register_notify_callbacks(badge_class='live_notify_badge',
                              menu_class='live_notify_list',
                              refresh_period=15,<commit_msg>Improve code quality of notifications_tag.py<commit_after>''' Django notifications template tags file '''
# -*- coding: utf-8 -*-
from distutils.version import StrictVersion # pylint: disable=no-name-in-module,import-error

from django import get_version
from django.template import Library
from django.utils.html import format_html

try:
    from django.urls import reverse
except ImportError:
    from django.core.urlresolvers import reverse # pylint: disable=no-name-in-module,import-error

register = Library()


def notifications_unread(context):
    user = user_context(context)
    if not user:
        return ''
    return user.notifications.unread().count()


if StrictVersion(get_version()) >= StrictVersion('2.0'):
    notifications_unread = register.simple_tag(takes_context=True)(notifications_unread)  # pylint: disable=invalid-name
else:
    notifications_unread = register.assignment_tag(takes_context=True)(notifications_unread)  # pylint: disable=invalid-name


# Requires vanilla-js framework - http://vanilla-js.com/
@register.simple_tag
def register_notify_callbacks(badge_class='live_notify_badge',  # pylint: disable=too-many-arguments,missing-docstring
                              menu_class='live_notify_list',
                              refresh_period=15,
{'fraction_non_alphanumeric': 0.0950285965684118, 'fraction_numerical': 0.004399472063352398, 'mean_word_length': 4.168181818181818, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5443948', 'n_tokens_mistral': 664, 'n_tokens_neox': 644, 'n_words': 136}