text stringlengths 0 1.05M | meta dict |
|---|---|
from django import http
from blog_base.models import Category
from blog_base import blogs
def get_configuration_or_404(configuration_key):
"""Return configuration instance for `configuration_key`."""
try:
return blogs.get_configuration(configuration_key)
except blogs.BlogConfigurationNotRegistered... | {
"repo_name": "strange/django-blog-base",
"path": "blog_base/views.py",
"copies": "1",
"size": "2044",
"license": "bsd-3-clause",
"hash": -1095584992475285600,
"line_mean": 46.5348837209,
"line_max": 79,
"alpha_frac": 0.7397260274,
"autogenerated": false,
"ratio": 4.096192384769539,
"config_tes... |
from django import http
from django_extra_tools.conf import settings
class XhrMiddleware(object):
"""
This middleware allows cross-domain XHR using the html5 postMessage API.
Access-Control-Allow-Origin: http://foo.example
Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE
"""
de... | {
"repo_name": "tomi77/python-t77-django",
"path": "django_extra_tools/middleware.py",
"copies": "1",
"size": "1753",
"license": "mit",
"hash": -6312772253135142000,
"line_mean": 38.8409090909,
"line_max": 76,
"alpha_frac": 0.6383342841,
"autogenerated": false,
"ratio": 4.286063569682152,
"confi... |
from django import http
from taggit_forms.forms import TagForm
from taggit_forms.utils import create_tag_for_object
from taggit_forms.conf import settings
def tag_create_view(request, *args, **kwargs):
if request.method not in settings.ALLOWED_METHODS:
return http.HttpResponseNotAllowed(settings.ALLOWED_... | {
"repo_name": "akiraakaishi/django-taggit-forms",
"path": "taggit_forms/views.py",
"copies": "1",
"size": "1084",
"license": "mit",
"hash": 7374635061755453000,
"line_mean": 28.2972972973,
"line_max": 68,
"alpha_frac": 0.6595940959,
"autogenerated": false,
"ratio": 3.7902097902097904,
"config_t... |
from django import http
from tower import ugettext as _
from olympia.amo.helpers import absolutify, page_name
from olympia.amo.urlresolvers import reverse
from olympia.amo.feeds import NonAtomicFeed
from olympia.access import acl
from olympia.addons.models import Addon
from olympia.browse.feeds import AddonFeedMixin
... | {
"repo_name": "jpetto/olympia",
"path": "src/olympia/bandwagon/feeds.py",
"copies": "1",
"size": "2312",
"license": "bsd-3-clause",
"hash": -6852658900833119000,
"line_mean": 27.5432098765,
"line_max": 77,
"alpha_frac": 0.6440311419,
"autogenerated": false,
"ratio": 3.6582278481012658,
"config_... |
from django import http
from tower import ugettext_lazy as _lazy
from addons.views import BaseFilter
import amo
from amo.models import manual_order
from amo.utils import paginate
from mkt.constants import apps
from mkt.webapps.models import Webapp
from stats.models import Contribution
from translations.query import o... | {
"repo_name": "wagnerand/zamboni",
"path": "mkt/account/utils.py",
"copies": "5",
"size": "2839",
"license": "bsd-3-clause",
"hash": -7380712648740049000,
"line_mean": 36.8533333333,
"line_max": 77,
"alpha_frac": 0.5822472702,
"autogenerated": false,
"ratio": 3.8997252747252746,
"config_test": ... |
from django import http
from tower import ugettext_lazy as _lazy
import amo
from amo.models import manual_order
from amo.utils import paginate
from mkt.constants import apps
from mkt.purchase.models import Contribution
from mkt.translations.query import order_by_translation
from mkt.webapps.models import Webapp
from ... | {
"repo_name": "andymckay/zamboni",
"path": "mkt/account/utils.py",
"copies": "1",
"size": "2855",
"license": "bsd-3-clause",
"hash": -6747194476332032000,
"line_mean": 37.0666666667,
"line_max": 77,
"alpha_frac": 0.5835376532,
"autogenerated": false,
"ratio": 3.8843537414965987,
"config_test": ... |
from django import http
from unittest import mock
from urllib.parse import quote
from olympia.addons import decorators as dec
from olympia.addons.models import Addon
from olympia.amo.tests import TestCase, addon_factory
class TestAddonView(TestCase):
def setUp(self):
super(TestAddonView, self).setUp()
... | {
"repo_name": "wagnerand/addons-server",
"path": "src/olympia/addons/tests/test_decorators.py",
"copies": "3",
"size": "6678",
"license": "bsd-3-clause",
"hash": 7042620593321197000,
"line_mean": 35.4918032787,
"line_max": 88,
"alpha_frac": 0.6295297993,
"autogenerated": false,
"ratio": 3.4158567... |
from django import http
import amo
from amo.decorators import json_view, login_required
from addons.decorators import addon_view
from webapps.models import Webapp
from statsd import statsd
@login_required
@addon_view
@json_view
def verify_receipt(request, addon):
"""Returns the status for that addon."""
wit... | {
"repo_name": "jbalogh/zamboni",
"path": "apps/market/views.py",
"copies": "1",
"size": "1176",
"license": "bsd-3-clause",
"hash": -8995893721010014000,
"line_mean": 31.6666666667,
"line_max": 75,
"alpha_frac": 0.6760204082,
"autogenerated": false,
"ratio": 3.793548387096774,
"config_test": fal... |
from django import http
import commonware
import requests
from rest_framework.exceptions import ParseError
from rest_framework.generics import ListAPIView
from rest_framework.permissions import AllowAny, BasePermission
from rest_framework.response import Response
from rest_framework.views import APIView
import mkt
fr... | {
"repo_name": "mstriemer/zamboni",
"path": "mkt/stats/views.py",
"copies": "9",
"size": "13102",
"license": "bsd-3-clause",
"hash": 2864376717138780000,
"line_mean": 31.6733167082,
"line_max": 79,
"alpha_frac": 0.5662494276,
"autogenerated": false,
"ratio": 4.137038206504578,
"config_test": fal... |
from django import http
import commonware
import requests
from rest_framework.exceptions import ParseError
from rest_framework.generics import ListAPIView
from rest_framework.permissions import BasePermission
from rest_framework.response import Response
from rest_framework.views import APIView
import amo
from lib.met... | {
"repo_name": "ngokevin/zamboni",
"path": "mkt/stats/views.py",
"copies": "2",
"size": "13131",
"license": "bsd-3-clause",
"hash": -2135950406314036200,
"line_mean": 31.9924623116,
"line_max": 79,
"alpha_frac": 0.5665981266,
"autogenerated": false,
"ratio": 4.1409649952696315,
"config_test": fa... |
from django import http
import commonware
import requests
from rest_framework.exceptions import ParseError
from rest_framework.generics import ListAPIView
from rest_framework.response import Response
from rest_framework.views import APIView
from lib.metrics import get_monolith_client
import amo
from stats.models imp... | {
"repo_name": "robhudson/zamboni",
"path": "mkt/stats/api.py",
"copies": "2",
"size": "12724",
"license": "bsd-3-clause",
"hash": -1196479685028343000,
"line_mean": 31.9637305699,
"line_max": 79,
"alpha_frac": 0.5624803521,
"autogenerated": false,
"ratio": 4.1378861788617884,
"config_test": fal... |
from django import http
import mock
from nose.tools import eq_
import amo.tests
from addons import decorators as dec
from addons.models import Addon
class TestAddonView(amo.tests.TestCase):
def setUp(self):
super(TestAddonView, self).setUp()
self.addon = Addon.objects.create(slug='x', type=1)
... | {
"repo_name": "SuriyaaKudoIsc/olympia",
"path": "apps/addons/tests/test_decorators.py",
"copies": "1",
"size": "3259",
"license": "bsd-3-clause",
"hash": 6530100715784332000,
"line_mean": 35.6179775281,
"line_max": 78,
"alpha_frac": 0.6204357165,
"autogenerated": false,
"ratio": 3.214003944773175... |
from django import http
import mock
from olympia.amo.tests import TestCase
from olympia.addons import decorators as dec
from olympia.addons.models import Addon
class TestAddonView(TestCase):
def setUp(self):
super(TestAddonView, self).setUp()
self.addon = Addon.objects.create(slug='x', type=1)
... | {
"repo_name": "andymckay/olympia",
"path": "src/olympia/addons/tests/test_decorators.py",
"copies": "3",
"size": "5016",
"license": "bsd-3-clause",
"hash": -7450974657821945000,
"line_mean": 35.8823529412,
"line_max": 78,
"alpha_frac": 0.6216108453,
"autogenerated": false,
"ratio": 3.405295315682... |
from django import http
COORS_ALLOWED_ORIGINS = "*"
COORS_ALLOWED_METHODS = ["POST", "GET", "OPTIONS", "PUT", "DELETE", "PATCH", "HEAD"]
COORS_ALLOWED_HEADERS = ["content-type", "x-requested-with",
"authorization", "accept-encoding",
"x-disable-pagination", "x-host",
... | {
"repo_name": "Cinemair/cinemair-server",
"path": "cinemair/common/middleware/cors.py",
"copies": "1",
"size": "1528",
"license": "mit",
"hash": 8917629467452830000,
"line_mean": 41.4444444444,
"line_max": 89,
"alpha_frac": 0.6158376963,
"autogenerated": false,
"ratio": 3.9079283887468033,
"con... |
from django import http
COORS_ALLOWED_ORIGINS = '*'
COORS_ALLOWED_METHODS = ['POST', 'GET', 'OPTIONS', 'PUT', 'DELETE', 'PATCH', 'HEAD']
COORS_ALLOWED_HEADERS = [
'content-type', 'x-requested-with', 'authorization', 'accept-encoding',
'x-disable-pagination', 'x-host', 'x-session-id']
COORS_ALLOWED_CREDENTIALS... | {
"repo_name": "pinkevich/django-project-template",
"path": "project_name/core/middleware.py",
"copies": "5",
"size": "1391",
"license": "mit",
"hash": 898574614829455100,
"line_mean": 37.6388888889,
"line_max": 84,
"alpha_frac": 0.6599568656,
"autogenerated": false,
"ratio": 3.6605263157894736,
... |
from django import http
XS_SHARING_ALLOWED_ORIGINS = '*'
XS_SHARING_ALLOWED_METHODS = ['POST', 'GET', 'OPTIONS', 'PUT', 'DELETE']
XS_SHARING_ALLOWED_HEADERS = [
'X-Requested-With',
'Content-Type',
'Accept',
'Origin',
'Authorization',
'X-Csrftoken'
]
class XsSharing(object):
"""
This ... | {
"repo_name": "jangers/djanger_project",
"path": "project/middlewares/cors.py",
"copies": "1",
"size": "1216",
"license": "mit",
"hash": 7632108025133343000,
"line_mean": 30.1794871795,
"line_max": 91,
"alpha_frac": 0.6480263158,
"autogenerated": false,
"ratio": 3.8,
"config_test": false,
"ha... |
from django import http
try:
from django.conf import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS
XS_SHARING_ALLOWED_HEADERS = settings.XS_SHARING_ALLOWED_HEADERS
XS_SHARING_ALLOWED_CREDENTIALS = settings... | {
"repo_name": "eladelad/new-money",
"path": "expenses/middleware/crossdomainxhr.py",
"copies": "1",
"size": "1866",
"license": "apache-2.0",
"hash": -5421151261628284000,
"line_mean": 42.4186046512,
"line_max": 91,
"alpha_frac": 0.6945337621,
"autogenerated": false,
"ratio": 3.616279069767442,
... |
from django import http
try:
from django.conf import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS
except (ImportError, NameError):
XS_SHARING_ALLOWED_ORIGINS = '*'
XS_SHARING_ALLOWED_METHODS = ['POST','GE... | {
"repo_name": "monkut/deso",
"path": "deso/deso/middleware.py",
"copies": "1",
"size": "1368",
"license": "mit",
"hash": 2823934964971370000,
"line_mean": 35.0263157895,
"line_max": 94,
"alpha_frac": 0.6578947368,
"autogenerated": false,
"ratio": 3.9085714285714284,
"config_test": false,
"has... |
from django import http
try:
from django.conf import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS
except:
XS_SHARING_ALLOWED_ORIGINS = '*'
XS_SHARING_ALLOWED_METHODS = ['POST', 'GET', 'OPTIONS', 'PUT', 'DE... | {
"repo_name": "codefordurham/food-inspector",
"path": "eatsmart/middleware.py",
"copies": "2",
"size": "1317",
"license": "bsd-3-clause",
"hash": 6639492549147679000,
"line_mean": 32.7692307692,
"line_max": 91,
"alpha_frac": 0.6681852696,
"autogenerated": false,
"ratio": 3.873529411764706,
"con... |
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS
except:
XS_SHARING_ALLOWED_ORIGINS = '*'
XS_SHARING_ALLOWED_METHODS = ['POST','GET','OPTIONS', 'PUT', 'DELETE']
class ... | {
"repo_name": "fergalmoran/dss",
"path": "spa/middleware/cors.py",
"copies": "1",
"size": "1349",
"license": "bsd-2-clause",
"hash": -4759915278112164000,
"line_mean": 33.5897435897,
"line_max": 94,
"alpha_frac": 0.6493699036,
"autogenerated": false,
"ratio": 3.898843930635838,
"config_test": f... |
from django import http
try:
from django.apps import apps
get_model = apps.get_model
except ImportError:
from django.db.models import get_model
from django.shortcuts import render
from django.template import RequestContext
from django.utils.safestring import mark_safe
from django.core.paginator import Pagi... | {
"repo_name": "Alir3z4/django-databrowse",
"path": "django_databrowse/sites.py",
"copies": "1",
"size": "6884",
"license": "bsd-3-clause",
"hash": -261687770984788640,
"line_mean": 32.5804878049,
"line_max": 79,
"alpha_frac": 0.5873038931,
"autogenerated": false,
"ratio": 4.231100184388445,
"co... |
from django import http
from django.template import Context, Engine, TemplateDoesNotExist, loader
from django.utils import six
from django.utils.encoding import force_text
from django.views.decorators.csrf import requires_csrf_token
# This can be called when CsrfViewMiddleware.process_view has not run,
# therefore ne... | {
"repo_name": "letouriste001/SmartForest_2.0",
"path": "python3.4Smartforest/lib/python3.4/site-packages/django/views/defaults.py",
"copies": "1",
"size": "3567",
"license": "mit",
"hash": -8996872026364060000,
"line_mean": 33.9705882353,
"line_max": 100,
"alpha_frac": 0.6773198766,
"autogenerated"... |
from django import http
from django.conf import settings
from django.utils import importlib
from django.utils.translation import check_for_language, activate, to_locale, get_language
from django.utils.text import javascript_quote
import os
import gettext as gettext_module
def set_language(request):
"""
... | {
"repo_name": "greggian/TapdIn",
"path": "django/views/i18n.py",
"copies": "1",
"size": "6815",
"license": "apache-2.0",
"hash": -7880745973764320000,
"line_mean": 33.1288659794,
"line_max": 124,
"alpha_frac": 0.5911958914,
"autogenerated": false,
"ratio": 3.820067264573991,
"config_test": fals... |
from django import http
from django.conf import settings
from utils import next_redirect, confirmation_view
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.loader imp... | {
"repo_name": "greggian/TapdIn",
"path": "django/contrib/comments/views/comments.py",
"copies": "1",
"size": "4719",
"license": "apache-2.0",
"hash": -7102346900838043000,
"line_mean": 35.752,
"line_max": 92,
"alpha_frac": 0.6264038991,
"autogenerated": false,
"ratio": 4.361367837338262,
"confi... |
from django import http
from django.conf import settings
from utils import next_redirect, confirmation_view
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.te... | {
"repo_name": "egenerat/gae-django",
"path": "django/contrib/comments/views/comments.py",
"copies": "12",
"size": "5495",
"license": "mit",
"hash": 858281707114321300,
"line_mean": 38.4044117647,
"line_max": 93,
"alpha_frac": 0.6283894449,
"autogenerated": false,
"ratio": 4.326771653543307,
"co... |
from django import http
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site, get_current_site
from django.core.exceptions import ObjectDoesNotExist
def shortcut(request, content_type_id, object_id):
"Redirect to an object's page based on a content-type ID a... | {
"repo_name": "GoSteven/Diary",
"path": "django/contrib/contenttypes/views.py",
"copies": "12",
"size": "3096",
"license": "bsd-3-clause",
"hash": -359390452438962400,
"line_mean": 41.6056338028,
"line_max": 100,
"alpha_frac": 0.6033591731,
"autogenerated": false,
"ratio": 4.366713681241185,
"c... |
from django import http
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.core.exceptions import ObjectDoesNotExist
def shortcut(request, content_type_id, object_id):
"Redirect to an object's page based on a content-type ID and an object ID."
... | {
"repo_name": "greggian/TapdIn",
"path": "django/contrib/contenttypes/views.py",
"copies": "1",
"size": "2801",
"license": "apache-2.0",
"hash": 6655661548492873000,
"line_mean": 39.8059701493,
"line_max": 100,
"alpha_frac": 0.6183505891,
"autogenerated": false,
"ratio": 4.2698170731707314,
"co... |
from django import http
from django.contrib import auth
from django.core import exceptions
class TokenMiddleware(object):
"""
Middleware that authenticates against a token in the http authorization
header.
"""
get_response = None
def __init__(self, get_response=None):
sel... | {
"repo_name": "jasonbeverage/django-token",
"path": "django_token/middleware.py",
"copies": "1",
"size": "1115",
"license": "mit",
"hash": 8436141109932643000,
"line_mean": 28.1351351351,
"line_max": 84,
"alpha_frac": 0.6197309417,
"autogenerated": false,
"ratio": 4.665271966527197,
"config_tes... |
from django import http
from django.contrib.messages import constants, get_level, set_level, utils
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS
from django.contrib.messages.storage import base, default_storage
from django.contrib.messages.stora... | {
"repo_name": "yephper/django",
"path": "tests/messages_tests/base.py",
"copies": "1",
"size": "14604",
"license": "bsd-3-clause",
"hash": -53839544655439310,
"line_mean": 36.1305483029,
"line_max": 94,
"alpha_frac": 0.5892221309,
"autogenerated": false,
"ratio": 4.352906110283159,
"config_test... |
from django import http
from django.core.exceptions import ImproperlyConfigured
from django.template import RequestContext, loader
from django.template.response import TemplateResponse
from django.utils.functional import update_wrapper
from django.utils.log import getLogger
from django.utils.decorators import cla... | {
"repo_name": "bernardokyotoku/skillplant",
"path": "django/views/generic/base.py",
"copies": "3",
"size": "5607",
"license": "bsd-3-clause",
"hash": -5845909544481496000,
"line_mean": 33.04375,
"line_max": 89,
"alpha_frac": 0.5639379347,
"autogenerated": false,
"ratio": 4.660847880299252,
"con... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import force_unicode
f... | {
"repo_name": "hunch/hunch-gift-app",
"path": "django/contrib/databrowse/plugins/calendars.py",
"copies": "12",
"size": "4403",
"license": "mit",
"hash": 2230698729214603800,
"line_mean": 49.1976744186,
"line_max": 151,
"alpha_frac": 0.6297978651,
"autogenerated": false,
"ratio": 3.80882352941176... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.shortcuts import render_to_response
from django.utils.safestring import mark_safe
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
class Dat... | {
"repo_name": "hunch/hunch-gift-app",
"path": "django/contrib/databrowse/sites.py",
"copies": "13",
"size": "5777",
"license": "mit",
"hash": 1232778249074495500,
"line_mean": 36.7718120805,
"line_max": 130,
"alpha_frac": 0.6203912065,
"autogenerated": false,
"ratio": 4.156115107913669,
"config... |
from django import http
from django.template import Context, Engine, TemplateDoesNotExist, loader
from django.utils import six
from django.utils.encoding import force_text
from django.views.decorators.csrf import requires_csrf_token
ERROR_404_TEMPLATE_NAME = '404.html'
ERROR_403_TEMPLATE_NAME = '403.html'
ERRO... | {
"repo_name": "yephper/django",
"path": "django/views/defaults.py",
"copies": "1",
"size": "4399",
"license": "bsd-3-clause",
"hash": 2858604826472778000,
"line_mean": 34.9663865546,
"line_max": 100,
"alpha_frac": 0.651966356,
"autogenerated": false,
"ratio": 4.189523809523809,
"config_test": f... |
from django import http
from django.template import Context, Engine, TemplateDoesNotExist, loader
from django.views.decorators.csrf import requires_csrf_token
# This can be called when CsrfViewMiddleware.process_view has not run,
# therefore need @requires_csrf_token in case the template needs
# {% csrf_token ... | {
"repo_name": "diego-d5000/MisValesMd",
"path": "env/lib/python2.7/site-packages/django/views/defaults.py",
"copies": "1",
"size": "2833",
"license": "mit",
"hash": -9132762753963013000,
"line_mean": 32.975308642,
"line_max": 100,
"alpha_frac": 0.6646664313,
"autogenerated": false,
"ratio": 4.129... |
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS
except:
XS_SHARING_ALLOWED_ORIGINS = '*'
XS_SHARING_ALLOWED_METHODS = ['POST', 'GET', 'OPTIONS', 'PUT', 'DELETE']
class Xs... | {
"repo_name": "chris-ramon/django_angularjs_demo_fbv",
"path": "backend/backend/middlewares.py",
"copies": "1",
"size": "1522",
"license": "mit",
"hash": -1799168096278779100,
"line_mean": 34.4186046512,
"line_max": 93,
"alpha_frac": 0.6636005256,
"autogenerated": false,
"ratio": 3.58962264150943... |
from django import http, shortcuts
from django.db.transaction import non_atomic_requests
from django.shortcuts import render
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import condition
from django.utils.translation import ... | {
"repo_name": "andymckay/olympia",
"path": "src/olympia/files/views.py",
"copies": "2",
"size": "6852",
"license": "bsd-3-clause",
"hash": 9031382164697878000,
"line_mean": 32.2621359223,
"line_max": 78,
"alpha_frac": 0.5961762989,
"autogenerated": false,
"ratio": 3.7940199335548175,
"config_te... |
from django import http, shortcuts
from django.db.transaction import non_atomic_requests
from django.utils.translation import ugettext
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import condition
import olympia.core.logger... | {
"repo_name": "harry-7/addons-server",
"path": "src/olympia/files/views.py",
"copies": "1",
"size": "6346",
"license": "bsd-3-clause",
"hash": 6379561708875064000,
"line_mean": 31.3775510204,
"line_max": 78,
"alpha_frac": 0.6043176804,
"autogenerated": false,
"ratio": 3.7111111111111112,
"confi... |
from django import http, shortcuts
from django.db.transaction import non_atomic_requests
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import condition
from django.utils.translation import ugettext as _
import commonware.log... | {
"repo_name": "mstriemer/addons-server",
"path": "src/olympia/files/views.py",
"copies": "3",
"size": "6645",
"license": "bsd-3-clause",
"hash": -1009501534179973000,
"line_mean": 32.730964467,
"line_max": 78,
"alpha_frac": 0.5894657637,
"autogenerated": false,
"ratio": 3.8388214904679376,
"con... |
from django import http, shortcuts
from django.shortcuts import render
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import condition
import commonware.log
import waffle
from cache_nuggets.lib import Message, Token
from acc... | {
"repo_name": "SuriyaaKudoIsc/olympia",
"path": "apps/files/views.py",
"copies": "2",
"size": "6267",
"license": "bsd-3-clause",
"hash": 766428049618162700,
"line_mean": 32.1587301587,
"line_max": 78,
"alpha_frac": 0.5812988671,
"autogenerated": false,
"ratio": 3.8613678373382623,
"config_test"... |
from django import http, template
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response
from django.utils.html import escape
from django.utils.translation import gettext_lazy
import base64, datetim... | {
"repo_name": "dcroc16/skunk_works",
"path": "google_appengine/lib/django-0.96/django/contrib/admin/views/decorators.py",
"copies": "30",
"size": "3318",
"license": "mit",
"hash": -8952395731049938000,
"line_mean": 44.4520547945,
"line_max": 210,
"alpha_frac": 0.6377335744,
"autogenerated": false,
... |
from django import http, template
from django.contrib.admin import ModelAdmin
from django.contrib.auth import authenticate, login
from django.db.models.base import ModelBase
from django.shortcuts import render_to_response
from django.utils.safestring import mark_safe
from django.utils.text import capfirst
from django.u... | {
"repo_name": "diofeher/django-nfa",
"path": "django/contrib/admin/sites.py",
"copies": "1",
"size": "14233",
"license": "bsd-3-clause",
"hash": 7756856558456094000,
"line_mean": 40.1358381503,
"line_max": 142,
"alpha_frac": 0.5950959039,
"autogenerated": false,
"ratio": 4.457563419981209,
"con... |
from django import http, test
from django.conf import settings
from django.core.cache import cache
from django.utils import translation
import caching
import pytest
from multidb import pinning
from olympia import amo
from olympia.access.models import Group, GroupUser
from olympia.translations.hold import clean_transl... | {
"repo_name": "mstriemer/olympia",
"path": "conftest.py",
"copies": "3",
"size": "4386",
"license": "bsd-3-clause",
"hash": 6150404266655594000,
"line_mean": 31.4888888889,
"line_max": 78,
"alpha_frac": 0.7024623803,
"autogenerated": false,
"ratio": 3.926589077887198,
"config_test": true,
"ha... |
from django import http, test
from django.conf import settings
from django.core.cache import cache
from django.utils import translation
import caching
import pytest
import amo
from access.models import Group, GroupUser
from translations.hold import clean_translations
from users.models import UserProfile
@pytest.fix... | {
"repo_name": "muffinresearch/olympia",
"path": "conftest.py",
"copies": "6",
"size": "4031",
"license": "bsd-3-clause",
"hash": -6607943819425651000,
"line_mean": 30.9920634921,
"line_max": 78,
"alpha_frac": 0.6961051848,
"autogenerated": false,
"ratio": 3.9636184857423795,
"config_test": true... |
from django import http, test
from django.core.cache import caches
from django.utils import translation
import responses
import pytest
from multidb import pinning
from olympia import amo, core
from olympia.access.models import Group, GroupUser
from olympia.amo.tests import start_es_mocks, stop_es_mocks
from olympia.... | {
"repo_name": "lavish205/olympia",
"path": "conftest.py",
"copies": "1",
"size": "4847",
"license": "bsd-3-clause",
"hash": -252954729222029440,
"line_mean": 29.4842767296,
"line_max": 77,
"alpha_frac": 0.6934186094,
"autogenerated": false,
"ratio": 3.8165354330708663,
"config_test": true,
"h... |
from django import http, VERSION
from django.conf import settings
from django.contrib.auth import login, logout, get_user_model
from django.db.models import signals
from django.utils.deprecation import MiddlewareMixin
from django.utils.functional import curry
class SSOLoginMiddleware(MiddlewareMixin):
def proces... | {
"repo_name": "parksandwildlife/dpaw-utils",
"path": "dpaw_utils/middleware.py",
"copies": "1",
"size": "3356",
"license": "apache-2.0",
"hash": -7735569865263938000,
"line_mean": 44.9726027397,
"line_max": 124,
"alpha_frac": 0.6171036949,
"autogenerated": false,
"ratio": 4.23203026481715,
"con... |
from django import http, VERSION
from django.conf import settings
from django.contrib.auth import login, logout, get_user_model
from django.utils.deprecation import MiddlewareMixin
class SSOLoginMiddleware(MiddlewareMixin):
def __init__(self, get_response):
self.get_response = get_response
def proces... | {
"repo_name": "parksandwildlife/ibms",
"path": "ibms_project/middleware.py",
"copies": "1",
"size": "1832",
"license": "apache-2.0",
"hash": 8590540656156856000,
"line_mean": 44.8,
"line_max": 124,
"alpha_frac": 0.6069868996,
"autogenerated": false,
"ratio": 4.098434004474273,
"config_test": fa... |
from django import models
from django.core import template_loader
from django.utils.httpwrappers import HttpResponse
from django.core.xheaders import populate_xheaders
from django.core.extensions import DjangoContext as Context
from django.core.paginator import ObjectPaginator, InvalidPage
from django.core.exceptions i... | {
"repo_name": "tungvx/deploy",
"path": "Django-0.90/django/views/generic/list_detail.py",
"copies": "1",
"size": "4391",
"license": "apache-2.0",
"hash": -5247453453053625000,
"line_mean": 34.6991869919,
"line_max": 112,
"alpha_frac": 0.5902983375,
"autogenerated": false,
"ratio": 4.0544783010156... |
from django import models
from django.core.xheaders import populate_xheaders
from django.core import template_loader, formfields
from django.views.auth.login import redirect_to_login
from django.core.extensions import DjangoContext as Context
from django.core.paginator import ObjectPaginator, InvalidPage
from django.ut... | {
"repo_name": "tungvx/deploy",
"path": "Django-0.90/django/views/generic/create_update.py",
"copies": "1",
"size": "7960",
"license": "apache-2.0",
"hash": -1090125921447565000,
"line_mean": 39.4060913706,
"line_max": 112,
"alpha_frac": 0.6228643216,
"autogenerated": false,
"ratio": 4.11582213029... |
from django import newforms as forms
from django.conf import settings
from django.utils.translation import gettext as _
from datetime import datetime, timedelta
import urlparse
from gabaluu.form_choices import COMMENT_TYPES
from gabaluu.synopsis.models import Synopsis
from gabaluu.synopsis.models import Tag
from gabalu... | {
"repo_name": "CarlosGabaldon/zenopsis",
"path": "synopsis/forms.py",
"copies": "1",
"size": "3359",
"license": "bsd-3-clause",
"hash": -4010878315725010400,
"line_mean": 35.5108695652,
"line_max": 96,
"alpha_frac": 0.5543316463,
"autogenerated": false,
"ratio": 4.1113831089351285,
"config_test... |
from django import newforms as forms
from django.conf import settings
from django.utils.translation import gettext as _
from django.contrib.auth.models import User
from gabaluu.form_choices import COUNTRIES
from gabaluu.account.models import Profile
# ProfileForm.is_valid() calls PictureField.clean() but value is alwa... | {
"repo_name": "CarlosGabaldon/zenopsis",
"path": "account/forms.py",
"copies": "1",
"size": "3832",
"license": "bsd-3-clause",
"hash": -8009918518730200000,
"line_mean": 38.1020408163,
"line_max": 111,
"alpha_frac": 0.6064718163,
"autogenerated": false,
"ratio": 4,
"config_test": false,
"has_... |
from django import newforms as forms
from django.contrib.formtools import preview
from django import http
from django.conf import settings
from django.test import TestCase
success_string = "Done was called!"
test_data = {'field1': u'foo',
'field1_': u'asdf'}
class TestFormPreview(preview.FormPreview):
... | {
"repo_name": "diofeher/django-nfa",
"path": "django/contrib/formtools/tests.py",
"copies": "1",
"size": "3074",
"license": "bsd-3-clause",
"hash": -8097139911347935000,
"line_mean": 33.9318181818,
"line_max": 79,
"alpha_frac": 0.6476903058,
"autogenerated": false,
"ratio": 4.216735253772291,
"... |
from django import newforms as forms
from django.utils.translation import ugettext as _
from django.conf import settings
# needed for some linux distributions like debian
try:
from openid.yadis import xri
except:
from yadis import xri
import re
class OpenidSigninForm(forms.Form):
openid_url = forms.CharF... | {
"repo_name": "percyperez/codereviewr",
"path": "codereviewr/openid_cr/forms.py",
"copies": "1",
"size": "1274",
"license": "mit",
"hash": -8991658032515929000,
"line_mean": 37.6060606061,
"line_max": 116,
"alpha_frac": 0.6436420722,
"autogenerated": false,
"ratio": 3.860606060606061,
"config_t... |
from django import newforms as forms
DEFAULT_DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
'%B %d %Y', '%B %d, %Y... | {
"repo_name": "paulsmith/geodjango",
"path": "django/contrib/localflavor/generic/forms.py",
"copies": "5",
"size": "1643",
"license": "bsd-3-clause",
"hash": -35506730285236790,
"line_mean": 42.2368421053,
"line_max": 89,
"alpha_frac": 0.5112598904,
"autogenerated": false,
"ratio": 2.813356164383... |
from django import oldforms
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.forms import PasswordResetForm, PasswordChangeForm
from django.contrib.sites.models import Site, Req... | {
"repo_name": "paulsmith/geodjango",
"path": "django/contrib/auth/views.py",
"copies": "1",
"size": "4949",
"license": "bsd-3-clause",
"hash": 1037897328353302900,
"line_mean": 46.5865384615,
"line_max": 118,
"alpha_frac": 0.6971105274,
"autogenerated": false,
"ratio": 4.0968543046357615,
"conf... |
from django import oldforms, template
from django.conf import settings
from django.contrib.admin.filterspecs import FilterSpec
from django.contrib.admin.views.decorators import staff_member_required
from django.views.decorators.cache import never_cache
from django.contrib.contenttypes.models import ContentType
from dja... | {
"repo_name": "ychen820/microblog",
"path": "y/google-cloud-sdk/platform/google_appengine/lib/django-0.96/django/contrib/admin/views/main.py",
"copies": "32",
"size": "36451",
"license": "bsd-3-clause",
"hash": -7204258510934450000,
"line_mean": 45.7920410783,
"line_max": 186,
"alpha_frac": 0.6053331... |
from django import oldforms, template
from django import newforms as forms
from django.newforms.formsets import all_valid
from django.newforms.models import _modelform_factory, _inlineformset_factory
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin import widgets
from django.contrib.... | {
"repo_name": "rawwell/django",
"path": "django/contrib/admin/options.py",
"copies": "2",
"size": "34581",
"license": "bsd-3-clause",
"hash": 2747909337851792400,
"line_mean": 44.02734375,
"line_max": 186,
"alpha_frac": 0.6154535728,
"autogenerated": false,
"ratio": 4.178972809667674,
"config_t... |
from django import oldforms, template
from django import newforms as forms
from django.newforms.formsets import all_valid
from django.newforms.models import modelform_factory, inlineformset_factory
from django.newforms.models import BaseInlineFormset
from django.contrib.contenttypes.models import ContentType
from djang... | {
"repo_name": "diofeher/django-nfa",
"path": "django/contrib/admin/options.py",
"copies": "1",
"size": "36812",
"license": "bsd-3-clause",
"hash": -2033627548431755800,
"line_mean": 43.6206060606,
"line_max": 186,
"alpha_frac": 0.6133054439,
"autogenerated": false,
"ratio": 4.168025362318841,
"... |
from django import setup as django_setup
from django.core.handlers import WSGIHandler
from usocketio import WebsocketRequest
class uWSGIHandler(WSGIHandler):
websocket_request = WebsocketRequest
def __call__(self, environ, start_response):
return super(uWSGIHandler, self).__call__(environ, start_r... | {
"repo_name": "aceportfolio/django-usocketio",
"path": "usocketio/wsgi.py",
"copies": "1",
"size": "2237",
"license": "mit",
"hash": -8607194310557660000,
"line_mean": 36.2833333333,
"line_max": 78,
"alpha_frac": 0.5561019222,
"autogenerated": false,
"ratio": 4.318532818532819,
"config_test": f... |
from django import setup
import os
import sys
import yaml
import subprocess
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
setup()
from breach.models import Target, Victim
def select_victim(victims):
print '[*] Victims:'
for i, v in enumerate(victims):
print '\tID: {} - {} ({}... | {
"repo_name": "dionyziz/rupture",
"path": "backend/populate_victims.py",
"copies": "3",
"size": "4159",
"license": "mit",
"hash": 1273724337480295200,
"line_mean": 28.9208633094,
"line_max": 131,
"alpha_frac": 0.5792257754,
"autogenerated": false,
"ratio": 3.428689200329761,
"config_test": fals... |
from django import setup
import os
import yaml
from backend.settings import BASE_DIR
import subprocess
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
setup()
from breach.models import Target, Victim
def select_victim(victims):
print '[*] Victims:'
for i, v in enumerate(victims):
... | {
"repo_name": "esarafianou/rupture",
"path": "backend/populate_victims.py",
"copies": "1",
"size": "4322",
"license": "mit",
"hash": -5633398761025277000,
"line_mean": 30.0935251799,
"line_max": 143,
"alpha_frac": 0.5800555298,
"autogenerated": false,
"ratio": 3.4220110847189233,
"config_test":... |
from django import shortcuts
from django.conf import settings
from django.core.urlresolvers import set_script_prefix
from django.test.client import Client, RequestFactory
import pytest
from olympia.amo import urlresolvers
from olympia.amo.middleware import LocaleAndAppURLMiddleware
from olympia.amo.tests import BaseT... | {
"repo_name": "harry-7/addons-server",
"path": "src/olympia/amo/tests/test_url_prefix.py",
"copies": "1",
"size": "12892",
"license": "bsd-3-clause",
"hash": -5544449513070733000,
"line_mean": 35.9398280802,
"line_max": 79,
"alpha_frac": 0.5916847657,
"autogenerated": false,
"ratio": 3.4665232589... |
from django import shortcuts
from django.conf import settings
from django.urls import set_script_prefix
from django.test.client import Client, RequestFactory
import pytest
from olympia.amo import urlresolvers
from olympia.amo.middleware import LocaleAndAppURLMiddleware
from olympia.amo.tests import BaseTestCase, Test... | {
"repo_name": "aviarypl/mozilla-l10n-addons-server",
"path": "src/olympia/amo/tests/test_url_prefix.py",
"copies": "2",
"size": "13071",
"license": "bsd-3-clause",
"hash": 8074130370632451000,
"line_mean": 35.8197183099,
"line_max": 79,
"alpha_frac": 0.5911559942,
"autogenerated": false,
"ratio":... |
from django import shortcuts
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.views import generic
from oscar.core.loading import get_classes, get_model
WeightBandForm, WeightBasedForm = get_classes(
'dashboard.shippin... | {
"repo_name": "michaelkuty/django-oscar",
"path": "src/oscar/apps/dashboard/shipping/views.py",
"copies": "24",
"size": "5163",
"license": "bsd-3-clause",
"hash": 8253776528660727000,
"line_mean": 35.3591549296,
"line_max": 77,
"alpha_frac": 0.6573697463,
"autogenerated": false,
"ratio": 3.920273... |
from django import shortcuts
from django.http import HttpResponse
from django.core.mail import send_mail
from django.shortcuts import render
from bots.abridged_bot import DIR_PATH as BOT_PATH
import random, os, re
from settings.common import PROJECT_PATH, SECRETS_DICT, ADMIN_EMAILS, getTrueSpeakBucket, getOrCreateS3Key... | {
"repo_name": "mhfowler/abridgedmaps",
"path": "mhf/views.py",
"copies": "1",
"size": "1727",
"license": "mit",
"hash": 8162001633669424000,
"line_mean": 36.5652173913,
"line_max": 120,
"alpha_frac": 0.6473653735,
"autogenerated": false,
"ratio": 3.7060085836909873,
"config_test": false,
"has... |
from django import shortcuts
from django import http
from django.core.urlresolvers import reverse
from django.views.decorators.http import require_http_methods
from django.contrib import messages
from .models import Package
from .forms import PackageForm
def package_list(request):
return shortcuts.render(request... | {
"repo_name": "jakobadam/bootstrap-uploadprogress",
"path": "test/project/progress/views.py",
"copies": "1",
"size": "1369",
"license": "mit",
"hash": 7465049739130073000,
"line_mean": 30.1136363636,
"line_max": 74,
"alpha_frac": 0.6888239591,
"autogenerated": false,
"ratio": 3.9339080459770117,
... |
from django import shortcuts
from django import http
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from horizon import messages
from cloudvalidation.api import cloudv
class ExecuteJob(tables.BatchAction):
name = "execute"
... | {
"repo_name": "denismakogon/cloudvalidation-dashboard",
"path": "cloudvalidation/ostf_jobs/tables.py",
"copies": "2",
"size": "2226",
"license": "apache-2.0",
"hash": 4619860161394512000,
"line_mean": 24.0112359551,
"line_max": 69,
"alpha_frac": 0.5920934412,
"autogenerated": false,
"ratio": 4.21... |
from django import shortcuts
from django import urls
from django.contrib.auth import (
decorators, mixins
)
from django.views import generic
from . import forms
from . import models
class Index(generic.ListView):
model = models.Post
paginate_by = 10
template_name = 'posts/index.html'
context_obje... | {
"repo_name": "nagracks/dj-hackernews-clone",
"path": "hn_clone/posts/views.py",
"copies": "1",
"size": "2529",
"license": "mit",
"hash": 5581550504828043000,
"line_mean": 29.1071428571,
"line_max": 76,
"alpha_frac": 0.6532226176,
"autogenerated": false,
"ratio": 3.878834355828221,
"config_test... |
from django import shortcuts
from django.views import generic
import models
class ArticleListView(generic.ListView):
paginate_by = 8
kind = None
def get_queryset(self):
if self.kind:
return models.Article.objects.published().filter(kind=self.kind)
else:
return mo... | {
"repo_name": "megaprojectske/megaprojects.co.ke",
"path": "megaprojects/articles/views.py",
"copies": "1",
"size": "1427",
"license": "apache-2.0",
"hash": 4858047012032807000,
"line_mean": 27.54,
"line_max": 78,
"alpha_frac": 0.6306937631,
"autogenerated": false,
"ratio": 4.112391930835735,
"... |
from django import shortcuts
from django.core.cache import cache
class SnippetException(Exception):
pass
def has_snippet(template, snippet):
if template == snippet['template']:
return True
includes = cache.get('template_includes:%s' % template, []) # TODO: None & check
for i in includes:
if has... | {
"repo_name": "visipedia/django-auto-ajax",
"path": "django_auto_ajax/snippets.py",
"copies": "1",
"size": "2407",
"license": "mit",
"hash": -6183641910369408000,
"line_mean": 28.4683544304,
"line_max": 91,
"alpha_frac": 0.6788533444,
"autogenerated": false,
"ratio": 3.4783236994219653,
"config... |
from django import shortcuts, template
from django.template import loader, RequestContext
from django.shortcuts import get_object_or_404
from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect
from django.conf import settings
from django.core.xheaders import populate_xheaders
from django.utils.safe... | {
"repo_name": "mhulse/django-dox",
"path": "dox/views.py",
"copies": "2",
"size": "2136",
"license": "apache-2.0",
"hash": 4490919729074658300,
"line_mean": 30.4264705882,
"line_max": 122,
"alpha_frac": 0.6540262172,
"autogenerated": false,
"ratio": 3.897810218978102,
"config_test": false,
"h... |
from django import template as template_
from django.conf import settings
from django.utils.safestring import mark_safe
from extras.plugins import PluginTemplateExtension
from extras.registry import registry
register = template_.Library()
def _get_registered_content(obj, method, template_context):
"""
Given... | {
"repo_name": "digitalocean/netbox",
"path": "netbox/extras/templatetags/plugins.py",
"copies": "1",
"size": "2412",
"license": "apache-2.0",
"hash": -2407111930535185000,
"line_mean": 31.16,
"line_max": 102,
"alpha_frac": 0.688225539,
"autogenerated": false,
"ratio": 4.269026548672566,
"config... |
from django import template, forms
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.models import Message
from django.template import loader
from django.shortcuts import render_to_response
from django.contrib.sites.models import Site
from django.conf import settings
from ... | {
"repo_name": "isaac-philip/loolu",
"path": "common/django/contrib/admin/views/template.py",
"copies": "1",
"size": "3284",
"license": "mit",
"hash": 4024922372601557000,
"line_mean": 40.5696202532,
"line_max": 79,
"alpha_frac": 0.6598660171,
"autogenerated": false,
"ratio": 4.304062909567497,
... |
from django import template, forms
from django.contrib.admin.views.decorators import staff_member_required
from django.template import loader
from django.shortcuts import render_to_response
from django.contrib.sites.models import Site
from django.conf import settings
from django.utils.importlib import import_module
fro... | {
"repo_name": "sam-tsai/django-old",
"path": "django/contrib/admin/views/template.py",
"copies": "88",
"size": "3255",
"license": "bsd-3-clause",
"hash": 4533918168085116000,
"line_mean": 40.2025316456,
"line_max": 79,
"alpha_frac": 0.6589861751,
"autogenerated": false,
"ratio": 4.316976127320955... |
from django import template, forms
from django.contrib.admin.views.decorators import staff_member_required
from django.template import loader
from django.shortcuts import render_to_response
from django.contrib.sites.models import Site
from django.conf import settings
from django.utils.importlib import import_modu... | {
"repo_name": "greggian/TapdIn",
"path": "django/contrib/admin/views/template.py",
"copies": "1",
"size": "3314",
"license": "apache-2.0",
"hash": 1992646550107963100,
"line_mean": 40.4871794872,
"line_max": 79,
"alpha_frac": 0.6424260712,
"autogenerated": false,
"ratio": 4.360526315789474,
"co... |
from django import template, http
from django.conf import settings
from django.shortcuts import get_object_or_404, render_to_response
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
from campaign.models import Campaign, BlacklistEntry
from campaign.forms import SubscribeForm, U... | {
"repo_name": "hbielenia/django-campaign",
"path": "campaign/views.py",
"copies": "1",
"size": "3321",
"license": "bsd-3-clause",
"hash": -7926802758438289000,
"line_mean": 40.5125,
"line_max": 122,
"alpha_frac": 0.6317374285,
"autogenerated": false,
"ratio": 4.187894073139975,
"config_test": f... |
from django import template, http
from django.shortcuts import get_object_or_404, render_to_response
from django.template import Context, loader, RequestContext
from speechbubble.campaign.models import Campaign, Subscriber, SubscriberList
import forms
def view_online(request, object_id):
campaign = get_object_or_4... | {
"repo_name": "ACECentre/SpeechBubblev1",
"path": "speechbubble/speechbubble/campaign/views.py",
"copies": "1",
"size": "2380",
"license": "bsd-3-clause",
"hash": -6325032398795482000,
"line_mean": 33,
"line_max": 89,
"alpha_frac": 0.6487394958,
"autogenerated": false,
"ratio": 4.160839160839161,... |
from django import template
from account.utils import provider_details
register = template.Library()
def get_provider_attr(backend=None, attr=None):
try:
return provider_details(backend)[attr]
except TypeError:
return ''
@register.filter(name='provider_name')
def provider_name_filter(value)... | {
"repo_name": "anantb/datahub",
"path": "src/account/templatetags/backend_details.py",
"copies": "3",
"size": "1235",
"license": "mit",
"hash": 1746553648606793500,
"line_mean": 26.4444444444,
"line_max": 73,
"alpha_frac": 0.6785425101,
"autogenerated": false,
"ratio": 3.93312101910828,
"config... |
from django import template
from actionlog.models import LogEntry
register = template.Library()
class LogNode(template.Node):
def __init__(self, limit, varname, user=None, object=None, log_type='get_log'):
self.limit, self.varname, self.object , self.user = (limit, varname,
... | {
"repo_name": "rvanlaar/easy-transifex",
"path": "src/transifex/transifex/actionlog/templatetags/tx_action_log.py",
"copies": "2",
"size": "2790",
"license": "bsd-2-clause",
"hash": 143633916175259860,
"line_mean": 37.75,
"line_max": 89,
"alpha_frac": 0.5483870968,
"autogenerated": false,
"ratio"... |
from django import template
from activeusers.models import Visitor
register = template.Library()
class VisitorsOnSite(template.Node):
"""
Injects the number of active users on your site as an integer into the context
"""
def __init__(self, varname, same_page=False):
self.varname = varname
... | {
"repo_name": "asavoy/django-activeusers",
"path": "activeusers/templatetags/tracking_tags.py",
"copies": "1",
"size": "1708",
"license": "mit",
"hash": 4872828709780571000,
"line_mean": 33.16,
"line_max": 197,
"alpha_frac": 0.6610070258,
"autogenerated": false,
"ratio": 4.145631067961165,
"con... |
from django import template
from adv_cache_tag.tag import CacheTag
import hashlib
from django.utils.http import urlquote
import django.core.cache as caches
# Extending the CacheTag class from django-adv-cache-tag
class FileBasedCacheTag(CacheTag):
# Sets back-end for this tag to be something else in CACHES[] besi... | {
"repo_name": "baronvonvaderham/django-file-cache-tag",
"path": "file_cache_tag/templatetags/custom_caching.py",
"copies": "1",
"size": "1334",
"license": "mit",
"hash": -8324871451668665000,
"line_mean": 32.35,
"line_max": 83,
"alpha_frac": 0.7106446777,
"autogenerated": false,
"ratio": 3.685082... |
from django import template
from ..API import get_summoner_spell_info, get_summoner_league
from ..models import SummonerSpell
from django.shortcuts import get_object_or_404
from cassiopeia.core import Champion
from ..data import game_q_config_id_to_name as game_id_to_name
register = template.Library()
@register.filt... | {
"repo_name": "belleandindygames/league",
"path": "league/champ_chooser/templatetags/nameTags.py",
"copies": "1",
"size": "5571",
"license": "mit",
"hash": 5042666505997530000,
"line_mean": 22.7106382979,
"line_max": 82,
"alpha_frac": 0.549273021,
"autogenerated": false,
"ratio": 2.56020220588235... |
from django import template
from app.models import BrewPiDevice, FermentationProfile, FermentationProfilePoint
from django.utils import timezone
from app.api.clog import get_filepath_to_log
from django.conf import settings
register = template.Library()
# There may be an easier way of doing this, but I want to be ab... | {
"repo_name": "thorrak/fermentrack",
"path": "app/templatetags/custom_tags.py",
"copies": "1",
"size": "1506",
"license": "mit",
"hash": 6023615458209860000,
"line_mean": 39.7027027027,
"line_max": 116,
"alpha_frac": 0.7629482072,
"autogenerated": false,
"ratio": 3.5771971496437054,
"config_tes... |
from django import template
from apps.models import App, Release
register = template.Library()
@register.inclusion_tag('app_button.html')
def app_button(app, order_index):
app.star_percentage = 100 * app.stars / 5 / app.votes if app.votes else 0
c = {}
c['app'] = app
c['order_index'] = order_index
... | {
"repo_name": "abhijithanilkumar/ns-3-AppStore",
"path": "src/apps/templatetags/app_buttons.py",
"copies": "1",
"size": "1412",
"license": "mit",
"hash": 3866740536935936000,
"line_mean": 35.2051282051,
"line_max": 81,
"alpha_frac": 0.5970254958,
"autogenerated": false,
"ratio": 3.538847117794486... |
from django import template
from apps.quiz.models import Answer
register = template.Library()
@register.inclusion_tag('quiz/answers_for_question.html', takes_context=True)
def answers_for_question(context, question, quiz):
"""
Displays the possible answers to a question
"""
answers = Answer.objects.f... | {
"repo_name": "Sirikam/Gravitas",
"path": "apps/quiz/templatetags/quiz_tags.py",
"copies": "1",
"size": "2324",
"license": "mit",
"hash": -6879696628490756000,
"line_mean": 32.6956521739,
"line_max": 79,
"alpha_frac": 0.6798623064,
"autogenerated": false,
"ratio": 3.766612641815235,
"config_tes... |
from django import template
from articles.models import LinkRoll, Link
register = template.Library()
@register.inclusion_tag('articles/includes/linkroll_list.html')
def get_linkrolls(num='All', destination_slug=None, *args, **kwargs):
"""
Takes an optional number and destination slug and returns a list of Li... | {
"repo_name": "tBaxter/tango-articles",
"path": "articles/templatetags/linkroll_tags.py",
"copies": "2",
"size": "1512",
"license": "mit",
"hash": -7144269002885710000,
"line_mean": 31.170212766,
"line_max": 104,
"alpha_frac": 0.6686507937,
"autogenerated": false,
"ratio": 3.8473282442748094,
"... |
from django import template
from aspc.folio.models import Page
import re, logging
register = template.Library()
log = logging.getLogger(__name__)
class BreadcrumbsListNode(template.Node):
def __init__(self, leaf_page, var_name):
self.leaf_page = template.Variable(leaf_page)
self.var_name = var_nam... | {
"repo_name": "theworldbright/mainsite",
"path": "aspc/folio/templatetags/pages.py",
"copies": "2",
"size": "2729",
"license": "mit",
"hash": 3493970944369226000,
"line_mean": 35.4,
"line_max": 99,
"alpha_frac": 0.6328325394,
"autogenerated": false,
"ratio": 3.7589531680440773,
"config_test": f... |
from django import template
from avocado.models import DataField, DataConcept
register = template.Library()
class AvocadoLoadNode(template.Node):
def __init__(self, model, key, variable):
self.model = model
self.key = key
self.variable = variable
def render(self, context):
t... | {
"repo_name": "murphyke/avocado",
"path": "avocado/templatetags/avocado_tags.py",
"copies": "3",
"size": "2432",
"license": "bsd-2-clause",
"hash": -1096321270070939800,
"line_mean": 30.5844155844,
"line_max": 79,
"alpha_frac": 0.5254934211,
"autogenerated": false,
"ratio": 4.350626118067979,
"... |
from django import template
from basic.bookmarks.models import Bookmark
from basic.blog.models import Post
from photologue.models import Photo
from datetime import datetime
import re
register = template.Library()
#Load Bookmarks
class BookmarkNode(template.Node):
def __init__(self, fetch_string):
self.fetc... | {
"repo_name": "aawsolutions/bslcks",
"path": "bslctags/templatetags/mytags.py",
"copies": "1",
"size": "3931",
"license": "bsd-3-clause",
"hash": -8176869150742102000,
"line_mean": 37.1650485437,
"line_max": 227,
"alpha_frac": 0.647672348,
"autogenerated": false,
"ratio": 3.6064220183486237,
"c... |
from django import template
from basic.events.models import Event, EventTime
import re
register = template.Library()
class UpcomingEventsNode(template.Node):
def __init__(self, var_name, limit=10):
self.var_name = var_name
self.limit = limit
def render(self, context):
context[self.va... | {
"repo_name": "blampe/M2M",
"path": "basic/events/templatetags/events.py",
"copies": "3",
"size": "1151",
"license": "mit",
"hash": -3053819153974783000,
"line_mean": 30.1351351351,
"line_max": 99,
"alpha_frac": 0.6698523023,
"autogenerated": false,
"ratio": 3.8366666666666664,
"config_test": f... |
from django import template
from basic.inlines.parser import inlines
from basic.inlines.models import InlineType
import re
register = template.Library()
@register.filter
def render_inlines(value):
"""
Renders inlines in a ``Post`` by passing them through inline templates.
Template Syntax::
{{ p... | {
"repo_name": "OnlyInAmerica/django-basic-apps",
"path": "basic/inlines/templatetags/inlines.py",
"copies": "13",
"size": "2071",
"license": "bsd-3-clause",
"hash": -5635590463612813000,
"line_mean": 24.5802469136,
"line_max": 99,
"alpha_frac": 0.6397875423,
"autogenerated": false,
"ratio": 3.922... |
from django import template
from basics.models import *
register = template.Library()
@register.filter
def get_short_text( need , max_len=100):
if len(need.text) > max_len:
return need.text[:max_len] + "..."
return need.text
@register.filter
def is_own(roomname, user):
if Room.objects.get(name=ro... | {
"repo_name": "actofgoods/actofgoods",
"path": "basics/templatetags/filter.py",
"copies": "1",
"size": "1546",
"license": "mit",
"hash": -7126492877441505000,
"line_mean": 26.6071428571,
"line_max": 102,
"alpha_frac": 0.7128072445,
"autogenerated": false,
"ratio": 3.092,
"config_test": false,
... |
from django import template
from bs4 import BeautifulSoup
register = template.Library()
@register.filter
def get_type(obj):
type_ = obj.__class__.__name__.lower()
if type_ == 'album':
return 'talking_album' if obj.slides.first().audio else 'photo_album'
if type_ == 'article':
categories ... | {
"repo_name": "PARINetwork/pari",
"path": "core/templatetags/core_filters.py",
"copies": "1",
"size": "1439",
"license": "bsd-3-clause",
"hash": 2303604708317987600,
"line_mean": 25.1636363636,
"line_max": 77,
"alpha_frac": 0.5934676859,
"autogenerated": false,
"ratio": 3.68974358974359,
"confi... |
from django import template
from bulbs.utils.methods import get_overridable_template_name
register = template.Library()
# Liveblog Template
liveblog_template_name = get_overridable_template_name(
'liveblog/bulbs_liveblog.html',
'liveblog/liveblog_override.html')
@register.inclusion_tag(liveblog_template_nam... | {
"repo_name": "theonion/django-bulbs",
"path": "bulbs/liveblog/templatetags/liveblog_tags.py",
"copies": "1",
"size": "1314",
"license": "mit",
"hash": 4712242068626018000,
"line_mean": 26.9574468085,
"line_max": 75,
"alpha_frac": 0.7701674277,
"autogenerated": false,
"ratio": 3.360613810741688,
... |
from django import template
from calendar import HTMLCalendar, SUNDAY
from datetime import date
from itertools import groupby
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
register = template.Library()
class TeeTimeCalendar(HTMLCalendar):
def __init__(self, teetimes):
... | {
"repo_name": "DArtagan/teetimer",
"path": "tracker/templatetags/calendar_tags.py",
"copies": "1",
"size": "3031",
"license": "mit",
"hash": -214870186991648540,
"line_mean": 35.5180722892,
"line_max": 160,
"alpha_frac": 0.6001319696,
"autogenerated": false,
"ratio": 3.528521536670547,
"config_... |
from django import template
from canvas.details_models import ContentDetails
from canvas.models import Visibility
register = template.Library()
def _wh(content_data, ratio):
return dict((dimension, int(content_data[dimension] / ratio),)
for dimension in ['width', 'height'])
def _fit_inside(fit_w, ... | {
"repo_name": "canvasnetworks/canvas",
"path": "website/canvas/templatetags/content_tags.py",
"copies": "1",
"size": "1986",
"license": "bsd-3-clause",
"hash": -8844809330158377000,
"line_mean": 33.8421052632,
"line_max": 100,
"alpha_frac": 0.6465256798,
"autogenerated": false,
"ratio": 3.4359861... |
from django import template
from cart import cart
from pyment.settings import BREWER_NAME, BREWER_EMAIL, BREWER_LOCATION
from meadery.models import Product
from django.urls import reverse
register = template.Library()
@register.inclusion_tag("tags/cart_box.html")
def cart_box(request):
cart_item_count = cart.car... | {
"repo_name": "mathuin/pyment",
"path": "django/meadery/templatetags/meadery_tags.py",
"copies": "1",
"size": "1390",
"license": "mit",
"hash": -3095382413468434400,
"line_mean": 33.75,
"line_max": 84,
"alpha_frac": 0.7129496403,
"autogenerated": false,
"ratio": 3.6387434554973823,
"config_test... |
from django import template
from categories.models import Category
from mptt.utils import drilldown_tree_for_node
from mptt.templatetags.mptt_tags import tree_path, tree_info
register = template.Library()
register.filter("category_path", tree_path)
register.filter(tree_info)
def get_category(category_string):
""... | {
"repo_name": "indexofire/gravoicy",
"path": "gravoicy/apps/categories/templatetags/category_tags.py",
"copies": "1",
"size": "3933",
"license": "bsd-3-clause",
"hash": 6236690633766140000,
"line_mean": 28.3507462687,
"line_max": 90,
"alpha_frac": 0.6081871345,
"autogenerated": false,
"ratio": 4.... |
from django import template
from channels.models import Subscription as ChannelSubscription
from links.models import Subscription as LinkSubscription
register = template.Library()
@register.filter
def channel_subscription_status(user, channel):
if user.is_authenticated():
try:
subscription = C... | {
"repo_name": "linkfloyd/linkfloyd",
"path": "linkfloyd/links/templatetags/channel_tags.py",
"copies": "1",
"size": "1054",
"license": "bsd-3-clause",
"hash": -6199044685744311000,
"line_mean": 26.7368421053,
"line_max": 63,
"alpha_frac": 0.6233396584,
"autogenerated": false,
"ratio": 5.405128205... |
from django import template
from classytags.arguments import Argument
from classytags.core import Tag, Options
from django.template.defaultfilters import safe
from django.core.cache import cache
from ..models import Placeholder
import hashlib
register = template.Library()
class RenderPlaceholder(Tag):
name = 'ap... | {
"repo_name": "CodeMill/django-appcms",
"path": "appcms/templatetags/appcms_tags.py",
"copies": "1",
"size": "1330",
"license": "mit",
"hash": -3993556549832460000,
"line_mean": 29.9302325581,
"line_max": 79,
"alpha_frac": 0.6240601504,
"autogenerated": false,
"ratio": 4.403973509933775,
"confi... |
from django import template
from cobra.core.loading import feature_hidden
register = template.Library()
def get_parameters(parser, token):
"""
{% get_parameters except_field %}
"""
args = token.split_contents()
if len(args) < 2:
raise template.TemplateSyntaxError(
"get_parame... | {
"repo_name": "lyoniionly/django-cobra",
"path": "src/cobra/templatetags/display_tags.py",
"copies": "1",
"size": "1910",
"license": "apache-2.0",
"hash": -3328955667653183000,
"line_mean": 25.9014084507,
"line_max": 76,
"alpha_frac": 0.6193717277,
"autogenerated": false,
"ratio": 4.0899357601713... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.