<commit_before>from django.template.loader import get_template
from django.utils.safestring import mark_safe
from django_social_share.templatetags.social_share import post_to_gplus_url, post_to_twitter_url, post_to_facebook_url

from . import registry

SHARES = [
    ('post_to_twitter', 'django_social_share/templatetags/post_to_twitter.html', post_to_twitter_url),
    ('post_to_facebook', 'django_social_share/templatetags/post_to_facebook.html', post_to_facebook_url),
    ('post_to_gplus', 'django_social_share/templatetags/post_to_gplus.html', post_to_gplus_url),
    # For future versions:
    # ('post_to_linkedin', 'django_social_share/templatetags/post_to_linkedin.html', post_to_linkedin_url),
    # ('post_to_reddit', 'django_social_share/templatetags/post_to_reddit.html', post_to_reddit_url),
]


def make_func(name, template, url_func):
    def func(request, *args):
        link_text = args[-1]
        context = {'request': request, 'link_text': mark_safe(link_text)}
        context = url_func(context, *args[:-1])
        return mark_safe(get_template(template).render(context))

    func.__name__ = name
    registry.function(name, func)


for name, template, url_func in SHARES:
    make_func(name, template, url_func)


@registry.function
def recaptcha_init(language=None):
    get_template('snowpenguin/recaptcha/recaptcha_init.html').render({'explicit': False, 'language': language})<commit_msg>It helps to fucking return; #635<commit_after>from django.template.loader import get_template
from django.utils.safestring import mark_safe
from django_social_share.templatetags.social_share import post_to_gplus_url, post_to_twitter_url, post_to_facebook_url

from . import registry

SHARES = [
    ('post_to_twitter', 'django_social_share/templatetags/post_to_twitter.html', post_to_twitter_url),
    ('post_to_facebook', 'django_social_share/templatetags/post_to_facebook.html', post_to_facebook_url),
    ('post_to_gplus', 'django_social_share/templatetags/post_to_gplus.html', post_to_gplus_url),
    # For future versions:
    # ('post_to_linkedin', 'django_social_share/templatetags/post_to_linkedin.html', post_to_linkedin_url),
    # ('post_to_reddit', 'django_social_share/templatetags/post_to_reddit.html', post_to_reddit_url),
]


def make_func(name, template, url_func):
    def func(request, *args):
        link_text = args[-1]
        context = {'request': request, 'link_text': mark_safe(link_text)}
        context = url_func(context, *args[:-1])
        return mark_safe(get_template(template).render(context))

    func.__name__ = name
    registry.function(name, func)


for name, template, url_func in SHARES:
    make_func(name, template, url_func)


@registry.function
def recaptcha_init(language=None):
    return get_template('snowpenguin/recaptcha/recaptcha_init.html').render({'explicit': False, 'language': language})
{'fraction_non_alphanumeric': 0.11173184357541899, 'fraction_numerical': 0.0024441340782122905, 'mean_word_length': 5.970802919708029, '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': '6400392', 'n_tokens_mistral': 991, 'n_tokens_neox': 984, 'n_words': 155}