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

import os

from django import template
from django.conf import settings
from django.core.urlresolvers import reverse

register = template.Library()

from goog import utils


class GoogLinksNode(template.Node):

    def _create_css_link(self, css):
        if not css.endswith('.css'):
            css = '%s.css' % css
        url = reverse('goog_serve_closure', args=('goog/css/%s' % css,))
        return '<link rel="stylesheet" href="%s" />' % url

    def _create_js_tag(self, fname, context):
        tag = '<script src="%s"></script>'
        return template.Template(tag % fname).render(context)

    def _render_dev_mode(self, context):
        html = []
        if 'GOOG_STATIC_URL' not in context:
            context['GOOG_STATIC_URL'] = reverse('goog_serve_closure', args=('',))
        namespaces = getattr(settings, 'GOOG_JS_NAMESPACES', {})
        goog_included = False
        for ns in namespaces:
            data = namespaces[ns]
            if not goog_included and data.get('use_goog', data.get('use_goog_third_party', False)):
                html.insert(0, self._create_js_tag('{{GOOG_STATIC_URL}}goog/base.js', context))<commit_msg>Write type attribute in SCRIPT tag.<commit_after># -*- coding: utf-8 -*-

import os

from django import template
from django.conf import settings
from django.core.urlresolvers import reverse

register = template.Library()

from goog import utils


class GoogLinksNode(template.Node):

    def _create_css_link(self, css):
        if not css.endswith('.css'):
            css = '%s.css' % css
        url = reverse('goog_serve_closure', args=('goog/css/%s' % css,))
        return '<link rel="stylesheet" href="%s" />' % url

    def _create_js_tag(self, fname, context):
        tag = '<script src="%s" type="text/javascript"></script>'
        return template.Template(tag % fname).render(context)

    def _render_dev_mode(self, context):
        html = []
        if 'GOOG_STATIC_URL' not in context:
            context['GOOG_STATIC_URL'] = reverse('goog_serve_closure', args=('',))
        namespaces = getattr(settings, 'GOOG_JS_NAMESPACES', {})
        goog_included = False
        for ns in namespaces:
            data = namespaces[ns]
            if not goog_included and data.get('use_goog', data.get('use_goog_third_party', False)):
                html.insert(0, self._create_js_tag('{{GOOG_STATIC_URL}}goog/base.js', context))
{'fraction_non_alphanumeric': 0.1350020517029134, 'fraction_numerical': 0.0016413623307345096, 'mean_word_length': 3.0974789915966388, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3076370', 'n_tokens_mistral': 775, 'n_tokens_neox': 748, 'n_words': 177}