text stringlengths 0 1.05M | meta dict |
|---|---|
from django.template import RequestContext
from django.template.loader import get_template
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import get_formatter_by_name
from paste.tools import cache_exists, cache_fetch, cache_store
def render_pygments(request, past... | {
"repo_name": "setsuna-/pasteque",
"path": "paste/renderers.py",
"copies": "1",
"size": "1309",
"license": "mit",
"hash": -3328209467498109400,
"line_mean": 35.3611111111,
"line_max": 72,
"alpha_frac": 0.7119938885,
"autogenerated": false,
"ratio": 3.9427710843373496,
"config_test": false,
"h... |
from django.template import RequestContext
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
class Menu(object):
"""
This class provides some tools to create and render tree structure menu in according to nodes' structure
created for your application.
It... | {
"repo_name": "20tab/upy",
"path": "upy/contrib/tree/menu.py",
"copies": "1",
"size": "8534",
"license": "bsd-3-clause",
"hash": 7038008410284461000,
"line_mean": 39.4502369668,
"line_max": 116,
"alpha_frac": 0.5308179049,
"autogenerated": false,
"ratio": 4.218487394957983,
"config_test": false... |
from django.template import RequestContext
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
def prepare_nodes(nodes, request):
for node in nodes:
if node.slugable:
if node.show_if_logged and request.user and (
not node.groups.all... | {
"repo_name": "20tab/twentytab-tree",
"path": "tree/menu.py",
"copies": "1",
"size": "6090",
"license": "mit",
"hash": 3217631552257624000,
"line_mean": 38.5519480519,
"line_max": 116,
"alpha_frac": 0.5825944171,
"autogenerated": false,
"ratio": 4.025115664243225,
"config_test": false,
"has_n... |
from django.template import RequestContext
from django.template.loader import render_to_string
class BaseItem(object):
template = 'wagtailadmin/userbar/item_base.html'
def render(self, request):
return render_to_string(self.template, dict(self=self, request=request), context_instance=RequestContext(re... | {
"repo_name": "willcodefortea/wagtail",
"path": "wagtail/wagtailadmin/userbar.py",
"copies": "10",
"size": "2608",
"license": "bsd-3-clause",
"hash": 2866939597156362000,
"line_mean": 32.0126582278,
"line_max": 122,
"alpha_frac": 0.657208589,
"autogenerated": false,
"ratio": 4.081377151799687,
... |
from django.template import RequestContext
from django.template.loader import render_to_string
from wagtail.wagtailcore import hooks
from wagtail.wagtailcore.models import Page
class SummaryItem(object):
order = 100
def __init__(self, request):
self.request = request
def get_context(self):
... | {
"repo_name": "jorge-marques/wagtail",
"path": "wagtail/wagtailadmin/site_summary.py",
"copies": "1",
"size": "1389",
"license": "bsd-3-clause",
"hash": -7851820002951935000,
"line_mean": 27.3469387755,
"line_max": 107,
"alpha_frac": 0.6666666667,
"autogenerated": false,
"ratio": 4.00288184438040... |
from django.template import RequestContext
from django.template.response import TemplateResponse
from icekit.publishing.utils import get_visible_object_or_404
from icekit_events.models import Occurrence
from .models import Location
def index(request):
locations = Location.objects.visible()
context = Reques... | {
"repo_name": "ic-labs/django-icekit",
"path": "icekit/plugins/location/views.py",
"copies": "1",
"size": "1029",
"license": "mit",
"hash": -5384151670964643000,
"line_mean": 32.1935483871,
"line_max": 65,
"alpha_frac": 0.7220602527,
"autogenerated": false,
"ratio": 4.067193675889328,
"config_t... |
from django.template import RequestContext
from django.test.client import RequestFactory
from wagtailmenus.conf import constants
from wagtailmenus.models.menus import ContextualVals, OptionVals
SUB_MENU_TEMPLATE_LIST = (
'menus/sub_menu_level_2.html',
'menus/sub_menu_level_3.html',
)
SINGLE_ITEM_SUB_MENU_TEMP... | {
"repo_name": "ababic/wagtailmenus",
"path": "wagtailmenus/tests/utils.py",
"copies": "2",
"size": "1897",
"license": "mit",
"hash": -7710965077707637000,
"line_mean": 23.0126582278,
"line_max": 69,
"alpha_frac": 0.6494464945,
"autogenerated": false,
"ratio": 3.648076923076923,
"config_test": f... |
from django.template import RequestContext
from django.utils.timezone import now
from django.views.decorators.cache import cache_control
from bulbs.content.views import ContentListView
class RSSView(ContentListView):
"""Really simply, this syndicates Content."""
template_name = "feeds/rss.xml"
paginate_b... | {
"repo_name": "pombredanne/django-bulbs",
"path": "bulbs/feeds/views.py",
"copies": "1",
"size": "1729",
"license": "mit",
"hash": 7465679811358753000,
"line_mean": 40.1666666667,
"line_max": 87,
"alpha_frac": 0.6454598034,
"autogenerated": false,
"ratio": 3.572314049586777,
"config_test": fals... |
from django.template import RequestContext
from django.utils.timezone import now
from core.json import get_server_time_str
from timers.models import Timer
class ArZeitContext(RequestContext):
active_tab = None
auto_refresh = 0
extra_css = ()
extra_js = ()
def __init__(self, request, context, **... | {
"repo_name": "peap/djarzeit",
"path": "core/context.py",
"copies": "1",
"size": "1166",
"license": "mit",
"hash": 43956762361835900,
"line_mean": 30.5135135135,
"line_max": 76,
"alpha_frac": 0.563464837,
"autogenerated": false,
"ratio": 3.899665551839465,
"config_test": false,
"has_no_keywor... |
from django.template import RequestContext
from django.views.decorators.cache import never_cache
from django.contrib.admin.views.decorators import staff_member_required
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse
from splango.models import *
@never_cache
de... | {
"repo_name": "shimon/Splango",
"path": "splango/views.py",
"copies": "1",
"size": "3091",
"license": "mit",
"hash": -8966501497712409000,
"line_mean": 32.967032967,
"line_max": 97,
"alpha_frac": 0.5642186995,
"autogenerated": false,
"ratio": 4.378186968838527,
"config_test": false,
"has_no_k... |
from django.template import RequestContext
from django.views.generic import DeleteView
from django.core.urlresolvers import reverse
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
from django.shortcuts import redirect, render_to_response
from django.contrib.auth.deco... | {
"repo_name": "buddylindsey/photo-blogger",
"path": "image/views.py",
"copies": "1",
"size": "1901",
"license": "bsd-2-clause",
"hash": -2817767061296748500,
"line_mean": 31.775862069,
"line_max": 99,
"alpha_frac": 0.6654392425,
"autogenerated": false,
"ratio": 4.350114416475972,
"config_test":... |
from django.template import RequestContext
from mezzanine.conf import settings
from mezzanine.generic.models import Keyword
from mezzanine.utils.views import render
from vikalp.helper_functions.functional import get_model_content_type, process_tag_or_categories_or_article, get_page, translate_to_model
from vikalp.model... | {
"repo_name": "vikalpindia/vikalp",
"path": "vikalp/views/article_list_view.py",
"copies": "1",
"size": "2491",
"license": "apache-2.0",
"hash": -7617949138136680000,
"line_mean": 50.8958333333,
"line_max": 137,
"alpha_frac": 0.6868727419,
"autogenerated": false,
"ratio": 3.8921875,
"config_tes... |
from django.template import RequestContext
from mezzanine.conf import settings
from mezzanine.utils.views import render
from vikalp.helper_functions.functional import get_page
from vikalp.views.google_maps import get_article_map, MapFormForSideBar
from vikalp.views.views import article_service
class ArticleListByDate... | {
"repo_name": "vikalpindia/vikalp",
"path": "vikalp/views/article_list_by_date.py",
"copies": "1",
"size": "1385",
"license": "apache-2.0",
"hash": -2178559171333057800,
"line_mean": 54.4,
"line_max": 143,
"alpha_frac": 0.7205776173,
"autogenerated": false,
"ratio": 3.7635869565217392,
"config_... |
from django.template import RequestContext
from .models import Quotes
from .forms import ContactUsForm
from .queries import get_landing_page_data
from django.views.generic import View
from django.shortcuts import render
import logging
LOGGER = logging.getLogger(__name__)
class HomePageView(View):
template_name ... | {
"repo_name": "Mihai925/EduCoding",
"path": "LandingPage/views.py",
"copies": "1",
"size": "1596",
"license": "mit",
"hash": -2069067464953146,
"line_mean": 36.1162790698,
"line_max": 74,
"alpha_frac": 0.5545112782,
"autogenerated": false,
"ratio": 4.396694214876033,
"config_test": false,
"ha... |
from django.template import RequestContext
from rest_framework.decorators import list_route
from rest_framework.response import Response
from anaf.core.decorators import apifirst
from anaf.core.models import Object
from anaf.core.rendering import API_RENDERERS, NOAPI_RENDERERS
from anaf.identities import models
from a... | {
"repo_name": "tovmeod/anaf",
"path": "anaf/identities/api/views.py",
"copies": "1",
"size": "2334",
"license": "bsd-3-clause",
"hash": 5358367587694652000,
"line_mean": 30.5405405405,
"line_max": 110,
"alpha_frac": 0.7107969152,
"autogenerated": false,
"ratio": 4.220614828209765,
"config_test"... |
from django.template import RequestContext
from achilles import blocks, actions
register = actions.Library('tables')
def default_accessor(object, name):
"""
Extract the given field from a model:
:param object: Object to read the field from
:param name: Field name to access on the object
"""
... | {
"repo_name": "exekias/django-achilles",
"path": "achilles/tables/columns.py",
"copies": "1",
"size": "4945",
"license": "apache-2.0",
"hash": 5971323592102823000,
"line_mean": 28.6107784431,
"line_max": 79,
"alpha_frac": 0.6182002022,
"autogenerated": false,
"ratio": 4.059934318555008,
"config... |
from django.template import RequestContext
# from django.forms import models as forms_models
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator
from django.core.conte... | {
"repo_name": "boyombo/pharmrep",
"path": "pharmrep/forum/views.py",
"copies": "1",
"size": "3793",
"license": "mit",
"hash": 3691050047216486400,
"line_mean": 31.6982758621,
"line_max": 123,
"alpha_frac": 0.6511995782,
"autogenerated": false,
"ratio": 3.870408163265306,
"config_test": false,
... |
from django.template import response
from django.utils import six
from .loader import get_template, select_template
class TemplateResponse(response.TemplateResponse):
def resolve_template(self, template):
"""
Accepts a template object, path-to-template or list of paths
Hard override acce... | {
"repo_name": "altio/foundation",
"path": "foundation/template/response.py",
"copies": "2",
"size": "1216",
"license": "mit",
"hash": -6395710154133584000,
"line_mean": 34.7647058824,
"line_max": 78,
"alpha_frac": 0.6159539474,
"autogenerated": false,
"ratio": 4.421818181818182,
"config_test": ... |
from django.template import Template, Context
from django.conf import settings
from django.utils import timezone
from django.utils.text import slugify
from urlparse import urljoin
from django.core.urlresolvers import reverse
def get_notifications_url(base):
"""
Returns the full URL for notifications given a... | {
"repo_name": "timrchavez/capomastro",
"path": "jenkins/utils.py",
"copies": "1",
"size": "2175",
"license": "mit",
"hash": -2325966306168589000,
"line_mean": 28.7945205479,
"line_max": 79,
"alpha_frac": 0.6648275862,
"autogenerated": false,
"ratio": 4.10377358490566,
"config_test": false,
"h... |
from django.template import Template,Context
from django.conf import settings
import pyperclip
import sys
import os
'''
creating a python script that will read in the coverLetter template
add the company name, and save it to a new file and the system's clipboard
Also append the current date to the letters as well
the c... | {
"repo_name": "akperkins/cover-letter",
"path": "createCoverLetter.py",
"copies": "1",
"size": "2632",
"license": "mit",
"hash": -7301405361187280000,
"line_mean": 31.0975609756,
"line_max": 105,
"alpha_frac": 0.7051671733,
"autogenerated": false,
"ratio": 3.808972503617945,
"config_test": fals... |
from django.template import Template, Context
from django.conf import settings
def parse(kwargs):
id = kwargs.get('id')
width = int(kwargs.get('width', getattr(settings, 'SHORTCODES_YOUTUBE_WIDTH', 425)))
height = int(kwargs.get('height', 0))
jquery = getattr(settings, 'SHORTCODES_YOUTUBE_JQUERY', False)
i... | {
"repo_name": "AGoodId/django-shortcodes",
"path": "shortcodes/parsers/youtube.py",
"copies": "1",
"size": "1664",
"license": "mit",
"hash": 6782426901843932000,
"line_mean": 35.1739130435,
"line_max": 209,
"alpha_frac": 0.5715144231,
"autogenerated": false,
"ratio": 3.075785582255083,
"config_... |
from django.template import Template, Context
from django.conf import settings
def parse(kwargs):
id = kwargs.get('id')
width = int(kwargs.get(
'w',
getattr(settings, 'SHORTCODES_YOUTUBE_WIDTH', 480))
)
height = int(kwargs.get(
'h',
getattr(settings, 'SHORTCODES_YOUTUBE... | {
"repo_name": "writepython/django-shortcodes",
"path": "shortcodes/parsers/youtube.py",
"copies": "1",
"size": "1877",
"license": "mit",
"hash": 228224908949424580,
"line_mean": 34.4150943396,
"line_max": 79,
"alpha_frac": 0.5167820991,
"autogenerated": false,
"ratio": 3.388086642599278,
"confi... |
from django.template import Template, Context
from django.conf import settings
def parse(kwargs):
id = kwargs.get('v')
width = int(kwargs.get(
'w',
getattr(settings, 'SHORTCODES_YOUTUBE_WIDTH', 480))
)
height = int(kwargs.get(
'h',
getattr(settings, 'SHORTCODES_YOUTUBE_... | {
"repo_name": "martey/django-shortcodes",
"path": "shortcodes/parsers/youtube.py",
"copies": "1",
"size": "1876",
"license": "mit",
"hash": -920074225504466700,
"line_mean": 34.3962264151,
"line_max": 79,
"alpha_frac": 0.5165245203,
"autogenerated": false,
"ratio": 3.3862815884476536,
"config_t... |
from django.template import Template, Context
from django.core.mail import EmailMessage
from django.conf import settings
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from .models import BootstrapForm, BootstrapFormResponses
from .forms import Form
class BootstrapFormPlugin(CMSPlu... | {
"repo_name": "jhhazelaar/djangocms-bootstrap",
"path": "djangocms_bootstrap_forms/cms_plugins.py",
"copies": "1",
"size": "1897",
"license": "apache-2.0",
"hash": -9040001601893114000,
"line_mean": 40.2391304348,
"line_max": 94,
"alpha_frac": 0.6199261993,
"autogenerated": false,
"ratio": 4.5932... |
from django.template import Template, Context
from django.shortcuts import get_object_or_404, Http404, redirect
from django.views.generic import DetailView, ListView, TemplateView
from .models import Realm, Entity, EntityType
from .api_views import search
from .utils import get_current_app
class BaseRealmMixin(objec... | {
"repo_name": "correctiv/django-yolodex",
"path": "yolodex/views.py",
"copies": "1",
"size": "3550",
"license": "mit",
"hash": 6744191427729665000,
"line_mean": 29.6034482759,
"line_max": 82,
"alpha_frac": 0.6442253521,
"autogenerated": false,
"ratio": 3.841991341991342,
"config_test": false,
... |
from django.template import Template, Context
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from debug_toolbar.panels import Panel
import pycassa_tracker as tracker
SUBTITLE_TEMPLATE = u"""
{% for o, n, t in o... | {
"repo_name": "pista329/django-debug-toolbar-pycassa",
"path": "debug_toolbar_pycassa/pycassa_panel.py",
"copies": "1",
"size": "2222",
"license": "mit",
"hash": 8813603080568467000,
"line_mean": 31.2173913043,
"line_max": 74,
"alpha_frac": 0.5747074707,
"autogenerated": false,
"ratio": 3.7533783... |
from django.template import Template, Context
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from debug_toolbar.panels import DebugPanel
from . import operation_tracker
_NAV_SUBTITLE_TPL = '''
{% for o, n, t in operations %}
{{ n }} {{ o }}{{ n|pluralize }} in {... | {
"repo_name": "viotti/django-debug-toolbar-mongo",
"path": "debug_toolbar_mongo/panel.py",
"copies": "1",
"size": "2925",
"license": "mit",
"hash": -6167874241996014000,
"line_mean": 33.8214285714,
"line_max": 79,
"alpha_frac": 0.6017094017,
"autogenerated": false,
"ratio": 3.931451612903226,
"... |
from django.template import Template, Context
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from debug_toolbar.panels import DebugPanel
import operation_tracker
_NAV_SUBTITLE_TPL = u'''
{% for o, n, t in operations %}
{{ n }} {{ o }}{{ n|pluralize }} in {{ t }}... | {
"repo_name": "hmarr/django-debug-toolbar-mongo",
"path": "debug_toolbar_mongo/panel.py",
"copies": "3",
"size": "2615",
"license": "mit",
"hash": -1609120639956166000,
"line_mean": 33.4078947368,
"line_max": 78,
"alpha_frac": 0.6049713193,
"autogenerated": false,
"ratio": 3.8569321533923304,
"... |
from django.template import Template, Context
from django.test import TestCase
from django.core.paginator import Paginator
from django.contrib.auth.models import User
class TemplateTagTests(TestCase):
fixtures = ['students_test_data.json']
def test_pagenav_tag(self):
"""Pagenav tag returns page navi... | {
"repo_name": "PyDev777/studentsdb",
"path": "students/tests/test_templatetags.py",
"copies": "1",
"size": "2435",
"license": "mit",
"hash": 507876852813918660,
"line_mean": 36.4615384615,
"line_max": 156,
"alpha_frac": 0.5724845996,
"autogenerated": false,
"ratio": 3.896,
"config_test": true,
... |
from django.template import Template, Context
from django.test import TestCase
from django.urls import reverse
from video.models import Video, VideoGallery
from .forms import VideoForm
class TestVideo(TestCase):
def test_youtube_video(self):
"""
Test that newly saved youtube videos
are c... | {
"repo_name": "tBaxter/Tango",
"path": "build/lib/video/tests.py",
"copies": "1",
"size": "3556",
"license": "mit",
"hash": 4810605412697997000,
"line_mean": 36.0416666667,
"line_max": 90,
"alpha_frac": 0.6220472441,
"autogenerated": false,
"ratio": 4.064,
"config_test": true,
"has_no_keyword... |
from django.template import Template, Context
from django.test import TestCase
from django.utils.text import slugify
from pages.models import Page, PageTemplate
class PagesTest(TestCase):
def test_page_creation(self):
""" Test that a Page can be created """
page = Page.objects.create(title=u'Test... | {
"repo_name": "waustin/django-multilanguage-testing",
"path": "apps/pages/tests.py",
"copies": "1",
"size": "7790",
"license": "apache-2.0",
"hash": -7280253090210619000,
"line_mean": 44.2906976744,
"line_max": 141,
"alpha_frac": 0.6453145058,
"autogenerated": false,
"ratio": 3.635090993933738,
... |
from django.template import Template, Context
from django.test import TestCase
from ..import settings
from ..models import URLMap
class TestTags(TestCase):
def setUp(self):
self.context = Context({'request': None})
self.template = Template("""
{% load urlmapper_tags %}
test_1_is_... | {
"repo_name": "TwigWorld/django-url-mapper",
"path": "urlmapper/tests/test_tags.py",
"copies": "1",
"size": "1935",
"license": "mit",
"hash": 2721774681754392600,
"line_mean": 41.0652173913,
"line_max": 65,
"alpha_frac": 0.5664082687,
"autogenerated": false,
"ratio": 3.208955223880597,
"config_... |
from django.template import Template, Context
from django.utils.html import escape
from daguerre.helpers import AdjustmentHelper
from daguerre.models import AdjustedImage
from daguerre.tests.base import BaseTestCase
class AdjustTemplatetagTestCase(BaseTestCase):
def test_path(self):
# Tag should accept a... | {
"repo_name": "mislavcimpersak/django-daguerre",
"path": "daguerre/tests/functional/test_templatetags.py",
"copies": "1",
"size": "4036",
"license": "bsd-3-clause",
"hash": 4548477728387681300,
"line_mean": 41.0416666667,
"line_max": 78,
"alpha_frac": 0.5782953419,
"autogenerated": false,
"ratio"... |
from django.template import Template, Context
from django.utils import translation
from test_plus.test import TestCase
from pyconca2017.pycon_sponsors.tests.factories import SponsorFactory
class TestBilingualTags(TestCase):
def setUp(self):
translation.activate('en')
self.sponsor = SponsorFactor... | {
"repo_name": "pyconca/2017-web",
"path": "pyconca2017/pycon_sponsors/tests/test_tags.py",
"copies": "1",
"size": "2121",
"license": "mit",
"hash": -3064273380910303700,
"line_mean": 40.5882352941,
"line_max": 89,
"alpha_frac": 0.6529938708,
"autogenerated": false,
"ratio": 3.9060773480662982,
... |
from django.template import Template, Context
from django.utils.safestring import mark_safe
from django.conf import settings
try:
from bs4 import BeautifulSoup
except ImportError:
from BeautifulSoup import BeautifulSoup
def parse(tag_atts, tag_contents):
"""
From wordpress source: https://github.com/W... | {
"repo_name": "emilbjorklund/django-template-shortcodes",
"path": "shortcodes/parsers/caption.py",
"copies": "1",
"size": "1949",
"license": "mit",
"hash": 7844914887315718000,
"line_mean": 33.2105263158,
"line_max": 155,
"alpha_frac": 0.5597742432,
"autogenerated": false,
"ratio": 4.146808510638... |
from django.template import Template, Context
from django.utils.safestring import mark_safe
from django.utils.html import urlize, escape
from djangopress.core.format.smilies import add_smilies
from djangopress.core.format.bbcode import bbcode
from djangopress.core.format import magic_html as magic_html_mod
from djangop... | {
"repo_name": "codefisher/djangopress",
"path": "djangopress/core/format/library.py",
"copies": "1",
"size": "4597",
"license": "mit",
"hash": -2293588700728112400,
"line_mean": 30.9305555556,
"line_max": 113,
"alpha_frac": 0.624537742,
"autogenerated": false,
"ratio": 3.63399209486166,
"config... |
from django.template import Template, Context
from django.utils.safestring import mark_safe
def admin_url(inst):
"""
:param inst: An Model Instance
:return: the admin URL for the instance. Permissions aren't checked.
"""
if inst:
t = Template("""{% load admin_urls %}{% url opts|admin_urlna... | {
"repo_name": "ic-labs/django-icekit",
"path": "icekit/admin_tools/utils.py",
"copies": "1",
"size": "1250",
"license": "mit",
"hash": -642133247107671900,
"line_mean": 45.2962962963,
"line_max": 243,
"alpha_frac": 0.6264,
"autogenerated": false,
"ratio": 3.676470588235294,
"config_test": false... |
from django.template import Template, Context
from django.utils.translation import gettext_lazy
from devilry.apps.core import models as core_models
class UserInfo(object):
def __init__(self, groupuserlookup, user):
self.groupuserlookup = groupuserlookup
self.user = user
@property
def can... | {
"repo_name": "devilry/devilry-django",
"path": "devilry/apps/core/group_user_lookup.py",
"copies": "1",
"size": "6438",
"license": "bsd-3-clause",
"hash": -2833509564328108000,
"line_mean": 42.7959183673,
"line_max": 148,
"alpha_frac": 0.619602361,
"autogenerated": false,
"ratio": 3.947271612507... |
from django.template import Template, Context
from django.views.generic import FormView
from django.test import RequestFactory
from django.utils.translation import gettext_lazy as _
from django.db import IntegrityError
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseBadRequest,... | {
"repo_name": "django-danceschool/django-danceschool",
"path": "danceschool/vouchers/views.py",
"copies": "1",
"size": "9456",
"license": "bsd-3-clause",
"hash": -7158938063006174000,
"line_mean": 35.9375,
"line_max": 119,
"alpha_frac": 0.6254230118,
"autogenerated": false,
"ratio": 4.52873563218... |
from django.template import Template, Context
from gis_csdt.settings import GOOGLE_API_KEY
from gis_csdt.models import MapPoint
from gis_csdt.geometry_tools import circle_as_polygon
from gis_csdt.filter_tools import neighboring_points
from django.http import HttpResponse
from django.contrib.sites.shortcuts import get_c... | {
"repo_name": "GK-12/SGIS-backend",
"path": "gis_csdt/templates.py",
"copies": "2",
"size": "6937",
"license": "bsd-3-clause",
"hash": 7759899673405120000,
"line_mean": 36.4972972973,
"line_max": 278,
"alpha_frac": 0.5108836673,
"autogenerated": false,
"ratio": 3.819933920704846,
"config_test":... |
from django.template import Template, Context
import os.path
from drf_generators.templates.serializer import SERIALIZER
from drf_generators.templates.apiview import API_URL, API_VIEW
from drf_generators.templates.viewset import VIEW_SET_URL, VIEW_SET_VIEW
from drf_generators.templates.function import FUNCTION_URL, FUN... | {
"repo_name": "Brobin/drf-generators",
"path": "drf_generators/generators.py",
"copies": "1",
"size": "3977",
"license": "mit",
"hash": 2187981364588952300,
"line_mean": 34.5089285714,
"line_max": 77,
"alpha_frac": 0.6359064622,
"autogenerated": false,
"ratio": 3.9889669007021062,
"config_test"... |
from django.template import Template, Context
class TemplateHintProvider(object):
'''
Use this mixin for objects which shall provide template hints.
'''
def get_template_hints(self, name_provider, hint_providers):
'''
Return a list of strings that indicate hints that should be appende... | {
"repo_name": "team23/django_backend",
"path": "django_backend/backend/utils.py",
"copies": "1",
"size": "5230",
"license": "bsd-3-clause",
"hash": -4374568219813502500,
"line_mean": 38.0373134328,
"line_max": 83,
"alpha_frac": 0.6049713193,
"autogenerated": false,
"ratio": 4.694793536804309,
"... |
from django.template import Template, Context
def test_blog_replace_query_link(rf):
"""
Ensures that the replace_query_link clones the request query string, and
updates a value with the given argument. The returned value must be URL
encoded.
- a template makes use of the replace_query_link tem... | {
"repo_name": "palazzem/wagtail-nesting-box",
"path": "tests/test_templatetags.py",
"copies": "1",
"size": "1775",
"license": "bsd-2-clause",
"hash": -7402770621556640000,
"line_mean": 35.9791666667,
"line_max": 76,
"alpha_frac": 0.6433802817,
"autogenerated": false,
"ratio": 4.297820823244552,
... |
from django.template import Template, Context, RequestContext
from django.template.loader import get_template
from django.http import HttpResponse
from django.shortcuts import render_to_response,render
from django.views.decorators.csrf import csrf_protect, csrf_exempt
from django.core.context_processors import csrf
fro... | {
"repo_name": "zniper/zeenote",
"path": "simplenote/views.py",
"copies": "1",
"size": "16046",
"license": "mit",
"hash": 5298481941111281000,
"line_mean": 34.0349344978,
"line_max": 113,
"alpha_frac": 0.5442477876,
"autogenerated": false,
"ratio": 4.0346995222529545,
"config_test": false,
"ha... |
from django.template import Template, Context, VariableDoesNotExist, TemplateSyntaxError
from django.test import RequestFactory
from template_analyzer import get_node_instances
from fluent_contents.models import Placeholder
from fluent_contents.templatetags.fluent_contents_tags import PagePlaceholderNode
from fluent_co... | {
"repo_name": "pombredanne/django-fluent-contents",
"path": "fluent_contents/tests/templatetags.py",
"copies": "1",
"size": "7289",
"license": "apache-2.0",
"hash": -4094736692952001500,
"line_mean": 52.204379562,
"line_max": 165,
"alpha_frac": 0.6583893538,
"autogenerated": false,
"ratio": 3.989... |
from django.template import TemplateDoesNotExist, Context
from django.template.loader import get_template
from nose import tools
loader = None
def setup():
"make sure that template loaders are loaded."
global loader
tools.assert_raises(TemplateDoesNotExist, get_template, 'non-existent-template.html')
... | {
"repo_name": "WhiskeyMedia/django-templatefinder",
"path": "tests/test_template_loader.py",
"copies": "1",
"size": "1094",
"license": "bsd-3-clause",
"hash": -4474350176967370000,
"line_mean": 38.0714285714,
"line_max": 114,
"alpha_frac": 0.7595978062,
"autogenerated": false,
"ratio": 3.65886287... |
from django.template import TemplateDoesNotExist
from django.template.loader import get_template
from django.utils import six
_cached_name_lookups = {}
def select_template_name(template_name_list):
"""
Given a list of template names, find the first one that exists.
"""
if not isinstance(template_name... | {
"repo_name": "Venturi/oldcms",
"path": "env/lib/python2.7/site-packages/parler/utils/template.py",
"copies": "8",
"size": "1102",
"license": "apache-2.0",
"hash": 2968103148768943600,
"line_mean": 35.7333333333,
"line_max": 111,
"alpha_frac": 0.6460980036,
"autogenerated": false,
"ratio": 4.5349... |
from django.template import TemplateDoesNotExist
from django.template.loader import (
get_template, render_to_string, select_template,
)
from django.test import SimpleTestCase, override_settings
from django.test.client import RequestFactory
@override_settings(TEMPLATES=[{
'BACKEND': 'django.template.backends.... | {
"repo_name": "zhaodelong/django",
"path": "tests/template_loader/tests.py",
"copies": "289",
"size": "6920",
"license": "bsd-3-clause",
"hash": -7654557616805286000,
"line_mean": 43.358974359,
"line_max": 83,
"alpha_frac": 0.6304913295,
"autogenerated": false,
"ratio": 4.018583042973287,
"conf... |
from django.template import TemplateDoesNotExist
from django.test import (
Client, RequestFactory, SimpleTestCase, override_settings,
)
from django.utils.translation import override
from django.views.csrf import CSRF_FAILURE_TEMPLATE_NAME, csrf_failure
@override_settings(ROOT_URLCONF="view_tests.urls")
class Csrf... | {
"repo_name": "ABaldwinHunter/django-clone",
"path": "tests/view_tests/tests/test_csrf.py",
"copies": "23",
"size": "4044",
"license": "bsd-3-clause",
"hash": -8083424369741241000,
"line_mean": 38.6470588235,
"line_max": 88,
"alpha_frac": 0.5798714144,
"autogenerated": false,
"ratio": 4.757647058... |
from django.template import TemplateDoesNotExist, TemplateSyntaxError, loader
from django.test import TestCase
from poradnia.template_mail.utils import TemplateKey, TemplateMailManager
class TemplateMailManagerTestCase(TestCase):
def assertEmpty(self, obj):
obj = list(obj)
self.assertEqual(len(ob... | {
"repo_name": "watchdogpolska/poradnia.siecobywatelska.pl",
"path": "poradnia/template_mail/tests.py",
"copies": "3",
"size": "1179",
"license": "bsd-3-clause",
"hash": 7445961679920850000,
"line_mean": 38.3,
"line_max": 88,
"alpha_frac": 0.6649703138,
"autogenerated": false,
"ratio": 4.180851063... |
from django.template import TemplateDoesNotExist, TemplateSyntaxError
from django.template.loader import get_template
from django.template.loader_tags import BaseIncludeNode
from django import template
register = template.Library()
class ConditionalIncludeTypeletNode(BaseIncludeNode):
def __init__(self, post_type,... | {
"repo_name": "luminousflux/django-luminous-tumblelog",
"path": "tumblelog/templatetags/bookmarklet_tags.py",
"copies": "1",
"size": "2738",
"license": "mit",
"hash": 8081490138652093000,
"line_mean": 42.4603174603,
"line_max": 137,
"alpha_frac": 0.6205259313,
"autogenerated": false,
"ratio": 4.3... |
from django.template import Template
from django_statsd.clients import statsd
from django.conf import settings
SAMPLE_RATE = getattr(settings, 'STATSD_TEMPLATE_SAMPLE_RATE', 1)
def key_for_template_name(name):
if not name or not name.endswith('.html'):
return None
return name.replace('/', '.')[:-5]
... | {
"repo_name": "streeter/django-statsd-patches",
"path": "django_statsd_patches/patches/template.py",
"copies": "1",
"size": "1411",
"license": "mit",
"hash": -2304165619778597000,
"line_mean": 27.22,
"line_max": 77,
"alpha_frac": 0.6456413891,
"autogenerated": false,
"ratio": 3.63659793814433,
... |
from django.template import Template
from django.template import Context
from django.conf import settings
import os
import json
import itertools
from collections import namedtuple
import time
import math
from functools import partial
settings.configure() #ignoring django bullshit
variables = json.load(open("variable... | {
"repo_name": "Tulane/FHI-AIMS-input-generator",
"path": "generator.py",
"copies": "1",
"size": "3071",
"license": "mit",
"hash": 2852458769518657000,
"line_mean": 26.6756756757,
"line_max": 89,
"alpha_frac": 0.6971670466,
"autogenerated": false,
"ratio": 3.0526838966202785,
"config_test": fals... |
from django.template import Template
from django.template import Library, Variable, Node
from jsrequirements.settings import VARNAME
register = Library()
@register.tag
def jsrequire(parser, token):
"""Add js requirements, except if they were alredy added."""
nodelist = parser.parse(('endjsrequire',))
parse... | {
"repo_name": "platypus-creation/jsrequirements",
"path": "jsrequirements/templatetags/jsrequire.py",
"copies": "1",
"size": "1065",
"license": "mit",
"hash": -6389134639679997000,
"line_mean": 30.3235294118,
"line_max": 75,
"alpha_frac": 0.6985915493,
"autogenerated": false,
"ratio": 4.26,
"co... |
from django.template import Template
from django.template.loader import get_template
from django.template import Context
from django.conf import settings
from django.db.models import Sum, Count, Q
from datetime import datetime, date
PROJECT_ROOT = settings.PROJECT_ROOT
CYCLE_START = date(2013,1,1)
# really about ... | {
"repo_name": "sunlightlabs/read_FEC",
"path": "fecreader/summary_data/management/commands/audit_results.py",
"copies": "1",
"size": "5723",
"license": "bsd-3-clause",
"hash": -9117515446897225000,
"line_mean": 38.7430555556,
"line_max": 175,
"alpha_frac": 0.5989865455,
"autogenerated": false,
"r... |
from django.template import Template
from django.template.loader import render_to_string
from django.utils.html import conditional_escape
from crispy_forms.compatibility import string_types, text_type
from crispy_forms.utils import render_field, flatatt, TEMPLATE_PACK, get_template_pack
class LayoutObject(object):
... | {
"repo_name": "damienjones/django-crispy-forms",
"path": "crispy_forms/layout.py",
"copies": "1",
"size": "15569",
"license": "mit",
"hash": 2552983457639820000,
"line_mean": 33.4446902655,
"line_max": 110,
"alpha_frac": 0.5929089858,
"autogenerated": false,
"ratio": 3.9395242914979756,
"config... |
from django.template import Template
from django.template.loader import render_to_string
from django.utils.html import conditional_escape
from crispy_forms.utils import TEMPLATE_PACK, flatatt, get_template_pack, render_field
class TemplateNameMixin:
def get_template_name(self, template_pack):
if "%s" in ... | {
"repo_name": "maraujop/django-crispy-forms",
"path": "crispy_forms/layout.py",
"copies": "2",
"size": "16191",
"license": "mit",
"hash": -679187288172326900,
"line_mean": 31.9755600815,
"line_max": 118,
"alpha_frac": 0.5915632141,
"autogenerated": false,
"ratio": 3.95964783565664,
"config_test... |
from django.template import Template, RequestContext
from django.forms.models import modelform_factory
from django.contrib import messages
from django.contrib import admin
from django.contrib.admin.utils import flatten_fieldsets
from django.contrib.admin.views.main import IS_POPUP_VAR
from django.conf.urls import patte... | {
"repo_name": "pbs/django-hubbubs",
"path": "hubbubs/admin.py",
"copies": "1",
"size": "6322",
"license": "mit",
"hash": -7575587065147497000,
"line_mean": 37.5487804878,
"line_max": 74,
"alpha_frac": 0.5881050301,
"autogenerated": false,
"ratio": 4.2601078167115904,
"config_test": false,
"ha... |
from django.template import Template, RequestContext, TemplateSyntaxError
from django.test import TestCase
from django.utils.translation import activate, get_language
class TestBidiutilsFilter(TestCase):
"""add_direction filter tests"""
def setUp(self):
# keep orig language
self.orig_language... | {
"repo_name": "MeirKriheli/django-bidi-utils",
"path": "tests/test_filter.py",
"copies": "1",
"size": "2465",
"license": "mit",
"hash": -4390484020571205600,
"line_mean": 31.012987013,
"line_max": 76,
"alpha_frac": 0.5598377282,
"autogenerated": false,
"ratio": 3.963022508038585,
"config_test":... |
from django.template import TemplateSyntaxError
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.utils.encoding import smart_unicode
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
fr... | {
"repo_name": "Mercy-Nekesa/sokoapp",
"path": "sokoapp/gallery/parser.py",
"copies": "1",
"size": "1836",
"license": "mit",
"hash": 2491215919643029500,
"line_mean": 31.8035714286,
"line_max": 109,
"alpha_frac": 0.6677559913,
"autogenerated": false,
"ratio": 4.522167487684729,
"config_test": fa... |
from django.template import TemplateSyntaxError
from django import template
from django.template import Variable
from zorna.acl.models import get_acl_for_model
from zorna.forms.models import FormsForm, FormsFormEntry
from zorna.forms.api import forms_get_entries, isUserManager, forms_get_entry
register = template.Li... | {
"repo_name": "zorna/zorna",
"path": "zorna/forms/templatetags/forms_tags.py",
"copies": "1",
"size": "9168",
"license": "bsd-3-clause",
"hash": -3707930313331505700,
"line_mean": 31.3957597173,
"line_max": 136,
"alpha_frac": 0.5342495637,
"autogenerated": false,
"ratio": 3.815230961298377,
"co... |
from django.template import TemplateSyntaxError
from django import template
from django.utils import simplejson
from tagging.models import Tag
from zorna.fileman.api import recent_files, get_allowed_shared_folders
from zorna.fileman.models import ZornaFile
from zorna.fileman.api import get_folder_files, recent_files_... | {
"repo_name": "zorna/zorna",
"path": "zorna/fileman/templatetags/fileman_tags.py",
"copies": "1",
"size": "5455",
"license": "bsd-3-clause",
"hash": 2614301179503366700,
"line_mean": 30.7151162791,
"line_max": 108,
"alpha_frac": 0.6216315307,
"autogenerated": false,
"ratio": 3.3777089783281733,
... |
from django.template import TemplateSyntaxError
from django.template.base import Token
import re
__all__ = (
'parse_as_var', 'parse_token_kwargs'
)
kwarg_re = re.compile('^(?P<name>\w+)=')
def parse_as_var(parser, token):
"""
Parse the remainder of the token, to find a "as varname" statement.
:par... | {
"repo_name": "dongguangming/django-tag-parser",
"path": "tag_parser/parser.py",
"copies": "1",
"size": "3076",
"license": "apache-2.0",
"hash": 8323923912998518000,
"line_mean": 35.619047619,
"line_max": 157,
"alpha_frac": 0.6391417425,
"autogenerated": false,
"ratio": 3.90851334180432,
"confi... |
from django.template import TemplateSyntaxError
from django.template.defaulttags import IfEqualNode
from django.test import SimpleTestCase
from ..utils import setup
class IfEqualTagTests(SimpleTestCase):
@setup({'ifequal01': '{% ifequal a b %}yes{% endifequal %}'})
def test_ifequal01(self):
output =... | {
"repo_name": "georgemarshall/django",
"path": "tests/template_tests/syntax_tests/test_if_equal.py",
"copies": "52",
"size": "10463",
"license": "bsd-3-clause",
"hash": 4846870438633251000,
"line_mean": 44.4913043478,
"line_max": 98,
"alpha_frac": 0.6077606805,
"autogenerated": false,
"ratio": 3.... |
from django.template import TemplateSyntaxError
from django.template.loader import get_template
from django.test import SimpleTestCase
from .utils import TemplateTestMixin, template_dirs
@template_dirs('inheritance')
class TestInheritance(TemplateTestMixin, SimpleTestCase):
def test_block_overlap(self):
... | {
"repo_name": "funkybob/django-sniplates",
"path": "tests/test_inherited.py",
"copies": "3",
"size": "1640",
"license": "mit",
"hash": 3938723894842975700,
"line_mean": 31.1568627451,
"line_max": 79,
"alpha_frac": 0.643902439,
"autogenerated": false,
"ratio": 4.194373401534527,
"config_test": t... |
from django.template import TemplateSyntaxError
from django.template.loader import render_to_string
from ttag import core, args
class TemplateTagOptions(core.Options):
def __init__(self, meta, *args, **kwargs):
super(TemplateTagOptions, self).__init__(meta=meta, *args, **kwargs)
self.template_na... | {
"repo_name": "matuu/django-ttag",
"path": "ttag/helpers/template_tag.py",
"copies": "2",
"size": "1969",
"license": "bsd-3-clause",
"hash": 7928556604644591000,
"line_mean": 32.9482758621,
"line_max": 78,
"alpha_frac": 0.6231589639,
"autogenerated": false,
"ratio": 4.207264957264957,
"config_t... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango110Warning
from ..utils import setup
class CycleTagTests(SimpleTestCase):
libraries = {'future': 'django.templatetags.future'}
@setup({'cycle01': '{% cy... | {
"repo_name": "BrotherPhil/django",
"path": "tests/template_tests/syntax_tests/test_cycle.py",
"copies": "199",
"size": "7384",
"license": "bsd-3-clause",
"hash": 4183979253225532000,
"line_mean": 43.4819277108,
"line_max": 108,
"alpha_frac": 0.5784127844,
"autogenerated": false,
"ratio": 3.56714... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango20Warning
from ..utils import setup
class CycleTagTests(SimpleTestCase):
@setup({'cycle01': '{% cycle a %}'})
def test_cycle01(self):
with self.... | {
"repo_name": "abhattad4/Digi-Menu",
"path": "tests/template_tests/syntax_tests/test_cycle.py",
"copies": "20",
"size": "6981",
"license": "bsd-3-clause",
"hash": -3781445498896643000,
"line_mean": 42.9056603774,
"line_max": 108,
"alpha_frac": 0.5652485317,
"autogenerated": false,
"ratio": 3.5293... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.safestring import mark_safe
from ..utils import SafeClass, UnsafeClass, setup
class AutoescapeTagTests(SimpleTestCase):
@setup({... | {
"repo_name": "theo-l/django",
"path": "tests/template_tests/syntax_tests/test_autoescape.py",
"copies": "10",
"size": "6443",
"license": "bsd-3-clause",
"hash": 7594163659904242000,
"line_mean": 45.3525179856,
"line_max": 110,
"alpha_frac": 0.6247089865,
"autogenerated": false,
"ratio": 3.909587... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from django.utils import translation
from ...utils import setup
class I18nGetLanguageInfoTagTests(SimpleTestCase):
libraries = {
'custom': 'template_tests.templatetags.custom',
'i18n': 'django.templatetags.i18n... | {
"repo_name": "freakboy3742/django",
"path": "tests/template_tests/syntax_tests/i18n/test_get_language_info.py",
"copies": "78",
"size": "1896",
"license": "bsd-3-clause",
"hash": 7466713544128542000,
"line_mean": 43.0697674419,
"line_max": 91,
"alpha_frac": 0.5709762533,
"autogenerated": false,
... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class CycleTagTests(SimpleTestCase):
@setup({'cycle01': '{% cycle a %}'})
def test_cycle01(self):
with self.assertRaises(TemplateSyntaxError):
self.engine.get_template('cycle0... | {
"repo_name": "vincepandolfo/django",
"path": "tests/template_tests/syntax_tests/test_cycle.py",
"copies": "104",
"size": "5516",
"license": "bsd-3-clause",
"hash": 7742063754988156000,
"line_mean": 41.7596899225,
"line_max": 106,
"alpha_frac": 0.5534807832,
"autogenerated": false,
"ratio": 3.486... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class ForTagTests(SimpleTestCase):
libraries = {'custom': 'template_tests.templatetags.custom'}
@setup({'for-tag01': '{% for val in values %}{{ val }}{% endfor %}'})
def test_for_tag01(self):... | {
"repo_name": "cloudera/hue",
"path": "desktop/core/ext-py/Django-1.11.29/tests/template_tests/syntax_tests/test_for.py",
"copies": "21",
"size": "9359",
"license": "apache-2.0",
"hash": 2671894820742106600,
"line_mean": 50.4230769231,
"line_max": 108,
"alpha_frac": 0.5654450262,
"autogenerated": f... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class WithTagTests(SimpleTestCase):
@setup({'with01': '{% with key=dict.key %}{{ key }}{% endwith %}'})
def test_with01(self):
output = self.engine.render_to_string('with01', {'dict': {'k... | {
"repo_name": "crazy-canux/django",
"path": "tests/template_tests/syntax_tests/test_with.py",
"copies": "391",
"size": "2245",
"license": "bsd-3-clause",
"hash": -2890134277189953500,
"line_mean": 42.1730769231,
"line_max": 84,
"alpha_frac": 0.5545657016,
"autogenerated": false,
"ratio": 3.779461... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup, TestObj
class IfTagTests(SimpleTestCase):
@setup({'if-tag01': '{% if foo %}yes{% else %}no{% endif %}'})
def test_if_tag01(self):
output = self.engine.render_to_string('if-tag01', {'foo'... | {
"repo_name": "jyotikamboj/container",
"path": "dj-tests/template_tests/syntax_tests/test_if.py",
"copies": "4",
"size": "23448",
"license": "mit",
"hash": -2736409027225295400,
"line_mean": 43.8336520076,
"line_max": 105,
"alpha_frac": 0.5744626407,
"autogenerated": false,
"ratio": 3.18977009930... |
from django.template import TemplateSyntaxError
__all__ = ['ArgumentRequiredError', 'InvalidFlag', 'BreakpointExpected',
'TooManyArguments']
class BaseError(TemplateSyntaxError):
template = ''
def __str__(self): # pragma: no cover
return self.template % self.__dict__
class ArgumentRequ... | {
"repo_name": "macs03/demo-cms",
"path": "cms/lib/python2.7/site-packages/classytags/exceptions.py",
"copies": "14",
"size": "1963",
"license": "mit",
"hash": 6714427772264197000,
"line_mean": 30.1587301587,
"line_max": 110,
"alpha_frac": 0.6408558329,
"autogenerated": false,
"ratio": 4.098121085... |
from django.template import TemplateSyntaxError
__all__ = ['BaseError', 'TagNameError', 'ArgumentRequiredError', 'InvalidArgument',
'InvalidFlag', 'BreakpointExpected', 'TooManyArguments', 'TooFewArguments',
'KeywordInUse', 'FormatError', 'UnexpectedElement']
class BaseError(TemplateSyntax... | {
"repo_name": "rkumar-cognam/django-customtags-lib",
"path": "customtags/exceptions.py",
"copies": "1",
"size": "3737",
"license": "bsd-3-clause",
"hash": 4940600530189326000,
"line_mean": 30.1416666667,
"line_max": 125,
"alpha_frac": 0.6106502542,
"autogenerated": false,
"ratio": 4.0356371490280... |
from django.template import TemplateSyntaxError
from sentry_sdk._types import MYPY
if MYPY:
from typing import Any
from typing import Dict
from typing import Optional
from typing import Iterator
from typing import Tuple
try:
# support Django 1.9
from django.template.base import Origin
exc... | {
"repo_name": "liszd/whyliam.workflows.youdao",
"path": "sentry_sdk/integrations/django/templates.py",
"copies": "4",
"size": "3398",
"license": "mit",
"hash": -6686347748678108000,
"line_mean": 27.0826446281,
"line_max": 87,
"alpha_frac": 0.611241907,
"autogenerated": false,
"ratio": 3.901262916... |
from django.template import TemplateSyntaxError
__all__ = ['ArgumentRequiredError', 'InvalidFlag', 'BreakpointExpected',
'TooManyArguments']
class BaseError(TemplateSyntaxError):
template = ''
def __str__(self): # pragma: no cover
return self.template % self.__dict__
class ArgumentReq... | {
"repo_name": "ojii/django-classy-tags",
"path": "classytags/exceptions.py",
"copies": "1",
"size": "1989",
"license": "bsd-3-clause",
"hash": 5718911716154038000,
"line_mean": 28.6865671642,
"line_max": 79,
"alpha_frac": 0.6324786325,
"autogenerated": false,
"ratio": 4.092592592592593,
"config... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class CycleTagTests(SimpleTestCase):
@setup({'cycle01': '{% cycle a %}'})
def test_cycle01(self):
with self.assertRaises(TemplateSyntaxError):
self.engine.get_templ... | {
"repo_name": "yephper/django",
"path": "tests/template_tests/syntax_tests/test_cycle.py",
"copies": "1",
"size": "5645",
"license": "bsd-3-clause",
"hash": 8619393994605344000,
"line_mean": 41.7596899225,
"line_max": 106,
"alpha_frac": 0.5408325952,
"autogenerated": false,
"ratio": 3.55702583490... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class ForTagTests(SimpleTestCase):
libraries = {'custom': 'template_tests.templatetags.custom'}
@setup({'for-tag01': '{% for val in values %}{{ val }}{% endfor %}'})
def test_for_ta... | {
"repo_name": "yephper/django",
"path": "tests/template_tests/syntax_tests/test_for.py",
"copies": "1",
"size": "7968",
"license": "bsd-3-clause",
"hash": 3626296452276298000,
"line_mean": 49.0769230769,
"line_max": 108,
"alpha_frac": 0.547063253,
"autogenerated": false,
"ratio": 3.47643979057591... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class LoadTagTests(SimpleTestCase):
libraries = {
'subpackage.echo': 'template_tests.templatetags.subpackage.echo',
'testtags': 'template_tests.templatetags.testtags',
}
... | {
"repo_name": "yephper/django",
"path": "tests/template_tests/syntax_tests/test_load.py",
"copies": "1",
"size": "3453",
"license": "bsd-3-clause",
"hash": 4508006405221859300,
"line_mean": 44.04,
"line_max": 112,
"alpha_frac": 0.6240949899,
"autogenerated": false,
"ratio": 4.057579318448884,
"... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class TemplateTagTests(SimpleTestCase):
@setup({'templatetag01': '{% templatetag openblock %}'})
def test_templatetag01(self):
output = self.engine.render_to_string('templatetag... | {
"repo_name": "yephper/django",
"path": "tests/template_tests/syntax_tests/test_template_tag.py",
"copies": "1",
"size": "2661",
"license": "bsd-3-clause",
"hash": -844481282119108500,
"line_mean": 37.7164179104,
"line_max": 89,
"alpha_frac": 0.6399849681,
"autogenerated": false,
"ratio": 4.21711... |
from django.template import TemplateSyntaxError, TemplateDoesNotExist
from django.template import Library, Node, TextNode, resolve_variable
from django.template.loader import select_template
from django.template.loader_tags import ExtendsNode
register = Library()
EXTENDED_TEMPLATE_PATTERN = '%s/%s'
class XExtendsNo... | {
"repo_name": "ella/mypage",
"path": "mypage/pages/templatetags/xextends.py",
"copies": "1",
"size": "2985",
"license": "bsd-3-clause",
"hash": -691158207750872200,
"line_mean": 42.2608695652,
"line_max": 106,
"alpha_frac": 0.6626465662,
"autogenerated": false,
"ratio": 3.9173228346456694,
"con... |
from django.template import TemplateSyntaxError, TemplateDoesNotExist, resolve_variable
from django.template import Library, Node
from django.template.loader import get_template, get_template_from_string, find_template_source
from django.conf import settings
register = Library()
class ExtendsError(Exception):
pas... | {
"repo_name": "pigeonflight/strider-plone",
"path": "docker/appengine/lib/django-0.96/django/template/loader_tags.py",
"copies": "33",
"size": "7010",
"license": "mit",
"hash": 7922878499702152000,
"line_mean": 38.604519774,
"line_max": 113,
"alpha_frac": 0.6249643367,
"autogenerated": false,
"ra... |
from django.template import TemplateSyntaxError, TemplateDoesNotExist, Variable
from django.template import Library, Node, TextNode
from django.template.loader import get_template, get_template_from_string, find_template_source
from django.conf import settings
from django.utils.safestring import mark_safe
register = L... | {
"repo_name": "Shrews/PyGerrit",
"path": "webapp/django/template/loader_tags.py",
"copies": "28",
"size": "7659",
"license": "apache-2.0",
"hash": -6491284784644490000,
"line_mean": 38.890625,
"line_max": 113,
"alpha_frac": 0.6158767463,
"autogenerated": false,
"ratio": 4.148970747562297,
"conf... |
from django.template import TemplateSyntaxError, TemplateDoesNotExist, Variable
from django.template import Library, Node, TextNode
from django.template.loader import get_template
from django.conf import settings
from django.utils.safestring import mark_safe
register = Library()
BLOCK_CONTEXT_KEY = 'block_context'
c... | {
"repo_name": "bratsche/Neutron-Drive",
"path": "google_appengine/lib/django_1_2/django/template/loader_tags.py",
"copies": "44",
"size": "8017",
"license": "bsd-3-clause",
"hash": 2912346833298192000,
"line_mean": 35.7752293578,
"line_max": 113,
"alpha_frac": 0.6136958962,
"autogenerated": false,
... |
from django.template import TemplateSyntaxError, TemplateDoesNotExist, Variable
from django.template import Library, Node, TextNode
from django.template.loader import get_template, get_template_from_string, find_template_source
from django.conf import settings
from django.utils.safestring import mark_safe
regist... | {
"repo_name": "greggian/TapdIn",
"path": "django/template/loader_tags.py",
"copies": "1",
"size": "7851",
"license": "apache-2.0",
"hash": 2410872221958317600,
"line_mean": 38.890625,
"line_max": 113,
"alpha_frac": 0.6008151828,
"autogenerated": false,
"ratio": 4.236913113869401,
"config_test":... |
from django.template import TemplateSyntaxError, TemplateDoesNotExist, Variable
from django.template import Library, Node, TextNode
from django.template.loader import get_template
from django.conf import settings
from django.utils.safestring import mark_safe
register = Library()
BLOCK_CONTEXT_KEY = 'block_con... | {
"repo_name": "shenlong3030/asv-django-guestbook",
"path": "django/template/loader_tags.py",
"copies": "9",
"size": "8346",
"license": "bsd-3-clause",
"hash": -6027087744296863000,
"line_mean": 35.9363636364,
"line_max": 113,
"alpha_frac": 0.5980110232,
"autogenerated": false,
"ratio": 4.17508754... |
from django.template import TemplateSyntaxError, Variable, Node, Variable, Library
from docman import settings
register = Library()
# https://code.djangoproject.com/browser/django/trunk/django/template/defaulttags.py
# <http://stackoverflow.com/questions/433162/#5235614>
@register.tag
def value_from_settings(parser, ... | {
"repo_name": "vLj2/docman",
"path": "app/templatetags/value_from_settings.py",
"copies": "1",
"size": "1309",
"license": "bsd-2-clause",
"hash": -7676696889362419000,
"line_mean": 29.4418604651,
"line_max": 84,
"alpha_frac": 0.6974789916,
"autogenerated": false,
"ratio": 3.1618357487922704,
"c... |
from django.template import Template, TemplateDoesNotExist
class Loader:
def __init__(self, engine):
self.engine = engine
def get_template(self, template_name, skip=None):
"""
Call self.get_template_sources() and return a Template object for
the first template matching templa... | {
"repo_name": "Beauhurst/django",
"path": "django/template/loaders/base.py",
"copies": "110",
"size": "1558",
"license": "bsd-3-clause",
"hash": -617287059706804700,
"line_mean": 30.7959183673,
"line_max": 79,
"alpha_frac": 0.5847240051,
"autogenerated": false,
"ratio": 5.176079734219269,
"conf... |
from django.template import Template, TemplateSyntaxError, Context
from rest_framework import serializers
from rest_framework import exceptions
from rdmo.core.serializers import TranslationSerializerMixin
from rdmo.core.utils import get_language_warning
from ..models import View
from ..validators import ViewUniqueKe... | {
"repo_name": "DMPwerkzeug/DMPwerkzeug",
"path": "rdmo/views/serializers/__init__.py",
"copies": "1",
"size": "1559",
"license": "apache-2.0",
"hash": 4261409964375427000,
"line_mean": 24.9833333333,
"line_max": 78,
"alpha_frac": 0.6029506094,
"autogenerated": false,
"ratio": 4.767584097859327,
... |
from django.template import Variable, Library, Node, TemplateSyntaxError, TemplateDoesNotExist
from django.template.loader import render_to_string
class DisplayActionLabel(Node):
def __init__(self, actor, varname=None):
self.actor = Variable(actor)
self.varname = varname
def render(sel... | {
"repo_name": "praekelt/django-activity-stream",
"path": "actstream/templatetags/activity_tags.py",
"copies": "2",
"size": "5588",
"license": "bsd-3-clause",
"hash": -5978217455128424000,
"line_mean": 40.4,
"line_max": 186,
"alpha_frac": 0.603614889,
"autogenerated": false,
"ratio": 4.07883211678... |
from django.template import Variable, Library, Node, TemplateSyntaxError, TemplateDoesNotExist
from django.template.loader import render_to_string
class DisplayAggregatedAction(Node):
def __init__(self, aggr_action, varname=None):
self.aggr_action = Variable(aggr_action)
self.varname = varname
... | {
"repo_name": "MeirKriheli/Open-Knesset",
"path": "user/templatetags/aggregated_activity_tags.py",
"copies": "15",
"size": "1662",
"license": "bsd-3-clause",
"hash": 3395232991392153000,
"line_mean": 47.9117647059,
"line_max": 197,
"alpha_frac": 0.6606498195,
"autogenerated": false,
"ratio": 3.86... |
from django.template.library import Library
from django.urls import reverse
from django.utils.html import format_html, mark_safe
from django.utils.translation import ugettext as _
register = Library()
@register.simple_tag()
def newsitem_status(newsitem, link=True):
buttons = []
output = []
if newsitem.li... | {
"repo_name": "takeflight/wagtailnews",
"path": "wagtailnews/templatetags/wagtailnews_admin_tags.py",
"copies": "1",
"size": "1336",
"license": "bsd-2-clause",
"hash": -6120085564586507000,
"line_mean": 30.8095238095,
"line_max": 76,
"alpha_frac": 0.5359281437,
"autogenerated": false,
"ratio": 4.... |
from django.template.loader import BaseLoader
from django.template import TemplateDoesNotExist
from django.core import urlresolvers
from django.conf import settings
import jinja2
import settings
class Template(jinja2.Template):
def render(self, context):
# flatten the Django Context into ... | {
"repo_name": "masiqi/douquan",
"path": "libs/jinja2_loader.py",
"copies": "1",
"size": "1183",
"license": "mit",
"hash": -8430556876251129000,
"line_mean": 35.96875,
"line_max": 86,
"alpha_frac": 0.6694843618,
"autogenerated": false,
"ratio": 4.286231884057971,
"config_test": false,
"has_no_... |
from django.template.loader import BaseLoader
from django.template import TemplateDoesNotExist
import utils
from django.conf import settings
def import_class_from_str(str_module):
"""
Use this to import a class from a string. For example:
'django.template.loaders.filesystem.Loader' is converted to:
fro... | {
"repo_name": "slok/django-chameleon",
"path": "chameleon/loader.py",
"copies": "1",
"size": "4079",
"license": "bsd-3-clause",
"hash": -6256779350959003000,
"line_mean": 39.3861386139,
"line_max": 136,
"alpha_frac": 0.6013728855,
"autogenerated": false,
"ratio": 4.557541899441341,
"config_test... |
from django.template.loader import _engine_list, TemplateDoesNotExist
from django.utils import six
def get_template(template_name, using=None, app_label=None, model_name=None):
"""
Loads and returns a template for the given name.
Raises TemplateDoesNotExist if no such template exists.
Hard override a... | {
"repo_name": "jdzero/foundation",
"path": "foundation/template/loader.py",
"copies": "2",
"size": "1924",
"license": "mit",
"hash": 2223501058153283800,
"line_mean": 34.6296296296,
"line_max": 78,
"alpha_frac": 0.6330561331,
"autogenerated": false,
"ratio": 4.537735849056604,
"config_test": fa... |
from django.template.loader import get_template_from_string
from django.template import VariableNode
from django.utils.unittest import TestCase
class NodelistTest(TestCase):
def test_for(self):
source = '{% for i in 1 %}{{ a }}{% endfor %}'
template = get_template_from_string(source)
vars... | {
"repo_name": "sriprasanna/django-1.3.1",
"path": "tests/regressiontests/templates/nodelist.py",
"copies": "54",
"size": "1134",
"license": "bsd-3-clause",
"hash": 8355890816024542000,
"line_mean": 36.8,
"line_max": 64,
"alpha_frac": 0.6349206349,
"autogenerated": false,
"ratio": 3.83108108108108... |
from django.template.loader import get_template
from django.core.mail import EmailMultiAlternatives, BadHeaderError
from .. import settings
class EmailService(object):
def send_forgot_password_email(self, user, pass_recover_code):
# send the email for the new password request
subject = 'New passwo... | {
"repo_name": "danrg/RGT-tool",
"path": "src/RGT/authentication/EmailService.py",
"copies": "1",
"size": "1967",
"license": "mit",
"hash": -7109528526705594000,
"line_mean": 36.1132075472,
"line_max": 85,
"alpha_frac": 0.6553126589,
"autogenerated": false,
"ratio": 3.9817813765182186,
"config_t... |
from django.template.loader import get_template
from django.http import HttpResponse, HttpResponseForbidden
from Forms import SubmitCodeForm
from django.template import Context
from django.core.context_processors import csrf
from djangoSRV.student import get_exercise, getStudentAssignments
from utils import get_header_... | {
"repo_name": "varun-verma11/CodeDrill",
"path": "djangoSRV/Views/single_exercise_code_view.py",
"copies": "1",
"size": "1205",
"license": "bsd-2-clause",
"hash": 1624822719755204900,
"line_mean": 45.3846153846,
"line_max": 115,
"alpha_frac": 0.7145228216,
"autogenerated": false,
"ratio": 3.52339... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.