text stringlengths 0 1.05M | meta dict |
|---|---|
from django import VERSION
from django.http import Http404
from django.http import HttpResponse
from django.http import QueryDict
from django.template import RequestContext
from django.shortcuts import render_to_response, redirect, get_object_or_404
from django.db import connection
from django.db.models import Count, A... | {
"repo_name": "DrDos0016/z2",
"path": "museum_site/common.py",
"copies": "1",
"size": "11726",
"license": "mit",
"hash": -7863692034280262000,
"line_mean": 28.9132653061,
"line_max": 352,
"alpha_frac": 0.5914207743,
"autogenerated": false,
"ratio": 2.940320962888666,
"config_test": false,
"ha... |
from django import VERSION
from django.http import HttpResponse
from django.utils.http import url_has_allowed_host_and_scheme
from django.views.generic import View
from django.shortcuts import redirect, resolve_url
from django.conf import settings
from django.urls import reverse
from django.contrib.auth import authenti... | {
"repo_name": "jlaunonen/kirppu",
"path": "kompassi_oauth2/views.py",
"copies": "1",
"size": "3695",
"license": "mit",
"hash": -1854354291922202000,
"line_mean": 34.8737864078,
"line_max": 117,
"alpha_frac": 0.6527740189,
"autogenerated": false,
"ratio": 4.029443838604144,
"config_test": false,... |
from django import VERSION
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import Page
from ._markups import get_all_markups
from .settings import WALIKI_CODEMIRROR_SETTINGS as CM_SETTINGS, get_slug
from .acl import check_perms
class DeleteForm(forms.Form):
what = for... | {
"repo_name": "RobertoMaurizzi/waliki",
"path": "waliki/forms.py",
"copies": "3",
"size": "4062",
"license": "bsd-3-clause",
"hash": 4401849520929405400,
"line_mean": 37.6857142857,
"line_max": 133,
"alpha_frac": 0.5881339242,
"autogenerated": false,
"ratio": 4.157625383828045,
"config_test": f... |
from django import VERSION
from django import template
if VERSION[:2] >= (1, 10):
from django.urls import reverse
else:
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from waliki.acl import check_perms as check_perms_helper
from waliki.models import Page
fro... | {
"repo_name": "OlegGirko/waliki",
"path": "waliki/templatetags/waliki_tags.py",
"copies": "2",
"size": "6296",
"license": "bsd-3-clause",
"hash": 3816384113719430000,
"line_mean": 31.621761658,
"line_max": 88,
"alpha_frac": 0.6180114358,
"autogenerated": false,
"ratio": 3.7996378998189497,
"con... |
from django import VERSION
from django.template import (Template, TemplateDoesNotExist,
TemplateSyntaxError)
from importlib import import_module
def get_loaders():
if VERSION[:2] < (1, 8):
from django.template.loader import template_source_loaders
if template_source_lo... | {
"repo_name": "tbtimes/checkup-survey",
"path": "editorial_board/dbtemplates/utils/template.py",
"copies": "1",
"size": "2286",
"license": "mit",
"hash": 133104418673286500,
"line_mean": 34.1692307692,
"line_max": 89,
"alpha_frac": 0.605424322,
"autogenerated": false,
"ratio": 5.0131578947368425,... |
from django import VERSION
if (VERSION[0] >= 1 and VERSION[1] >= 4):
from django.utils.timezone import now
else:
from datetime import datetime
now = datetime.now
from django.db import models
from django_mailer import constants
class QueueMethods(object):
"""
A mixin which provides extra methods to... | {
"repo_name": "mfwarren/django-mailer-2",
"path": "django_mailer/managers.py",
"copies": "3",
"size": "2637",
"license": "mit",
"hash": 346782455696267500,
"line_mean": 27.3548387097,
"line_max": 76,
"alpha_frac": 0.6389836936,
"autogenerated": false,
"ratio": 4.538726333907057,
"config_test": ... |
from django import VERSION
if (VERSION[0] >= 1 and VERSION[1] >= 4):
from django.utils.timezone import now
from datetime import date, timedelta
else:
from datetime import datetime, date, timedelta
now = datetime.now
import logging
from optparse import make_option
from django.core.management.base import... | {
"repo_name": "davidmarble/django-mailer-2",
"path": "django_mailer/management/commands/cleanup_mail.py",
"copies": "3",
"size": "1304",
"license": "mit",
"hash": 6827105860631438000,
"line_mean": 36.2571428571,
"line_max": 78,
"alpha_frac": 0.6809815951,
"autogenerated": false,
"ratio": 4.233766... |
from django import VERSION
if VERSION < (1, 2):
import warnings
warnings.warn(
"Django 1.1 support in django-model-utils is pending deprecation.",
PendingDeprecationWarning)
class ChoiceEnum(object):
"""
DEPRECATED: Use ``Choices`` (below) instead. This class has less
flexibility ... | {
"repo_name": "nathangeffen/tbonline-old",
"path": "tbonlineproject/external/model_utils/__init__.py",
"copies": "4",
"size": "4759",
"license": "mit",
"hash": -2190429368859127300,
"line_mean": 34.2518518519,
"line_max": 98,
"alpha_frac": 0.623870561,
"autogenerated": false,
"ratio": 4.510900473... |
from django import VERSION
if VERSION < (1, 5):
from django.utils import simplejson
else:
import json as simplejson
from oembed.exceptions import OEmbedException
class OEmbedResource(object):
"""
OEmbed resource, as well as a factory for creating resource instances
from response json
"""
_... | {
"repo_name": "akvo/djangoembed",
"path": "oembed/resources.py",
"copies": "1",
"size": "1275",
"license": "mit",
"hash": 788381761828248700,
"line_mean": 25.5625,
"line_max": 80,
"alpha_frac": 0.5984313725,
"autogenerated": false,
"ratio": 4.194078947368421,
"config_test": false,
"has_no_key... |
from django import VERSION
if VERSION[:2] >= (1, 4):
from django.utils.timezone import now
else:
from datetime import datetime
def now(tz=None):
return datetime.now(tz)
from filer.utils.files import get_valid_filename
from django.utils.encoding import force_unicode, smart_str
import os
def by_date... | {
"repo_name": "Ivansek/django-filer",
"path": "filer/utils/generate_filename.py",
"copies": "7",
"size": "1160",
"license": "bsd-3-clause",
"hash": 5294648352343222000,
"line_mean": 31.2222222222,
"line_max": 72,
"alpha_frac": 0.6543103448,
"autogenerated": false,
"ratio": 3.4421364985163203,
"... |
from django import VERSION
import os
from django.contrib.admin import ModelAdmin, helpers
from django.contrib.admin.util import unquote
from django.conf.urls import patterns, url
from django.utils.encoding import force_text
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext... | {
"repo_name": "Excentrics/publication-backbone",
"path": "publication_backbone/admin/modelcloneadmin.py",
"copies": "1",
"size": "11957",
"license": "bsd-3-clause",
"hash": 949832230985549600,
"line_mean": 43.1254612546,
"line_max": 111,
"alpha_frac": 0.5783223217,
"autogenerated": false,
"ratio"... |
from django import VERSION
from django.db import models
from django.db.models import OneToOneField
from django.core.serializers.json import DjangoJSONEncoder
try:
from django.db.models.fields.related import SingleRelatedObjectDescriptor
except ImportError:
from django.db.models.fields.related_descriptors impor... | {
"repo_name": "rocity/dj-instagram",
"path": "djinstagram/annoying/fields.py",
"copies": "1",
"size": "4857",
"license": "apache-2.0",
"hash": -5033177421455297000,
"line_mean": 30.9539473684,
"line_max": 118,
"alpha_frac": 0.6306361952,
"autogenerated": false,
"ratio": 4.197925669835782,
"conf... |
from django import VERSION
from dynamic_raw_id.widgets import DynamicRawIDMultiIdWidget, DynamicRawIDWidget
class DynamicRawIDMixin(object):
dynamic_raw_id_fields = ()
def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
if db_field.name in self.dynamic_raw_id_fields:
re... | {
"repo_name": "lincolnloop/django-salmonella",
"path": "dynamic_raw_id/admin.py",
"copies": "1",
"size": "1119",
"license": "mit",
"hash": -3218803581314179600,
"line_mean": 42.0384615385,
"line_max": 80,
"alpha_frac": 0.6523681859,
"autogenerated": false,
"ratio": 3.73,
"config_test": false,
... |
from django import VERSION
from .testapp.models import AdjacencyListModel, NestedSetModel
VERSION_PRE_19 = VERSION < (1, 9)
def actual_test(model_id, user_create, request_client):
user = user_create(superuser=True)
client = request_client()
assert client.login(username=user.username, password='passwo... | {
"repo_name": "idlesign/django-admirarchy",
"path": "admirarchy/tests/test_basic.py",
"copies": "1",
"size": "2922",
"license": "bsd-3-clause",
"hash": -7975625286185974000,
"line_mean": 30.4565217391,
"line_max": 80,
"alpha_frac": 0.6679336558,
"autogenerated": false,
"ratio": 3.330264672036824,... |
from django import VERSION
try:
from django.contrib.sites.shortcuts import get_current_site
except ImportError:
from django.contrib.sites.models import get_current_site
from django.template import Context, loader
try:
from django_comments import get_model
from django_comments.signals import (comment_w... | {
"repo_name": "danirus/django-comments-xtd",
"path": "django_comments_xtd/moderation.py",
"copies": "1",
"size": "5390",
"license": "bsd-2-clause",
"hash": -5910191625631275000,
"line_mean": 39.8333333333,
"line_max": 80,
"alpha_frac": 0.652690167,
"autogenerated": false,
"ratio": 4.6425495262704... |
from django import VERSION
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
from django.db import transaction
from django.core.exceptions import ImproperlyConfigured
from django.contrib.auth.models import User
from django.contrib.contenttypes.models i... | {
"repo_name": "gradel/django-generic-bookmarks",
"path": "bookmarks/backends.py",
"copies": "1",
"size": "10407",
"license": "mit",
"hash": -6060314827428532000,
"line_mean": 33.8060200669,
"line_max": 80,
"alpha_frac": 0.6006534064,
"autogenerated": false,
"ratio": 4.441741357234315,
"config_t... |
from django import VERSION
from django.db import models
from django.db.models import Q
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User, Group
from django.contrib import admin
from django_granular_permissions im... | {
"repo_name": "commtrack/temp-aquatest",
"path": "apps/django_granular_permissions/models.py",
"copies": "1",
"size": "6098",
"license": "bsd-3-clause",
"hash": 5391306695495103000,
"line_mean": 39.4829931973,
"line_max": 135,
"alpha_frac": 0.6090521482,
"autogenerated": false,
"ratio": 4.1063973... |
from django import views
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404, HttpResponse
from django.shortcuts import get_object_or_404, render_to_response, \
render... | {
"repo_name": "ejesse/django-reader",
"path": "src/reader/views.py",
"copies": "1",
"size": "3680",
"license": "bsd-3-clause",
"hash": 6858432289720262000,
"line_mean": 30.7327586207,
"line_max": 88,
"alpha_frac": 0.6654891304,
"autogenerated": false,
"ratio": 3.873684210526316,
"config_test": ... |
from django import views
from django.shortcuts import render, redirect
from django.views import View
from django.views.generic import FormView
from chatApp.forms import RegistrationForm, LoginForm
from chatApp.models import ChatUser
from chatApp.services import UserService
class Registration(FormView):
form_class... | {
"repo_name": "Torkvamedo/smx",
"path": "project-chat/chatApp/views.py",
"copies": "1",
"size": "3037",
"license": "unlicense",
"hash": 8785914169434445000,
"line_mean": 38.9605263158,
"line_max": 95,
"alpha_frac": 0.6005926902,
"autogenerated": false,
"ratio": 4.19475138121547,
"config_test": ... |
from django_inlines.inlines import InlineBase, ModelInline
from core.models import User
class QuineInline(InlineBase):
"""
A simple inline that returns itself.
"""
def render(self):
bits = []
if self.variant:
bits.append(':%s' % self.variant)
else:
bits.... | {
"repo_name": "artscoop/django_inlines",
"path": "tests/core/tests/test_inlines.py",
"copies": "2",
"size": "1299",
"license": "bsd-3-clause",
"hash": -3711895576861383700,
"line_mean": 22.6181818182,
"line_max": 61,
"alpha_frac": 0.5427251732,
"autogenerated": false,
"ratio": 4.3156146179401995,... |
from django_inlines.inlines import TemplateInline, InlineUnrenderableError
from esv import esv, PassageNotFoundError, EsvQuotaExceededError
class InlineQuotaExceededError(InlineUnrenderableError):
pass
class InlinePassageNotFoundError(InlineUnrenderableError):
pass
class PassageInline(TemplateInline):
... | {
"repo_name": "mintchaos/django_esv",
"path": "esv/inlines.py",
"copies": "1",
"size": "1533",
"license": "bsd-3-clause",
"hash": 6072001464658833000,
"line_mean": 30.9375,
"line_max": 117,
"alpha_frac": 0.6464448793,
"autogenerated": false,
"ratio": 3.9612403100775193,
"config_test": false,
... |
from django_jalali import forms as jforms
from django.utils.translation import ugettext as _
from django import forms
from django.contrib.admin.widgets import AdminTimeWidget
from django.contrib.admin.templatetags.admin_static import static
from django.utils.safestring import mark_safe
class AdminjDateWidget(jforms.jD... | {
"repo_name": "pooyamb/djalali-bdp",
"path": "django_jalali/admin/widgets.py",
"copies": "1",
"size": "1621",
"license": "mit",
"hash": 2984302340599106000,
"line_mean": 40.5641025641,
"line_max": 97,
"alpha_frac": 0.6656384948,
"autogenerated": false,
"ratio": 3.675736961451247,
"config_test":... |
from django_jinja import library
from django.utils.safestring import mark_safe
@library.global_function
def updated_querystring(request, params):
"""Updates current querystring with a given dict of params, removing
existing occurrences of such params. Returns a urlencoded querystring."""
original_params =... | {
"repo_name": "devrand/declarations.com.ua",
"path": "declarations_site/catalog/templatetags/catalog.py",
"copies": "1",
"size": "3214",
"license": "mit",
"hash": 4600516772376676000,
"line_mean": 21.2977099237,
"line_max": 77,
"alpha_frac": 0.522766176,
"autogenerated": false,
"ratio": 2.9356783... |
from djangojy.db.backends.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated MySQL column
# types, as strings. Column-type strings can contain format strings; they'll
# be interpolated against the values of Field.__dic... | {
"repo_name": "rotoudjimaye/django-jy",
"path": "src/main/python/djangojy/db/backends/mysql/creation.py",
"copies": "1",
"size": "3066",
"license": "bsd-3-clause",
"hash": -5703441237864540000,
"line_mean": 45.4545454545,
"line_max": 99,
"alpha_frac": 0.5870841487,
"autogenerated": false,
"ratio"... |
from djangojy.db.backends import BaseDatabaseIntrospection
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type codes to Django Field types.
data_types_reverse = {
16: 'BooleanField',
20: 'BigIntegerField',
21: 'SmallIntegerField',
23: 'IntegerField',
25:... | {
"repo_name": "rotoudjimaye/django-jy",
"path": "src/main/python/djangojy/db/backends/postgresql/introspection.py",
"copies": "1",
"size": "4123",
"license": "bsd-3-clause",
"hash": 5731215004743146000,
"line_mean": 42.8617021277,
"line_max": 95,
"alpha_frac": 0.5818578705,
"autogenerated": false,
... |
from djangojy.db.backends import BaseDatabaseOperations
class DatabaseOperations(BaseDatabaseOperations):
def __init__(self, connection):
super(DatabaseOperations, self).__init__(connection)
def date_extract_sql(self, lookup_type, field_name):
# http://www.postgresql.org/docs/8.0/static/funct... | {
"repo_name": "rotoudjimaye/django-jy",
"path": "src/main/python/djangojy/db/backends/postgresql/operations.py",
"copies": "1",
"size": "8729",
"license": "bsd-3-clause",
"hash": 1095786458610396200,
"line_mean": 42.4278606965,
"line_max": 184,
"alpha_frac": 0.5721159354,
"autogenerated": false,
... |
from djangojy.db.backends import BaseDatabaseValidation
class DatabaseValidation(BaseDatabaseValidation):
def validate_field(self, errors, opts, f):
"""
There are some field length restrictions for MySQL:
- Prior to version 5.0.3, character fields could not exceed 255
characters ... | {
"repo_name": "rotoudjimaye/django-jy",
"path": "src/main/python/djangojy/db/backends/mysql/validation.py",
"copies": "1",
"size": "1343",
"license": "bsd-3-clause",
"hash": -5451106485503760000,
"line_mean": 48.7407407407,
"line_max": 170,
"alpha_frac": 0.5941921072,
"autogenerated": false,
"rat... |
from django_kala.functions import get_env_variable
# Django settings
EMAIL_BACKEND = get_env_variable('EMAIL_BACKEND', default='django.core.mail.backends.smtp.EmailBackend')
EMAIL_HOST = get_env_variable('EMAIL_HOST', 'localhost')
EMAIL_HOST_PASSWORD = get_env_variable('EMAIL_HOST_PASSWORD', default='')
EMAIL_HOST_USE... | {
"repo_name": "bgroff/kala-app",
"path": "django_kala/django_kala/settings/email.py",
"copies": "1",
"size": "1183",
"license": "mit",
"hash": 2574133555662853600,
"line_mean": 58.15,
"line_max": 104,
"alpha_frac": 0.753169907,
"autogenerated": false,
"ratio": 3.1546666666666665,
"config_test":... |
from django_kissmetrics.middleware import TrackingMiddleware
from django_lean.lean_analytics import IdentificationError
from django_lean.lean_analytics.base import BaseAnalytics
class KissMetrics(BaseAnalytics):
def __init__(self, KM=None, middleware=None):
if middleware is None:
self.middlew... | {
"repo_name": "uhuramedia/django-lean",
"path": "django_lean/lean_analytics/kissmetrics.py",
"copies": "2",
"size": "1326",
"license": "bsd-3-clause",
"hash": 2094490653442267600,
"line_mean": 33,
"line_max": 77,
"alpha_frac": 0.6447963801,
"autogenerated": false,
"ratio": 4.118012422360248,
"c... |
from django_lean.experiments.models import Participant
from django_lean.experiments.utils import WebUser
from django_lean.lean_analytics import IdentificationError
class BaseAnalytics(object):
def _id_from_session(self, session):
try:
return 'Session %s' % session.session_key
except At... | {
"repo_name": "uhuramedia/django-lean",
"path": "django_lean/lean_analytics/base.py",
"copies": "2",
"size": "1554",
"license": "bsd-3-clause",
"hash": -7693251756460936000,
"line_mean": 37.85,
"line_max": 78,
"alpha_frac": 0.6332046332,
"autogenerated": false,
"ratio": 4.365168539325842,
"conf... |
from django_lets_go.utils import BaseAuthenticatedClient
from frontend_notification.views import user_notification,\
notification_del_read, update_notification
class NotificationCustomerView(BaseAuthenticatedClient):
"""Test Function to check Notification pages"""
fixtures = ['auth_user.json', 'notificat... | {
"repo_name": "areski/django-frontend-notification",
"path": "frontend_notification/tests.py",
"copies": "1",
"size": "2227",
"license": "mit",
"hash": -2312008676379920000,
"line_mean": 36.7457627119,
"line_max": 68,
"alpha_frac": 0.6210148181,
"autogenerated": false,
"ratio": 4.401185770750988,... |
from django_lib.forms import LONGEST_CHAR_FIELD, LONGEST_PASS_FIELD, LONGEST_DESC, ReadOnlyWidget
from django import forms
BLOCKSIZE_MULTIPLIER = 1024 # Kilobytes
BLOCKSIZE_CHOICES = (
(10*BLOCKSIZE_MULTIPLIER, "10 kB"),
(20*BLOCKSIZE_MULTIPLIER, 20),
(40*BLOCKSIZE_MULTIPLIER, 40),
(80*BLOCKSIZE_MULTI... | {
"repo_name": "iychoi/syndicate",
"path": "old/ms/django_volume/forms.py",
"copies": "2",
"size": "3934",
"license": "apache-2.0",
"hash": 6879888104644555000,
"line_mean": 35.1009174312,
"line_max": 123,
"alpha_frac": 0.5149974581,
"autogenerated": false,
"ratio": 5.0114649681528665,
"config_t... |
from django_mailbox.models import Message
from batch_apps.models import Execution
from batch_apps.generator import get_current_date_in_gmt8
from batch_apps.matcher import match_email_subject_to_app
def execute_end_to_end_tasks(date_=get_current_date_in_gmt8()):
Execution.objects.generate_and_return_active_apps_ex... | {
"repo_name": "azam-a/batcher",
"path": "batch_apps/integration.py",
"copies": "1",
"size": "1488",
"license": "mit",
"hash": 3206362572604018700,
"line_mean": 35.2926829268,
"line_max": 78,
"alpha_frac": 0.5974462366,
"autogenerated": false,
"ratio": 4.239316239316239,
"config_test": false,
... |
from django_mako_plus.controller.router import get_renderer
from django.core.mail import EmailMultiAlternatives
import types, mimetypes
from lib.filters import *
from lib import get_fake_request, prepare_fake_meta
from homepage import models as hmod
from email.mime.base import MIMEBase
import lxml.html
############... | {
"repo_name": "lanesawyer/island",
"path": "lib/mailer.py",
"copies": "1",
"size": "4082",
"license": "apache-2.0",
"hash": -1109993831854367100,
"line_mean": 41.53125,
"line_max": 142,
"alpha_frac": 0.65311122,
"autogenerated": false,
"ratio": 3.9477756286266925,
"config_test": false,
"has_n... |
from django_mako_plus.controller.router import MakoTemplateRenderer
from django_mako_plus.controller import RedirectException
from django.dispatch import receiver
from django_cas_ng.signals import cas_user_authenticated
from homepage import models as hmod
from forum import models as fmod
##############################... | {
"repo_name": "lanesawyer/island",
"path": "homepage/views/__init__.py",
"copies": "1",
"size": "2462",
"license": "apache-2.0",
"hash": 5572319857778545000,
"line_mean": 30.987012987,
"line_max": 98,
"alpha_frac": 0.6697806661,
"autogenerated": false,
"ratio": 4.201365187713311,
"config_test":... |
from django_markup.filter import MarkupFilter
class MarkdownMarkupFilter(MarkupFilter):
"""
Applies Markdown conversion to a string, and returns the HTML. If the
pygments library is installed, it highlights code blocks with it.
"""
title = 'Markdown'
use_pygments = False
def __init__(self)... | {
"repo_name": "tisOO/django-markup",
"path": "src/django_markup/filter/markdown_filter.py",
"copies": "1",
"size": "2769",
"license": "bsd-3-clause",
"hash": 179636825536911520,
"line_mean": 34.961038961,
"line_max": 91,
"alpha_frac": 0.569158541,
"autogenerated": false,
"ratio": 4.28637770897832... |
from django_markup.filter import MarkupFilter
class MarkdownMarkupFilter(MarkupFilter):
"""
Applies Markdown conversion to a string, and returns the HTML.
"""
title = 'Markdown'
kwargs = {'safe_mode': True}
def render(self, text, **kwargs):
if kwargs:
self.kwargs.update(k... | {
"repo_name": "bartTC/django-markup",
"path": "django_markup/filter/markdown_filter.py",
"copies": "1",
"size": "1360",
"license": "bsd-3-clause",
"hash": 7283878840133193000,
"line_mean": 27.9361702128,
"line_max": 88,
"alpha_frac": 0.4705882353,
"autogenerated": false,
"ratio": 3.95348837209302... |
from djangomaster.conf import settings
from djangomaster.utils import get_module, is_signal
from djangomaster.views import MasterView
SIGNAL_MODULES = (
'django.core.signals',
'django.contrib.auth.signals',
'django.test.signals',
'django.db.models.signals',
'django.db.backends.signals',
'django... | {
"repo_name": "django-master/django-master",
"path": "djangomaster/master/signals.py",
"copies": "1",
"size": "2000",
"license": "mit",
"hash": -1151700487215765200,
"line_mean": 25.6666666667,
"line_max": 66,
"alpha_frac": 0.5895,
"autogenerated": false,
"ratio": 4.0241448692152915,
"config_te... |
from djangomaster.conf import settings
from djangomaster.views import MasterView
class MigrationsView(MasterView):
name = 'migrations'
label = 'Migrations'
title = 'Migrations'
template_name = 'djangomaster/sbadmin/pages/migrations.html'
def get_context_data(self, **kwargs):
context = sup... | {
"repo_name": "django-master/django-master",
"path": "djangomaster/master/migrations.py",
"copies": "1",
"size": "1418",
"license": "mit",
"hash": 2514904448374861000,
"line_mean": 27.36,
"line_max": 96,
"alpha_frac": 0.6304654443,
"autogenerated": false,
"ratio": 3.863760217983651,
"config_tes... |
from django_medusa.renderers import StaticSiteRenderer
from apps.mpm.models import Categoria, Musica, DiaLiturgico
class MusicaRenderer(StaticSiteRenderer):
def get_paths(self):
paths = []
items = Musica.objects.all().order_by('slug')
for item in items:
paths.append(item.get_ab... | {
"repo_name": "gustavofoa/pympm",
"path": "apps/mpm/renderers.py",
"copies": "1",
"size": "1092",
"license": "apache-2.0",
"hash": 5890121474481917000,
"line_mean": 29.3333333333,
"line_max": 86,
"alpha_frac": 0.6510989011,
"autogenerated": false,
"ratio": 3.580327868852459,
"config_test": fals... |
from django_medusa.renderers import StaticSiteRenderer
from . import models
class ArtFestivalRenderer(StaticSiteRenderer):
def get_paths(self):
paths = set()
paths.add('/artfestival/art/')
paths.add('/artfestival/artists/')
artists = models.Artist.objects.all()
# for artis... | {
"repo_name": "mykonosbiennale/mykonosbiennale.github.io",
"path": "festival/renderers.py",
"copies": "2",
"size": "1038",
"license": "apache-2.0",
"hash": 7877609001102151000,
"line_mean": 37.4814814815,
"line_max": 112,
"alpha_frac": 0.6290944123,
"autogenerated": false,
"ratio": 3.518644067796... |
from django_messages_framework import constants
from django_messages_framework.storage import default_storage
from django.utils.functional import lazy, memoize
__all__ = (
'add_message', 'get_messages',
'debug', 'info', 'success', 'warning', 'error',
)
class MessageFailure(Exception):
pass
def add_mess... | {
"repo_name": "none-da/zeshare",
"path": "django_messages_framework/api.py",
"copies": "1",
"size": "3546",
"license": "bsd-3-clause",
"hash": 680132662637670500,
"line_mean": 30.3805309735,
"line_max": 78,
"alpha_frac": 0.6455160745,
"autogenerated": false,
"ratio": 4.186540731995278,
"config_... |
from django_messages_framework.storage.base import BaseStorage
from django_messages_framework.storage.cookie import CookieStorage
from django_messages_framework.storage.session import SessionStorage
try:
set
except NameError:
from sets import Set as set # Python 2.3
class FallbackStorage(BaseStorage):
"... | {
"repo_name": "none-da/zeshare",
"path": "django_messages_framework/storage/fallback.py",
"copies": "1",
"size": "2256",
"license": "bsd-3-clause",
"hash": 2593158231823237000,
"line_mean": 37.2372881356,
"line_max": 78,
"alpha_frac": 0.6068262411,
"autogenerated": false,
"ratio": 4.8205128205128... |
from django_messages_framework.tests.base import BaseTest
from django_messages_framework.storage.session import SessionStorage
def set_session_data(storage, messages):
"""
Sets the messages into the backend request's session and remove the
backend's loaded data cache.
"""
storage.request.session[s... | {
"repo_name": "none-da/zeshare",
"path": "django_messages_framework/tests/session.py",
"copies": "1",
"size": "1234",
"license": "bsd-3-clause",
"hash": 7610236824908182000,
"line_mean": 31.4736842105,
"line_max": 71,
"alpha_frac": 0.6888168558,
"autogenerated": false,
"ratio": 4.21160409556314,
... |
from django_messaging.models import DmUser, DmMessage
from django.contrib.auth.models import User
#~ ========== init data ===========
#~ get data
users=User.objects.all()
dm_users=DmUser.objects.all()
#dm_messages=DmMessage.objects.all()
try:
#~ configure here the users you want to test with
username1='syntax_erro... | {
"repo_name": "PaulcyMboungou/django-messaging",
"path": "django_messaging/tests/utils.py",
"copies": "1",
"size": "1941",
"license": "bsd-3-clause",
"hash": -9018449802699131000,
"line_mean": 30.3064516129,
"line_max": 317,
"alpha_frac": 0.6676970634,
"autogenerated": false,
"ratio": 3.340791738... |
from django_mfa.models import *
from django.test import TestCase, Client
from django.contrib.auth.models import User
from django.contrib import auth
class Test_Models_Mfa_U2f(TestCase):
def setUp(self):
self.client = Client()
self.user = User.objects.create_user(
username='djangomfa@m... | {
"repo_name": "MicroPyramid/django-mfa",
"path": "django_mfa/tests/test_models.py",
"copies": "1",
"size": "2572",
"license": "mit",
"hash": 4764067850709473000,
"line_mean": 40.4838709677,
"line_max": 88,
"alpha_frac": 0.6644634526,
"autogenerated": false,
"ratio": 3.163591635916359,
"config_t... |
from django.middleware.cache import CacheMiddleware
from django.utils.cache import patch_response_headers, get_max_age
from models import FancyModel
from django.http import HttpResponse
from django.core import serializers
from cache.manager import cache_manager
def fancy_view(request):
cache_version = cache_manag... | {
"repo_name": "ff0000/scarlet",
"path": "samples/cache/functionview/views.py",
"copies": "1",
"size": "1681",
"license": "mit",
"hash": -3186018270902120000,
"line_mean": 33.306122449,
"line_max": 81,
"alpha_frac": 0.7144556811,
"autogenerated": false,
"ratio": 4.140394088669951,
"config_test":... |
from django.middleware.cache import UpdateCacheMiddleware, \
FetchFromCacheMiddleware
from django.utils.cache import get_max_age, patch_response_headers, \
learn_cache_key, get_cache_key
import datetime
import hashlib
import logging
logger = logging.getLogger(__name__)
class CustomUpdateCacheMiddleware(UpdateC... | {
"repo_name": "oracal/repowatcher",
"path": "repowatcher/main/middleware.py",
"copies": "1",
"size": "4028",
"license": "mit",
"hash": 4021541732417499600,
"line_mean": 40.112244898,
"line_max": 116,
"alpha_frac": 0.6089870904,
"autogenerated": false,
"ratio": 4.470588235294118,
"config_test": ... |
from django.middleware.common import CommonMiddleware
from django.conf import settings
from django.core import urlresolvers
from django.utils.http import urlquote
from django.utils import six
from django import http
class SlashRedirectMiddleware(CommonMiddleware):
def append_slash(self, request, host):
ol... | {
"repo_name": "MadeInHaus/django-template",
"path": "backend/apps/utils/slash_redirect_middleware.py",
"copies": "1",
"size": "2407",
"license": "mit",
"hash": -1194569500359423200,
"line_mean": 42,
"line_max": 84,
"alpha_frac": 0.5550477773,
"autogenerated": false,
"ratio": 4.3843351548269585,
... |
from django.middleware.common import CommonMiddleware
import urlparse
import time
class OpenTrainMiddleware(CommonMiddleware):
def process_response(self, request, response):
from django.db import connection
if hasattr(request,'prof_start_time'):
request.prof_end_time = time.time()
... | {
"repo_name": "oferb/OpenTrains",
"path": "webserver/opentrain/common/middleware.py",
"copies": "1",
"size": "1538",
"license": "bsd-3-clause",
"hash": -289611547103239100,
"line_mean": 38.4358974359,
"line_max": 92,
"alpha_frac": 0.5078023407,
"autogenerated": false,
"ratio": 4.882539682539683,
... |
from django.middleware.common import CommonMiddleware
import urlparse
import time
import logging
class OpenTrainMiddleware(CommonMiddleware):
def process_exception(self,request,exception):
error_logger = logging.getLogger('opentrain.errors')
error_logger.exception('exception in %s %s' % (request.met... | {
"repo_name": "hasadna/OpenTrain",
"path": "webserver/opentrain/common/middleware.py",
"copies": "1",
"size": "1311",
"license": "bsd-3-clause",
"hash": -7440675918751866000,
"line_mean": 37.5588235294,
"line_max": 91,
"alpha_frac": 0.5766590389,
"autogenerated": false,
"ratio": 4.715827338129497... |
from django.middleware.common import _is_ignorable_404
from sentry.client.models import get_client
import threading
import logging
class Sentry404CatchMiddleware(object):
def process_response(self, request, response):
if response.status_code != 404 or _is_ignorable_404(request.get_full_path()):
... | {
"repo_name": "tbarbugli/sentry_fork",
"path": "sentry/client/middleware.py",
"copies": "2",
"size": "1221",
"license": "bsd-3-clause",
"hash": 6492344467244774000,
"line_mean": 33.8857142857,
"line_max": 117,
"alpha_frac": 0.6912366912,
"autogenerated": false,
"ratio": 4.210344827586207,
"conf... |
from django.middleware.csrf import CsrfViewMiddleware, get_token
from django.utils.decorators import decorator_from_middleware, available_attrs
from functools import wraps
csrf_protect = decorator_from_middleware(CsrfViewMiddleware)
csrf_protect.__name__ = "csrf_protect"
csrf_protect.__doc__ = """
This decorator adds ... | {
"repo_name": "benjaminrigaud/django",
"path": "django/views/decorators/csrf.py",
"copies": "228",
"size": "2201",
"license": "bsd-3-clause",
"hash": 4792021209530969000,
"line_mean": 36.3050847458,
"line_max": 111,
"alpha_frac": 0.7328487051,
"autogenerated": false,
"ratio": 3.9657657657657657,
... |
from django.middleware.csrf import CsrfViewMiddleware
from django.utils.decorators import decorator_from_middleware, available_attrs
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.3, 2.4 fallback.
csrf_protect = decorator_from_middleware(CsrfViewMidd... | {
"repo_name": "t11e/django",
"path": "django/views/decorators/csrf.py",
"copies": "1",
"size": "1738",
"license": "bsd-3-clause",
"hash": 5921426900819827000,
"line_mean": 35.2083333333,
"line_max": 78,
"alpha_frac": 0.7105868815,
"autogenerated": false,
"ratio": 3.896860986547085,
"config_test... |
from django.middleware.csrf import CsrfViewMiddleware
from djrest import exceptions, constants
from djrest.basic.facet import cast, FacetRequiredError, FacetValidationError
from djrest.patches import JSONEncoder
class FacetMixin(object):
json_encoder = JSONEncoder
def cast(self, facet, data, many=False, **ca... | {
"repo_name": "zh012/djrest",
"path": "djrest/apis/mixins.py",
"copies": "1",
"size": "1768",
"license": "mit",
"hash": 5910022446012331000,
"line_mean": 37.4347826087,
"line_max": 100,
"alpha_frac": 0.6770361991,
"autogenerated": false,
"ratio": 4.130841121495327,
"config_test": false,
"has_... |
from django.middleware.csrf import CsrfViewMiddleware
from django.utils.decorators import decorator_from_middleware, available_attrs
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
csrf_protect = decorator_from_middleware(CsrfViewM... | {
"repo_name": "hunch/hunch-gift-app",
"path": "django/views/decorators/csrf.py",
"copies": "9",
"size": "2297",
"license": "mit",
"hash": 1329723712777435100,
"line_mean": 33.890625,
"line_max": 78,
"alpha_frac": 0.6983021332,
"autogenerated": false,
"ratio": 3.9535283993115318,
"config_test": ... |
from django.middleware.csrf import _get_new_csrf_key
import facebook
from .conf import settings
class DjangoFacebook(object):
""" Simple accessor object for the Facebook user. """
def __init__(self, user):
self.user = user
self.uid = user['uid']
self.graph = facebook.GraphAPI(user['ac... | {
"repo_name": "vstoykov/django4facebook",
"path": "django4facebook/utils.py",
"copies": "1",
"size": "2567",
"license": "mit",
"hash": -6986498595408099000,
"line_mean": 28.8488372093,
"line_max": 75,
"alpha_frac": 0.6166731593,
"autogenerated": false,
"ratio": 3.791728212703102,
"config_test":... |
from django.middleware.csrf import get_token
from django.template.backends.base import BaseEngine
from django.template.engine import _dirs_undefined
from ..client.template_client import TemplateClient
from django_jsx.template.engine import JsEngine
class JsTemplates(BaseEngine):
def __init__(self, params):
... | {
"repo_name": "OmegaDroid/django-jsx",
"path": "django_jsx/template/backend.py",
"copies": "2",
"size": "1189",
"license": "bsd-3-clause",
"hash": -6958623987124376000,
"line_mean": 32.9714285714,
"line_max": 80,
"alpha_frac": 0.6761984861,
"autogenerated": false,
"ratio": 4.016891891891892,
"c... |
from django.middleware.csrf import get_token
from django.template.loader import render_to_string
from django.http import HttpResponse, HttpResponseRedirect
from django.views.generic.base import (View, TemplateResponseMixin)
from django_modalview.generic.component import (ModalButton, GET_TEMPLATE,
... | {
"repo_name": "optiflows/django-modalview",
"path": "django_modalview/generic/base.py",
"copies": "1",
"size": "6954",
"license": "apache-2.0",
"hash": -7544396169946822000,
"line_mean": 33.2561576355,
"line_max": 82,
"alpha_frac": 0.5920333621,
"autogenerated": false,
"ratio": 4.284658040665434,... |
from django.middleware.csrf import rotate_token
from djara.django.auth.models import User
SESSION_KEY = '_auth_user_id'
def get_session_user(request):
"""
Returns the user model instance associated with the given request session.
If no user is retrieved an instance of `AnonymousUser` is returned.
"""... | {
"repo_name": "saeschdivara/ArangoDjango",
"path": "djara/django/auth/utils.py",
"copies": "1",
"size": "2203",
"license": "mit",
"hash": -2712018359818592000,
"line_mean": 26.8987341772,
"line_max": 85,
"alpha_frac": 0.6613708579,
"autogenerated": false,
"ratio": 4.345167652859961,
"config_tes... |
from django.middleware.csrf import rotate_token
from prosodyauth.models import User, AnonymousUser
from prosodyauth.prosody.backend import ProsodyBackend
SESSION_KEY = '_prosodyauth_user_id'
def login(request, user):
try:
user_id = request.session[SESSION_KEY]
if user.pk != user_id:
... | {
"repo_name": "Kromey/fbxnano",
"path": "prosodyauth/utils.py",
"copies": "2",
"size": "1032",
"license": "mit",
"hash": 8767554628849773000,
"line_mean": 23.5714285714,
"line_max": 86,
"alpha_frac": 0.6637596899,
"autogenerated": false,
"ratio": 3.8943396226415095,
"config_test": false,
"has... |
from django.middleware import csrf
from pretend import stub
from freezegun import freeze_time
from rest_framework.test import APIRequestFactory
from django_postcode_lookup import views
from django_postcode_lookup.backends.base import (
PostcodeLookupException, PostcodeLookupResult)
def test_valid_api_key():
... | {
"repo_name": "LabD/django-postcode-lookup",
"path": "tests/test_views.py",
"copies": "1",
"size": "2681",
"license": "mit",
"hash": -5540321208724283000,
"line_mean": 28.4615384615,
"line_max": 66,
"alpha_frac": 0.6329727714,
"autogenerated": false,
"ratio": 3.7132963988919667,
"config_test": ... |
from django.middleware.locale import LocaleMiddleware
from .errors import HttpResponseError
class AdminLocaleMiddleware(LocaleMiddleware):
ALLOWED_PATHS = [
'/admin',
]
def process_request(self, request):
if any(request.path.startswith(p) for p in self.ALLOWED_PATHS):
return ... | {
"repo_name": "apihackers/wapps",
"path": "wapps/middleware.py",
"copies": "1",
"size": "1075",
"license": "mit",
"hash": 8137336978467794000,
"line_mean": 28.8611111111,
"line_max": 119,
"alpha_frac": 0.6725581395,
"autogenerated": false,
"ratio": 4.215686274509804,
"config_test": false,
"ha... |
from django_mobileesp.utils import is_browser_agent, is_server_agent, \
get_user_agent_info
class Detector(object):
def __init__(self, first, other=False, op='or', detect=None):
self.first = first
self.other = other
self.op = op
self.detect = detect or self.mobileesp
... | {
"repo_name": "laginha/django-mobileesp",
"path": "src/django_mobileesp/detector.py",
"copies": "1",
"size": "1707",
"license": "mit",
"hash": 2685457764105789400,
"line_mean": 28.9473684211,
"line_max": 79,
"alpha_frac": 0.5823081429,
"autogenerated": false,
"ratio": 3.5936842105263156,
"confi... |
from djangomodel import DjangoModel
import json
locations = DjangoModel("sweetspot.models.Locations", ["locationCode"])
locations.addFilter("locationCode", "eq", "P-004958")
signs = DjangoModel("sweetspot.models.Signs", ["locationCode"])
signs.addFilter("FtFromCurb", "in", [9, 30])
#signs.addFilter("locationCode", "eq... | {
"repo_name": "psiCode/shoutserver",
"path": "mysite/djangomodel_test.py",
"copies": "1",
"size": "1724",
"license": "bsd-2-clause",
"hash": -2170666720550298000,
"line_mean": 35.6808510638,
"line_max": 106,
"alpha_frac": 0.6983758701,
"autogenerated": false,
"ratio": 3.334622823984526,
"config... |
from django.models.admin import log
from django.core import template
class AdminLogNode(template.Node):
def __init__(self, limit, varname, user):
self.limit, self.varname, self.user = limit, varname, user
def __repr__(self):
return "<GetAdminLog Node>"
def render(self, context):
i... | {
"repo_name": "tungvx/deploy",
"path": "Django-0.90/django/contrib/admin/templatetags/log.py",
"copies": "1",
"size": "2049",
"license": "apache-2.0",
"hash": 1841031486216782800,
"line_mean": 39.1764705882,
"line_max": 112,
"alpha_frac": 0.6349438751,
"autogenerated": false,
"ratio": 3.759633027... |
from django.models.auth import users
from django.core import formfields, validators
class AuthenticationForm(formfields.Manipulator):
"""
Base class for authenticating users. Extend this to get a form that accepts
username/password logins.
"""
def __init__(self, request=None):
"""
I... | {
"repo_name": "tungvx/deploy",
"path": "Django-0.90/django/parts/auth/formfields.py",
"copies": "1",
"size": "2109",
"license": "apache-2.0",
"hash": -8885497092036252000,
"line_mean": 44.847826087,
"line_max": 141,
"alpha_frac": 0.6766239924,
"autogenerated": false,
"ratio": 4.32172131147541,
... |
from django.models.redirects import redirects
from django.utils import httpwrappers
from django.conf.settings import APPEND_SLASH, SITE_ID
class RedirectFallbackMiddleware:
def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a re... | {
"repo_name": "tungvx/deploy",
"path": "Django-0.90/django/contrib/redirects/middleware.py",
"copies": "1",
"size": "1129",
"license": "apache-2.0",
"hash": -3028965921160397300,
"line_mean": 40.8148148148,
"line_max": 84,
"alpha_frac": 0.6147032772,
"autogenerated": false,
"ratio": 4.44488188976... |
#from django_mongodb_engine.storage import GridFSStorage
from django_mongodb_engine.fields import GridFSField
from django.db import models
#from django.contrib.contenttypes.models import ContentType
#from djangotoolbox import *
from djangotoolbox.fields import ListField, EmbeddedModelField,DictField
from django_mongod... | {
"repo_name": "gianpaima/favorless",
"path": "favor/votos/models.py",
"copies": "1",
"size": "2992",
"license": "mit",
"hash": -5516700719904612000,
"line_mean": 37.3717948718,
"line_max": 130,
"alpha_frac": 0.7005347594,
"autogenerated": false,
"ratio": 3.152792413066386,
"config_test": false,... |
from django_mongo_rest.models import BaseModel, ModelPermissionException
from django_mongo_rest.validation import date_str_validator
from django_mongoengine.mongo_auth.models import AbstractUser
from mongoengine import (StringField, IntField, ReferenceField, EmbeddedDocument, EmbeddedDocumentListField,
... | {
"repo_name": "TrueSkills/django-mongo-rest",
"path": "tests/server/models.py",
"copies": "1",
"size": "2599",
"license": "mit",
"hash": -6012502032733145000,
"line_mean": 36.1285714286,
"line_max": 108,
"alpha_frac": 0.6868026164,
"autogenerated": false,
"ratio": 4.0046224961479195,
"config_te... |
from django_mongo_rest.models import BaseModel
from django_mongo_rest.utils import Enum
from django_mongoengine.mongo_auth.managers import get_user_document
from mongoengine import DynamicDocument, StringField, ReferenceField, ObjectIdField
class ACTIONS(Enum):
CREATE = 'C'
UPDATE = 'U'
DELETE = 'D'
class... | {
"repo_name": "TrueSkills/django-mongo-rest",
"path": "django_mongo_rest/audit.py",
"copies": "1",
"size": "1126",
"license": "mit",
"hash": 6430615571016957000,
"line_mean": 28.6315789474,
"line_max": 83,
"alpha_frac": 0.6651865009,
"autogenerated": false,
"ratio": 3.51875,
"config_test": fals... |
from django_mptt_admin.admin import DjangoMpttAdmin
from django.contrib import admin
from tabbed_admin import TabbedModelAdmin
from grappelli_autocomplete_fk_edit_link import AutocompleteEditLinkAdminMixin
from reversion.admin import VersionAdmin
from billingapp.models import FinancialAccountCategory, FinancialAccoun... | {
"repo_name": "bittssystem/version3",
"path": "billingapp/admin.py",
"copies": "1",
"size": "1541",
"license": "mit",
"hash": 2288176697408904400,
"line_mean": 30.4489795918,
"line_max": 116,
"alpha_frac": 0.7774172615,
"autogenerated": false,
"ratio": 3.8143564356435644,
"config_test": false,
... |
# From Django
from django.core.urlresolvers import reverse
# Rest Framework Imports
from rest_framework import serializers
from rest_framework import viewsets
from rest_framework.decorators import detail_route, api_view, list_route
from rest_framework.response import Response
#Local Imports
import contacts.models as ... | {
"repo_name": "tperrier/mwachx",
"path": "contacts/serializers/misc.py",
"copies": "2",
"size": "4070",
"license": "apache-2.0",
"hash": -7208376419628184000,
"line_mean": 36.3394495413,
"line_max": 101,
"alpha_frac": 0.6781326781,
"autogenerated": false,
"ratio": 4.334398296059638,
"config_tes... |
from django_north.management import migrations
from django_north.management.commands import runserver
def test_runserver_check_migrations(
capsys,
mocker,
):
mock_plan = mocker.patch(
'septentrion.core.build_migration_plan')
# DBException raised
command = runserver.Command()
m... | {
"repo_name": "novafloss/django-north",
"path": "tests/test_runserver_command.py",
"copies": "1",
"size": "2393",
"license": "mit",
"hash": 1589237332502207000,
"line_mean": 29.6794871795,
"line_max": 74,
"alpha_frac": 0.5620559967,
"autogenerated": false,
"ratio": 3.792393026941363,
"config_te... |
from django_nose.tools import assert_equal, assert_false, assert_is_none, assert_true
from pontoon.base.tests import ProjectFactory, RepositoryFactory, TestCase
from pontoon.base.utils import aware_datetime
from pontoon.sync.models import ProjectSyncLog
from pontoon.sync.tests import (
ProjectSyncLogFactory,
R... | {
"repo_name": "participedia/pontoon",
"path": "pontoon/sync/tests/test_models.py",
"copies": "2",
"size": "6478",
"license": "bsd-3-clause",
"hash": 5141499698476020000,
"line_mean": 35.8068181818,
"line_max": 86,
"alpha_frac": 0.6253473294,
"autogenerated": false,
"ratio": 4.008663366336633,
"... |
from django_nose.tools import assert_equal
from mock import patch
from pontoon.base.models import Locale
from pontoon.base.tests import (
LocaleFactory,
ProjectFactory,
ResourceFactory,
TranslationFactory,
TranslatedResourceFactory,
)
from pontoon.base.tests.test_views import ViewTestCase
from pont... | {
"repo_name": "participedia/pontoon",
"path": "pontoon/localizations/tests.py",
"copies": "1",
"size": "3628",
"license": "bsd-3-clause",
"hash": -3214044605991355000,
"line_mean": 39.3111111111,
"line_max": 106,
"alpha_frac": 0.4608599779,
"autogenerated": false,
"ratio": 4.818061088977424,
"c... |
from django_nose.tools import assert_false, assert_true
from pontoon.base.models import ProjectLocale
from pontoon.base.tests import (
ProjectFactory,
ProjectLocaleFactory,
LocaleFactory,
TestCase,
TranslationFactory,
)
class SignalTests(TestCase):
def test_project_locale_added(self):
... | {
"repo_name": "sudheesh001/pontoon",
"path": "pontoon/base/tests/test_signals.py",
"copies": "1",
"size": "1469",
"license": "bsd-3-clause",
"hash": -752563435420772900,
"line_mean": 30.9347826087,
"line_max": 82,
"alpha_frac": 0.6657590197,
"autogenerated": false,
"ratio": 4.346153846153846,
"... |
from django_nose.tools import (
assert_equal,
assert_false,
assert_not_in,
assert_raises,
assert_true
)
from mock import Mock, MagicMock, patch
from pontoon.base.models import Entity
from pontoon.base.tests import (
assert_attributes_equal,
TranslationFactory,
UserFactory,
)
from pontoo... | {
"repo_name": "mastizada/pontoon",
"path": "pontoon/sync/tests/test_changeset.py",
"copies": "1",
"size": "19842",
"license": "bsd-3-clause",
"hash": -6972775180360286000,
"line_mean": 34.1185840708,
"line_max": 99,
"alpha_frac": 0.6101703457,
"autogenerated": false,
"ratio": 4.173748422381153,
... |
from django_notify.tests.base import BaseTest
from django_notify.storage.session import SessionStorage
def set_session_data(storage, messages):
"""
Set the messages into the backend request's session and remove the
backend's loaded data cache.
"""
storage.request.session[storage.session_key] ... | {
"repo_name": "Ksynko/django-crm",
"path": "sample_project/external_apps/django_notify/tests/session.py",
"copies": "3",
"size": "1213",
"license": "bsd-3-clause",
"hash": -8905728740638951000,
"line_mean": 30.9210526316,
"line_max": 70,
"alpha_frac": 0.681780709,
"autogenerated": false,
"ratio":... |
from django.parts.auth.formfields import AuthenticationForm
from django.core import formfields
from django.core.extensions import DjangoContext, render_to_response
from django.models.auth import users
from django.models.core import sites
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect
REDIRECT... | {
"repo_name": "tungvx/deploy",
"path": "Django-0.90/django/views/auth/login.py",
"copies": "1",
"size": "2131",
"license": "apache-2.0",
"hash": 4262826380804537300,
"line_mean": 43.3958333333,
"line_max": 101,
"alpha_frac": 0.7024870953,
"autogenerated": false,
"ratio": 4.098076923076923,
"con... |
from django_pgviews import view as pg
from django.contrib.gis.db import models
class ParcelQuerySet(models.QuerySet):
def containing(self, point):
return self.filter(shape__contains=point)
class Parcel(models.Model):
gid = models.AutoField(primary_key=True)
shape_leng = models.DecimalField(
... | {
"repo_name": "cityofsomerville/cornerwise",
"path": "server/parcel/models.py",
"copies": "3",
"size": "3135",
"license": "mit",
"hash": 5391342520597237000,
"line_mean": 34.2247191011,
"line_max": 82,
"alpha_frac": 0.6695374801,
"autogenerated": false,
"ratio": 3.5304054054054053,
"config_test... |
from djangopress.blog.models import Blog, Entry
from django.shortcuts import get_object_or_404
from django.contrib.syndication.views import Feed
from django.urls import reverse
from django.utils.feedgenerator import Atom1Feed
class BlogFeed(Feed):
def get_object(self, request, blog_slug=None):
return get_... | {
"repo_name": "codefisher/djangopress",
"path": "djangopress/blog/feeds.py",
"copies": "1",
"size": "1259",
"license": "mit",
"hash": -2578213128664675300,
"line_mean": 24.7142857143,
"line_max": 68,
"alpha_frac": 0.6616362192,
"autogenerated": false,
"ratio": 3.8267477203647418,
"config_test":... |
from djangopress.forum.models import Post, ForumGroup, Forum
from djangopress.forum.templatetags.forum_tags import format_post
from djangopress.forum.views import get_forum
from django.shortcuts import get_object_or_404
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
... | {
"repo_name": "codefisher/djangopress",
"path": "djangopress/forum/feeds.py",
"copies": "1",
"size": "2247",
"license": "mit",
"hash": 977476612722788900,
"line_mean": 29.3783783784,
"line_max": 118,
"alpha_frac": 0.6666666667,
"autogenerated": false,
"ratio": 3.6183574879227054,
"config_test":... |
from djangopress.menus.menu import register
from django.template import Template, RequestContext
from django.urls import reverse
class LoginRender(object):
def __init__(self):
self._members = Template("""
<li><a href="{% url 'accounts-profile' %}">Members</a>
<ul>
... | {
"repo_name": "codefisher/djangopress",
"path": "djangopress/accounts/menus.py",
"copies": "1",
"size": "1165",
"license": "mit",
"hash": -5298869993011078000,
"line_mean": 43.8461538462,
"line_max": 125,
"alpha_frac": 0.5510729614,
"autogenerated": false,
"ratio": 3.9225589225589226,
"config_t... |
from djangopress.menus.menu import register
from django.template import Template, RequestContext
from .models import GallerySection
class GalleryRender(object):
_menu = Template("""
<ul{% if menu.class_tag%} class="{{ menu.class_tag }}"{% endif %}{% if menu.name %} id="{{ menu.name }}"{% endif %}>
... | {
"repo_name": "codefisher/djangopress",
"path": "djangopress/gallery/menus.py",
"copies": "1",
"size": "1696",
"license": "mit",
"hash": -3541665410277006000,
"line_mean": 43.6578947368,
"line_max": 135,
"alpha_frac": 0.5294811321,
"autogenerated": false,
"ratio": 3.8545454545454545,
"config_te... |
from djangopress.menus.menu import register
from django.template import Template, RequestContext
class ListRender(object):
_menu = Template("""
{% load display_menu %}
<ul{% if menu.class_tag%} class="{{ menu.class_tag }}"{% endif %}{% if menu.name %} id="{{ menu.name }}"{% endif %}>
{%... | {
"repo_name": "codefisher/djangopress",
"path": "djangopress/menus/menus.py",
"copies": "1",
"size": "2719",
"license": "mit",
"hash": 5999931912129355000,
"line_mean": 44.3333333333,
"line_max": 135,
"alpha_frac": 0.5292386907,
"autogenerated": false,
"ratio": 3.8403954802259888,
"config_test"... |
from django_prometheus.cache.metrics import (
django_cache_get_fail_total,
django_cache_get_total,
django_cache_hits_total,
django_cache_misses_total,
)
from django_redis import cache, exceptions
class RedisCache(cache.RedisCache):
"""Inherit redis to add metrics about hit/miss/interruption ratio"... | {
"repo_name": "korfuri/django-prometheus",
"path": "django_prometheus/cache/backends/redis.py",
"copies": "1",
"size": "1160",
"license": "apache-2.0",
"hash": 5284932165443489000,
"line_mean": 36.4193548387,
"line_max": 87,
"alpha_frac": 0.6120689655,
"autogenerated": false,
"ratio": 4.172661870... |
from django_prometheus.db import (
connection_errors_total,
connections_total,
errors_total,
execute_many_total,
execute_total,
query_duration_seconds,
)
class ExceptionCounterByType:
"""A context manager that counts exceptions by type.
Exceptions increment the provided counter, whose... | {
"repo_name": "korfuri/django-prometheus",
"path": "django_prometheus/db/common.py",
"copies": "1",
"size": "2755",
"license": "apache-2.0",
"hash": 2811491868363105300,
"line_mean": 33.012345679,
"line_max": 86,
"alpha_frac": 0.6275862069,
"autogenerated": false,
"ratio": 4.174242424242424,
"c... |
from django_prometheus.db import (
connections_total, execute_total, execute_many_total, errors_total,
connection_errors_total)
class ExceptionCounterByType(object):
"""A context manager that counts exceptions by type.
Exceptions increment the provided counter, whose last label's name
must match ... | {
"repo_name": "cloudera/hue",
"path": "desktop/core/ext-py/django-prometheus-1.0.15/django_prometheus/db/common.py",
"copies": "3",
"size": "2657",
"license": "apache-2.0",
"hash": 4346406402106438700,
"line_mean": 35.9027777778,
"line_max": 74,
"alpha_frac": 0.6289047798,
"autogenerated": false,
... |
from django_prometheus.testutils import PrometheusTestCaseMixin
from django.test import TestCase
from django.db import connections
class TestDbMetrics(PrometheusTestCaseMixin, TestCase):
"""Test django_prometheus.db metrics.
Note regarding the values of metrics: many tests interact with the
database, and... | {
"repo_name": "wangwanzhong/django-prometheus",
"path": "tests/end2end/testapp/test_db.py",
"copies": "2",
"size": "2605",
"license": "apache-2.0",
"hash": -1244638061060476400,
"line_mean": 39.0769230769,
"line_max": 76,
"alpha_frac": 0.6222648752,
"autogenerated": false,
"ratio": 4.007692307692... |
from django_propeller.card import Card, CardHeader, CardActions, CardMediaActions, CardTitle, CardSubtitle, \
CardMediaImage, CardBody, CardMedia
from django_propeller.components import Image, Button, FAB
class DemoTitle1(CardTitle):
text = "Title goes here"
size = 2
class DemoHeaderTitle1(CardTitle):
... | {
"repo_name": "tfroehlich82/django-propeller",
"path": "django_propeller_demo/cards.py",
"copies": "1",
"size": "2279",
"license": "mit",
"hash": -7072561706347581000,
"line_mean": 25.1954022989,
"line_max": 119,
"alpha_frac": 0.6840719614,
"autogenerated": false,
"ratio": 3.495398773006135,
"c... |
from django_propeller.navbar import NavBar, NavBarLinkItem, NavBarDropDownItem, NavBarDropDownDivider
class MainNavBar(NavBar):
brandname = "django-propeller"
brandurl = "https://github.com/tfroehlich82/django-propeller"
items = [
NavBarLinkItem("Home", "home"),
NavBarLinkItem("Typography"... | {
"repo_name": "tfroehlich82/django-propeller",
"path": "django_propeller_demo/navbars.py",
"copies": "1",
"size": "1601",
"license": "mit",
"hash": 8656131334584252000,
"line_mean": 33.8043478261,
"line_max": 101,
"alpha_frac": 0.6171143036,
"autogenerated": false,
"ratio": 3.58165548098434,
"c... |
from django_pyowm import models
from rest_framework import serializers
from weather_api.core.serializers import RawJSONField
class WeatherSerializer(serializers.ModelSerializer):
rain = RawJSONField()
snow = RawJSONField()
wind = RawJSONField()
pressure = RawJSONField()
temperature = RawJSONField... | {
"repo_name": "dimka2014/weather-api",
"path": "weather_api/weather/serializers.py",
"copies": "1",
"size": "1063",
"license": "mit",
"hash": -6751869308829447000,
"line_mean": 31.2121212121,
"line_max": 112,
"alpha_frac": 0.665098777,
"autogenerated": false,
"ratio": 4.104247104247104,
"config... |
from django_q.tasks import async
from rest_framework import serializers
from torrents.models import Remote, Local
class RemoteSerializer(serializers.ModelSerializer):
local = serializers.SlugRelatedField(many=False,
read_only=True,
... | {
"repo_name": "ReanGD/web-home-manage",
"path": "backend/torrents/serializers.py",
"copies": "1",
"size": "1272",
"license": "apache-2.0",
"hash": -5277014848006573000,
"line_mean": 33.3783783784,
"line_max": 101,
"alpha_frac": 0.5856918239,
"autogenerated": false,
"ratio": 4.311864406779661,
"... |
from djangoreactredux.settings.base import * # NOQA (ignore all errors on this line)
DEBUG = True
PAGE_CACHE_SECONDS = 1
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite'), # NOQA (ignore all errors on this line)
}
}
REST_FRAMEWO... | {
"repo_name": "Seedstars/django-react-redux-jwt-base",
"path": "src/djangoreactredux/settings/dev.py",
"copies": "4",
"size": "1458",
"license": "mit",
"hash": 6683214886838170000,
"line_mean": 25.5090909091,
"line_max": 131,
"alpha_frac": 0.5438957476,
"autogenerated": false,
"ratio": 3.71938775... |
from django_redis import cache, exceptions
from django_prometheus.cache.metrics import (
django_cache_get_fail_total,
django_cache_get_total,
django_cache_hits_total,
django_cache_misses_total,
)
class RedisCache(cache.RedisCache):
"""Inherit redis to add metrics about hit/miss/interruption ratio... | {
"repo_name": "kawamon/hue",
"path": "desktop/core/ext-py/django-prometheus-1.0.15/django_prometheus/cache/backends/redis.py",
"copies": "2",
"size": "1268",
"license": "apache-2.0",
"hash": -1055043807842865900,
"line_mean": 34.2222222222,
"line_max": 79,
"alpha_frac": 0.5930599369,
"autogenerated... |
from django_redis import get_redis_connection
from django.db import models
from django.utils.translation import ugettext as _
from dash.orgs.models import Org, OrgBackend
from dash.utils.sync import BaseSyncer
class Contact(models.Model):
org = models.ForeignKey(Org, on_delete=models.PROTECT)
uuid = models... | {
"repo_name": "rapidpro/dash",
"path": "test_runner/testapp/models.py",
"copies": "1",
"size": "1276",
"license": "bsd-3-clause",
"hash": -9074284113346885000,
"line_mean": 26.1489361702,
"line_max": 93,
"alpha_frac": 0.6622257053,
"autogenerated": false,
"ratio": 3.808955223880597,
"config_tes... |
from django_reputation.models import ReputationAction, Reputation
from django.db.models.signals import post_save, post_delete
from django_qa.signals import answer_accepted
class BaseReputationHandler(object):
"""
Default handler for creating ModelHistory objects.
"""
def __init__(self, content_typ... | {
"repo_name": "stripathi669/django-reputation",
"path": "django_reputation/handlers.py",
"copies": "1",
"size": "3166",
"license": "mit",
"hash": -2681386564762619400,
"line_mean": 34.9886363636,
"line_max": 116,
"alpha_frac": 0.5679090335,
"autogenerated": false,
"ratio": 4.446629213483146,
"c... |
from django_reputation.models import Reputation, ReputationContent
import django_reputation.handlers as handlers
from django.contrib.auth.models import User
from django.db.models.signals import post_save
class InitReputation(object):
def __init__(self):
post_save.connect(self._post_save_signal_callback, se... | {
"repo_name": "stripathi669/django-reputation",
"path": "django_reputation/reputation.py",
"copies": "1",
"size": "2137",
"license": "mit",
"hash": -7394320632249520000,
"line_mean": 37.8727272727,
"line_max": 87,
"alpha_frac": 0.6176883482,
"autogenerated": false,
"ratio": 4.206692913385827,
"... |
from djangorestframework import mixins
from djangorestframework import parsers
from djangorestframework import renderers
from djangorestframework import resources
from djangorestframework import views
from . import models
class UncachedMixin (object):
def final(self, request, response, *args, **kwargs):
r... | {
"repo_name": "openplans/streetscore",
"path": "street_score/project/resources.py",
"copies": "1",
"size": "4078",
"license": "mit",
"hash": -5752373957886264000,
"line_mean": 32.7024793388,
"line_max": 89,
"alpha_frac": 0.6844041197,
"autogenerated": false,
"ratio": 4.069860279441118,
"config_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.