text
stringlengths
0
1.05M
meta
dict
from django import template from django.core.urlresolvers import reverse from django.template.loader import render_to_string from django.contrib.contenttypes.models import ContentType from types import ListType,TupleType from xformmanager.models import * import xformmanager.adapter.querytools as qtools fro...
{ "repo_name": "commtrack/temp-aquatest", "path": "apps/hq/templatetags/dashboard_tags.py", "copies": "1", "size": "7874", "license": "bsd-3-clause", "hash": 3219566527229440000, "line_mean": 41.0382513661, "line_max": 169, "alpha_frac": 0.5665481331, "autogenerated": false, "ratio": 3.92131474103...
from django import template from django.template.defaulttags import url, URLNode from django.template import Node from ..models import Menu, MenuItem from ..config import APP_LABEL register = template.Library() def show_menu(context, menu_name, menu_type=None): menu = Menu.objects.get(name=menu...
{ "repo_name": "chronossc/django-treemenus", "path": "treemenus/templatetags/tree_menu_tags.py", "copies": "1", "size": "1753", "license": "bsd-3-clause", "hash": 3722625745585967600, "line_mean": 29.3035714286, "line_max": 91, "alpha_frac": 0.6446092413, "autogenerated": false, "ratio": 3.8026030...
from django import template from django.template.defaulttags import url, URLNode from django.template import Node from treemenus.models import Menu, MenuItem from treemenus.config import APP_LABEL register = template.Library() def show_menu(context, menu_name, menu_type=None): menu = Menu.objec...
{ "repo_name": "fitoria/django-treemenus", "path": "treemenus/templatetags/tree_menu_tags.py", "copies": "1", "size": "1807", "license": "bsd-3-clause", "hash": -28289656565625216, "line_mean": 29.701754386, "line_max": 91, "alpha_frac": 0.6480354178, "autogenerated": false, "ratio": 3.79621848739...
from django import template from joyride import settings from joyride.utils import absolute_url from joyride.models import JoyRide register = template.Library() def get_joyride_context(): context = { 'JOYRIDE_CSS_URL': absolute_url('joyride/css/joyride-2.1.min.css'), } if settin...
{ "repo_name": "intellisense/django-joyride", "path": "joyride/templatetags/joyride_tags.py", "copies": "1", "size": "3236", "license": "mit", "hash": 4334913730102999000, "line_mean": 37.950617284, "line_max": 114, "alpha_frac": 0.7141532756, "autogenerated": false, "ratio": 3.117533718689788, ...
from django import template from task.models import Execution register = template.Library() icons_mapping = { "dashboard": "dashboard", "application": "desktop", "environment": "sitemap", "server": "puzzle-piece", "serverrole": "tags", "task": "tasks", "execution": "bars", ...
{ "repo_name": "senkal/gunnery", "path": "gunnery/core/templatetags/core_extras.py", "copies": "2", "size": "1434", "license": "apache-2.0", "hash": 2382725292927546000, "line_mean": 25.6153846154, "line_max": 114, "alpha_frac": 0.5955369596, "autogenerated": false, "ratio": 3.5671641791044775, ...
from django import template register = template.Library() ACTIVE_TAB_NAME = 'ACTIVETABS' DEFAULT_NAMESPACE = 'default' def get_active_tabs(context): active_tabs = template.Variable(ACTIVE_TAB_NAME) try: return active_tabs.resolve(context) except template.VariableDoesNotExist: ...
{ "repo_name": "sivas2811/mocha_739", "path": "mocha/mocha_models/templatetags/tabs.py", "copies": "1", "size": "3483", "license": "unlicense", "hash": -7399984326507931000, "line_mean": 29.6636363636, "line_max": 76, "alpha_frac": 0.6055124892, "autogenerated": false, "ratio": 4.242387332521315, ...
from django import template register = template.Library() def paginator(context, adjacent_pages=2): """ To be used in conjunction with the object_list generic view. Adds pagination context variables for use in displaying first, adjacent and last page links in addition to those created by the...
{ "repo_name": "xflows/clowdflows-backend", "path": "workflows/templatetags/paginator.py", "copies": "8", "size": "2353", "license": "mit", "hash": 6180941112776123000, "line_mean": 30.2602739726, "line_max": 79, "alpha_frac": 0.5690607735, "autogenerated": false, "ratio": 3.688087774294671, "co...
from django import template register = template.Library() def prepopulated_fields_js(context): """ Creates a list of prepopulated_fields that should render Javascript for the prepopulated fields for both the admin form and inlines. """ prepopulated_fields = [] if context['add'] and '...
{ "repo_name": "greggian/TapdIn", "path": "django/contrib/admin/templatetags/admin_modify.py", "copies": "1", "size": "1882", "license": "apache-2.0", "hash": -2578529832176101000, "line_mean": 46.2564102564, "line_max": 128, "alpha_frac": 0.6365568544, "autogenerated": false, "ratio": 4.012793176...
from django import template register = template.Library() class RepeatNode(template.Node): def __init__(self, nodelist, count): self.nodelist = nodelist self.count = template.Variable(count) def render(self, context): output = self.nodelist.render(context) ret...
{ "repo_name": "DeppSRL/open_bilanci", "path": "bilanci_project/bilanci/templatetags/repeat.py", "copies": "1", "size": "1038", "license": "mit", "hash": -2824982637361980400, "line_mean": 23.95, "line_max": 83, "alpha_frac": 0.6069364162, "autogenerated": false, "ratio": 4.398305084745763, "con...
from django import template register = template.Library() @register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True) def prepopulated_fields_js(context): """ Creates a list of prepopulated_fields that should render Javascript for the prepopulated fields for both the admin f...
{ "repo_name": "diego-d5000/MisValesMd", "path": "env/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_modify.py", "copies": "1", "size": "2419", "license": "mit", "hash": -8967684211466451000, "line_mean": 34.6515151515, "line_max": 85, "alpha_frac": 0.6176105829, "autogenerated"...
from django import template register = template.Library() @register.inclusion_tag('fretboard/includes/paginator.html', takes_context=True) def paginator(context, adjacent_pages=2): """ To be used in conjunction with the object_list generic view. Adds pagination context variables for use in displ...
{ "repo_name": "tBaxter/django-fretboard", "path": "fretboard/templatetags/paginator.py", "copies": "1", "size": "1476", "license": "mit", "hash": -3466083708821328400, "line_mean": 34, "line_max": 91, "alpha_frac": 0.6056910569, "autogenerated": false, "ratio": 3.9151193633952253, "config_test"...
from django import template register = template.Library() @register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True) def prepopulated_fields_js(context): """ Creates a list of prepopulated_fields that should render Javascript for the prepopulated fields for both the admin form and i...
{ "repo_name": "letouriste001/SmartForest_2.0", "path": "python3.4Smartforest/lib/python3.4/site-packages/django/contrib/admin/templatetags/admin_modify.py", "copies": "1", "size": "2505", "license": "mit", "hash": 6695514929941213000, "line_mean": 35.8382352941, "line_max": 111, "alpha_frac": 0.63952...
from django import template, templatetags from django.template import RequestContext from django.conf import settings from django.contrib.admin.views.decorators import staff_member_required from django.db import models from django.shortcuts import render_to_response from django.core.exceptions import ImproperlyConfigur...
{ "repo_name": "diofeher/django-nfa", "path": "django/contrib/admindocs/views.py", "copies": "3", "size": "15357", "license": "bsd-3-clause", "hash": 7558234058202509000, "line_mean": 40.7309782609, "line_max": 180, "alpha_frac": 0.5870287165, "autogenerated": false, "ratio": 4.021209740769835, ...
from django import template, templatetags from django.template import RequestContext from django.conf import settings from django.contrib.admin.views.decorators import staff_member_required from django.db import models from django.shortcuts import render_to_response from django.core.exceptions import ImproperlyCo...
{ "repo_name": "greggian/TapdIn", "path": "django/contrib/admindocs/views.py", "copies": "1", "size": "17267", "license": "apache-2.0", "hash": 105124711033228340, "line_mean": 40.217603912, "line_max": 180, "alpha_frac": 0.5708577054, "autogenerated": false, "ratio": 4.045688847235239, "config_...
from django import template, VERSION as django_version from django.conf import settings from django.utils.safestring import mark_safe from philo.contrib.shipherd.models import Navigation from philo.models import Node from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ regi...
{ "repo_name": "ithinksw/philo", "path": "philo/contrib/shipherd/templatetags/shipherd.py", "copies": "1", "size": "6398", "license": "isc", "hash": -2679359787468562400, "line_mean": 35.3579545455, "line_max": 326, "alpha_frac": 0.642700844, "autogenerated": false, "ratio": 3.698265895953757, "...
from django import template, VERSION from django.conf import settings from django.utils.safestring import mark_safe from .. import utils register = template.Library() @register.simple_tag def render_bundle(bundle_name, extension=None, config='DEFAULT', attrs=''): tags = utils.get_as_tags(bundle_name, extension=...
{ "repo_name": "ezhome/django-webpack-loader", "path": "webpack_loader/templatetags/webpack_loader.py", "copies": "5", "size": "1187", "license": "mit", "hash": 4344112024455690000, "line_mean": 31.9722222222, "line_max": 90, "alpha_frac": 0.7186183656, "autogenerated": false, "ratio": 3.732704402...
from django import template, VERSION from django.template.loader import get_template register = template.Library() if VERSION[:3] >= (1, 8, 0): from django.template.base import FilterExpression else: from django.template import FilterExpression def _setup_macros_dict(parser): # Metadata of each macro ar...
{ "repo_name": "twidi/django-templates-macros", "path": "macros/templatetags/macros.py", "copies": "1", "size": "5177", "license": "mit", "hash": 418488731756102660, "line_mean": 31.35625, "line_max": 82, "alpha_frac": 0.6049835812, "autogenerated": false, "ratio": 3.9976833976833976, "config_te...
from django import template, VERSION from django.template.loader import get_template if VERSION[:3] >= (1, 8, 0): from django.template.base import FilterExpression else: from django.template import FilterExpression register = template.Library() def _setup_macros_dict(parser): # Metadata of e...
{ "repo_name": "wolfhechel/django-templates-macros", "path": "macros/templatetags/macros.py", "copies": "1", "size": "5313", "license": "mit", "hash": -1364423576936188700, "line_mean": 31.20625, "line_max": 76, "alpha_frac": 0.5864859778, "autogenerated": false, "ratio": 4.099537037037037, "con...
from django import test as django_test from django.contrib.auth.models import User from django.core.handlers.wsgi import WSGIRequest from rest_framework import generics, authentication, permissions, status, serializers from rest_framework import viewsets from rest_framework.response import Response as RestFrameworkResp...
{ "repo_name": "sunscrapers/djet", "path": "testproject/testapp/tests/test_restframework.py", "copies": "1", "size": "5369", "license": "mit", "hash": -3701291315001082400, "line_mean": 30.9583333333, "line_max": 117, "alpha_frac": 0.7094430993, "autogenerated": false, "ratio": 4.036842105263158, ...
from django import test as unittest from sqlagg.columns import SimpleColumn, SumColumn from sqlagg.filters import EQFilter from corehq.apps.reports.sqlreport import SqlData, DatabaseColumn, AggregateColumn from corehq.db import Session from .sql_fixture import load_data from .sql_reports import combine_indicator DOMA...
{ "repo_name": "SEL-Columbia/commcare-hq", "path": "corehq/apps/reports/tests/test_report_api.py", "copies": "1", "size": "2778", "license": "bsd-3-clause", "hash": -7933569234248735000, "line_mean": 25.7211538462, "line_max": 88, "alpha_frac": 0.5309575234, "autogenerated": false, "ratio": 3.9856...
from django import test from django.conf import settings from django.core import cache, mail from django.core.management import call_command from django.db import connections, DEFAULT_DB_ALIAS, transaction from django_nose.fixture_tables import tables_used_by_fixtures from django_nose.utils import uses_mysql __all__...
{ "repo_name": "kalahbrown/HueBigSQL", "path": "desktop/core/ext-py/django-nose-1.3/django_nose/testcases.py", "copies": "41", "size": "7083", "license": "apache-2.0", "hash": -5849649508175178000, "line_mean": 43.5471698113, "line_max": 79, "alpha_frac": 0.6131582663, "autogenerated": false, "rat...
from django import test from django.conf import settings from django.core import mail from nose.tools import eq_ from amo.utils import send_mail from users.models import UserProfile, UserNotification import users.notifications class SendMailTest(test.TestCase): fixtures = ['base/users'] def setUp(self): ...
{ "repo_name": "jbalogh/zamboni", "path": "apps/amo/tests/test_send_mail.py", "copies": "1", "size": "3810", "license": "bsd-3-clause", "hash": 6212464955666494000, "line_mean": 34.6074766355, "line_max": 78, "alpha_frac": 0.6015748031, "autogenerated": false, "ratio": 4.110032362459547, "config...
from django import test from django.conf import settings from django.template import defaultfilters from django.utils import timezone from model_bakery import baker from cradmin_legacy import cradmin_testhelpers from devilry.devilry_account.models import PermissionGroup from devilry.devilry_admin.views.dashboard.stud...
{ "repo_name": "devilry/devilry-django", "path": "devilry/devilry_admin/tests/dashboard/test_student_feedbackfeed_wizard/test_assignment_listview.py", "copies": "1", "size": "29261", "license": "bsd-3-clause", "hash": 2607868252667895300, "line_mean": 62.6108695652, "line_max": 121, "alpha_frac": 0.66...
from django import test from django.conf import settings from django.test import override_settings from cradmin_legacy import cradmin_testhelpers from model_bakery import baker from devilry.devilry_account.crapps import account class TestIndexView(test.TestCase, cradmin_testhelpers.TestCaseMixin): viewclass = ac...
{ "repo_name": "devilry/devilry-django", "path": "devilry/devilry_account/tests/test_crapps/test_account/test_index.py", "copies": "1", "size": "5729", "license": "bsd-3-clause", "hash": -519187553475670500, "line_mean": 48.3879310345, "line_max": 95, "alpha_frac": 0.6399022517, "autogenerated": fal...
from django import test from django.contrib.auth.models import AnonymousUser from django.core.serializers.json import DjangoJSONEncoder class TestViewHelper(object): """ Helper class for unit-testing class based views. """ view_class = None request_factory_class = test.RequestFactory def setU...
{ "repo_name": "cornmander/django-braces", "path": "tests/helpers.py", "copies": "2", "size": "1843", "license": "bsd-3-clause", "hash": 8853504902649122000, "line_mean": 28.253968254, "line_max": 79, "alpha_frac": 0.5963103635, "autogenerated": false, "ratio": 4.25635103926097, "config_test": t...
from django import test from django.contrib.contenttypes.fields import GenericRelation from django.core.exceptions import FieldDoesNotExist from django.db.models.fields import related, CharField, Field from .models import ( AbstractPerson, BasePerson, Person, Relating, Relation ) TEST_RESULTS = { 'fields': { ...
{ "repo_name": "iambibhas/django", "path": "tests/model_meta/test.py", "copies": "2", "size": "24995", "license": "bsd-3-clause", "hash": 7522177457533750000, "line_mean": 36.8139183056, "line_max": 101, "alpha_frac": 0.5433486697, "autogenerated": false, "ratio": 3.9411857458215076, "config_tes...
from django import test from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.db import models from django.db.models.fields.related import ( ForeignKey, ForeignObject, ForeignObjectRel, ManyToManyField, ManyToOneRel, OneToOneField, ) from .models import AllField...
{ "repo_name": "feroda/django", "path": "tests/model_fields/test_field_flags.py", "copies": "5", "size": "7003", "license": "bsd-3-clause", "hash": -6217717783361178000, "line_mean": 31.123853211, "line_max": 103, "alpha_frac": 0.6121662145, "autogenerated": false, "ratio": 3.701374207188161, "c...
from django import test from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.db import models from .models import AllFieldsModel NON_CONCRETE_FIELDS = ( models.ForeignObject, GenericForeignKey, GenericRelation, ) NON_EDITABLE_FIELDS = ( models.BinaryF...
{ "repo_name": "kaedroho/django", "path": "tests/model_fields/test_field_flags.py", "copies": "30", "size": "7192", "license": "bsd-3-clause", "hash": 4338926314758298000, "line_mean": 31.8401826484, "line_max": 103, "alpha_frac": 0.6142936596, "autogenerated": false, "ratio": 3.718717683557394, ...
from django import test from django.core.exceptions import ValidationError from django.conf import settings from django.core.urlresolvers import reverse from mock import Mock, patch import mock from attachments.models import Attachment from sample_app.models import First, Second from attachments import forms from atta...
{ "repo_name": "imtapps/django-attachment", "path": "attachments/tests.py", "copies": "1", "size": "19683", "license": "bsd-2-clause", "hash": -3125760961828995000, "line_mean": 50.7973684211, "line_max": 116, "alpha_frac": 0.6671747193, "autogenerated": false, "ratio": 3.956381909547739, "confi...
from django import test from django.core import mail from django.core.urlresolvers import reverse from django.contrib.auth import get_user_model class TestInvitations(test.TestCase): def setUp(self): self.test_user = get_user_model().objects.create(username='testuser') self.test_user.set_password(...
{ "repo_name": "Socialsquare/RunningCause", "path": "invitations/tests.py", "copies": "1", "size": "1839", "license": "mit", "hash": -6313863725428955000, "line_mean": 38.9782608696, "line_max": 90, "alpha_frac": 0.6498096792, "autogenerated": false, "ratio": 3.7151515151515153, "config_test": t...
from django import test from django.core.urlresolvers import reverse from blog.models import Post, Category class BlogViewsTestCase(test.TestCase): def setUp(self): # Add parent category and post category parent = Category(name='Writing', parent=None) parent.save() category = Cate...
{ "repo_name": "ajoyoommen/weblog", "path": "blog/tests/test_views.py", "copies": "1", "size": "1905", "license": "mit", "hash": 1933368121586809000, "line_mean": 34.9433962264, "line_max": 74, "alpha_frac": 0.6146981627, "autogenerated": false, "ratio": 4.07051282051282, "config_test": true, ...
from django import test from django.db import models from django.core.exceptions import PermissionDenied from django.http import HttpResponse, HttpRequest from django.contrib.auth.models import User from django_extras.contrib.auth.decorators import staff_required, superuser_required from django_extras.contrib.auth.mode...
{ "repo_name": "gem/django-extras", "path": "django_extras/tests/contrib/auth.py", "copies": "2", "size": "12478", "license": "bsd-3-clause", "hash": 1993422217982953500, "line_mean": 39.7777777778, "line_max": 124, "alpha_frac": 0.677752845, "autogenerated": false, "ratio": 3.467074187274243, "...
from django import test from django.db import models from django_extras.utils.cache import generate_key, instance_key class TestModel(models.Model): name = models.CharField(max_length=10) class Meta: app_label = 'test' class GenerateKeyTestCase(test.TestCase): def __init__(self, *args, **kwargs...
{ "repo_name": "gem/django-extras", "path": "django_extras/tests/utils/cache.py", "copies": "2", "size": "2770", "license": "bsd-3-clause", "hash": -5524199949916802000, "line_mean": 35.9333333333, "line_max": 83, "alpha_frac": 0.6566787004, "autogenerated": false, "ratio": 3.4155363748458694, "...
from django import test from django.template import Template, Context from django.utils.html import escape from django.utils.translation import ugettext_lazy from formtags.utils import split_fields from .forms import TestForm class TestFormTags(test.TestCase): def setUp(self): self.form = TestForm() ...
{ "repo_name": "bmispelon/django-formtags", "path": "tests/test_formtags.py", "copies": "1", "size": "8201", "license": "mit", "hash": 5791581538559606000, "line_mean": 34.9692982456, "line_max": 83, "alpha_frac": 0.547494208, "autogenerated": false, "ratio": 3.7584784601283228, "config_test": t...
from django import test from django.test import override_settings from django.utils import translation from devilry.utils import setting_utils class TestHardDeadlineInfoTextSettingUtil(test.TestCase): @override_settings( DEVILRY_INFO_TEXT_TEST={} ) def test_get_devilry_hard_deadline_info_text_no_...
{ "repo_name": "devilry/devilry-django", "path": "devilry/utils/tests/test_setting_utils.py", "copies": "1", "size": "1918", "license": "bsd-3-clause", "hash": 3964031198174189000, "line_mean": 38.9583333333, "line_max": 118, "alpha_frac": 0.6199165798, "autogenerated": false, "ratio": 3.828343313...
from django import test from django.urls import reverse from django.conf import settings from django.contrib.auth.models import User from dwitter.models import Dweet, Comment from django.utils import timezone from datetime import timedelta import importlib from django.contrib import auth # Some automatic based on # h...
{ "repo_name": "lionleaf/dwitter", "path": "dwitter/tests/urls/test_all_urls.py", "copies": "1", "size": "6375", "license": "apache-2.0", "hash": 5994938264905826000, "line_mean": 45.875, "line_max": 99, "alpha_frac": 0.5115294118, "autogenerated": false, "ratio": 4.873853211009174, "config_test...
from django import test from factories.indicators_models import RFIndicatorFactory from factories.workflow_models import ( CountryFactory, RFProgramFactory, OrganizationFactory, TolaUserFactory, grant_program_access, grant_country_access, ) from factories.django_models import UserFactory from in...
{ "repo_name": "mercycorps/TolaActivity", "path": "workflow/tests/serializer_tests/iptt_qs_program_serializer_tests.py", "copies": "1", "size": "7155", "license": "apache-2.0", "hash": 8773386721817171000, "line_mean": 49.3943661972, "line_max": 118, "alpha_frac": 0.6663871419, "autogenerated": fals...
from django import test from model_bakery import baker from devilry.apps.core.models import Assignment from devilry.devilry_account.models import PermissionGroup from devilry.devilry_dbcache.customsql import AssignmentGroupDbCacheCustomSql from devilry.devilry_statistics.tests.test_api import api_test_mixin from devil...
{ "repo_name": "devilry/devilry-django", "path": "devilry/devilry_statistics/tests/test_api/test_assignment/test_examiner_average_grading_points.py", "copies": "1", "size": "11223", "license": "bsd-3-clause", "hash": -1966645685858208800, "line_mean": 56.2602040816, "line_max": 120, "alpha_frac": 0.66...
from django import test import json from django.contrib.auth.models import AnonymousUser class TestRequestMixin(object): def request(self, method="GET", path="/", session=None, user=None, data=None, **kwargs): factory = test.RequestFactory() if data is not None and kwargs.get("content_type", "app...
{ "repo_name": "vivsh/django-ginger", "path": "ginger/test/__init__.py", "copies": "1", "size": "2712", "license": "mit", "hash": -3383522564707363300, "line_mean": 33.7692307692, "line_max": 92, "alpha_frac": 0.6408554572, "autogenerated": false, "ratio": 3.6948228882833787, "config_test": true...
from django import test from conductor.accounts.tests.factories import ( GoogleDriveAuthFactory, ProductPlanFactory, ProfileFactory, UserFactory, ) from conductor.planner.tests.factories import ( ApplicationScheduleFactory, AuditFactory, MilestoneFactory, SchoolFactory, SchoolApplic...
{ "repo_name": "mblayman/lcp", "path": "conductor/tests/testcase.py", "copies": "2", "size": "1464", "license": "bsd-2-clause", "hash": -4031880104397316000, "line_mean": 27.7058823529, "line_max": 70, "alpha_frac": 0.7923497268, "autogenerated": false, "ratio": 4.6923076923076925, "config_test"...
from django import test from django.db.models.fields import related, CharField, Field, FieldDoesNotExist from django.contrib.contenttypes.fields import GenericRelation from .models import ( AbstractPerson, BasePerson, Person, Relating, Relation ) TEST_RESULTS = { 'fields': { Person: [ 'id...
{ "repo_name": "benjaminrigaud/django", "path": "tests/model_meta/test.py", "copies": "15", "size": "24972", "license": "bsd-3-clause", "hash": 542081089005479740, "line_mean": 36.7791225416, "line_max": 101, "alpha_frac": 0.5428880346, "autogenerated": false, "ratio": 3.9406659302509075, "confi...
from django import test from ..forms import CountryForm, CityForm from ..models import Country, City class FormTestCase(test.TransactionTestCase): reset_sequences = True def testCountryFormNameAndContinentAlone(self): form = CountryForm({'name': 'Spain', 'continent': 'EU'}) self.assertTrue(f...
{ "repo_name": "yourlabs/django-cities-light", "path": "src/cities_light/tests/test_form.py", "copies": "1", "size": "1203", "license": "mit", "hash": -1495643199777371600, "line_mean": 28.1463414634, "line_max": 65, "alpha_frac": 0.6485355649, "autogenerated": false, "ratio": 3.643292682926829, ...
from django import test from jingo.tests.test_helpers import render from mock import Mock from nose.tools import eq_ from pyquery import PyQuery as pq import amo from addons.models import Addon from tags.models import AddonTag, Tag, TagStat from tags.helpers import tag_link xss = "<script>alert('xss')</script>" c...
{ "repo_name": "wagnerand/zamboni", "path": "apps/tags/tests/test_helpers.py", "copies": "3", "size": "1642", "license": "bsd-3-clause", "hash": -8525056200006483000, "line_mean": 26.3666666667, "line_max": 74, "alpha_frac": 0.5852618758, "autogenerated": false, "ratio": 3.413721413721414, "conf...
from django import test from nose.tools import eq_ from mock import Mock from pyquery import PyQuery as pq import jingo from amo.urlresolvers import reverse from bandwagon.helpers import (user_collection_list, barometer, collection_favorite) from bandwagon.models import Collection from ...
{ "repo_name": "jbalogh/zamboni", "path": "apps/bandwagon/tests/test_helpers.py", "copies": "1", "size": "3029", "license": "bsd-3-clause", "hash": -5810053259858483000, "line_mean": 34.2209302326, "line_max": 79, "alpha_frac": 0.6051502146, "autogenerated": false, "ratio": 3.8148614609571787, "...
from django import test from selenium import webdriver from selenium.webdriver.common.keys import Keys class NewVisitorTest(test.LiveServerTestCase): def setUp(self): self.browser = webdriver.Firefox(capabilities={'marionette': False}) self.browser.implicitly_wait(0) def tearDown(self): ...
{ "repo_name": "Mirdalan/superlists", "path": "functional_tests/tests.py", "copies": "1", "size": "2364", "license": "mit", "hash": 7382879145070714000, "line_mean": 35.3692307692, "line_max": 76, "alpha_frac": 0.6434010152, "autogenerated": false, "ratio": 3.411255411255411, "config_test": fals...
from django import test from sundayfunday import models class EventTestCase(test.TestCase): def setUp(self): self.owner = models.User.objects.create( first_name='gigi', last_name='becali', user_type=models.User.ORGANISER) def test_saving(self): ...
{ "repo_name": "mihaibivol/sunday-funday", "path": "sundayfunday/test/unit/test_models.py", "copies": "1", "size": "2124", "license": "artistic-2.0", "hash": 230898746186475970, "line_mean": 34.4, "line_max": 81, "alpha_frac": 0.5451977401, "autogenerated": false, "ratio": 3.85480943738657, "con...
from django import test import jingo from jingo.tests.test_helpers import render from mock import Mock from nose.tools import eq_ from pyquery import PyQuery as pq import amo from addons.models import Addon from tags.models import AddonTag, Tag, TagStat from tags.helpers import tag_link xss = "<script>alert('xss')<...
{ "repo_name": "jbalogh/zamboni", "path": "apps/tags/tests/test_helpers.py", "copies": "1", "size": "1851", "license": "bsd-3-clause", "hash": 4166968222800321000, "line_mean": 26.6268656716, "line_max": 74, "alpha_frac": 0.5867098865, "autogenerated": false, "ratio": 3.3839122486288846, "config...
from django import test from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.db import models from django.db.models.fields.related import ( ForeignKey, ForeignObject, ForeignObjectRel, ManyToManyField, ManyToOneRel, OneToOneField, ) from .models impor...
{ "repo_name": "yephper/django", "path": "tests/model_fields/test_field_flags.py", "copies": "1", "size": "7542", "license": "bsd-3-clause", "hash": 4567842517803716000, "line_mean": 31.6696428571, "line_max": 103, "alpha_frac": 0.5974542562, "autogenerated": false, "ratio": 3.8071680969207473, ...
from django import urls from django.utils.translation import gettext_lazy from django.views.generic import edit from django.views.generic import base from django import forms from django.core import exceptions from crispy_forms import helper from crispy_forms import layout import json from devilry.devilry_bulkcreate_...
{ "repo_name": "devilry/devilry-django", "path": "devilry/devilry_bulkcreate_users/views/submit_bulk_users.py", "copies": "1", "size": "6331", "license": "bsd-3-clause", "hash": 6692491016304648000, "line_mean": 36.9161676647, "line_max": 120, "alpha_frac": 0.6608750592, "autogenerated": false, "r...
from django import utils from django.core import urlresolvers from django.db import models from core import models as core_models from core import utils as core_utils from programs import models as program_models import managers import utils as article_utils class Article(core_models.TimeStampedModel, core_models.Ba...
{ "repo_name": "megaprojectske/megaprojects.co.ke", "path": "megaprojects/articles/models.py", "copies": "1", "size": "2244", "license": "apache-2.0", "hash": -667126057591883500, "line_mean": 29.7397260274, "line_max": 78, "alpha_frac": 0.6510695187, "autogenerated": false, "ratio": 3.95070422535...
from django import VERSION as DJANGO_VERSION from django_comments_xtd.conf import settings if DJANGO_VERSION[1] <= 5: # Django <= 1.5 from django_comments_xtd.compat import import_by_path as import_string elif 6 <= DJANGO_VERSION[1] < 8: # Django v1.6.x and 1.7.x from django.utils.module_loading import import_...
{ "repo_name": "agilosoftware/django-comments-xtd", "path": "django_comments_xtd/__init__.py", "copies": "1", "size": "1675", "license": "bsd-2-clause", "hash": 2678628754296751000, "line_mean": 37.0681818182, "line_max": 75, "alpha_frac": 0.7253731343, "autogenerated": false, "ratio": 3.657205240...
from django import VERSION as django_version from django.conf import settings from dojango.conf import settings as dojango_settings from django.core.exceptions import ImproperlyConfigured from django.utils._os import safe_join from django.utils.encoding import force_str if django_version >= (1, 5, 0): from django.c...
{ "repo_name": "klipstein/dojango", "path": "dojango/util/media.py", "copies": "1", "size": "4526", "license": "bsd-3-clause", "hash": 6362331256912759000, "line_mean": 43.8118811881, "line_max": 150, "alpha_frac": 0.6151126823, "autogenerated": false, "ratio": 3.433990895295903, "config_test": ...
from django import VERSION as DJANGO_VERSION from django.conf.urls.defaults import * from django.conf.urls import patterns from django.contrib import admin from django.views.generic import ListView from cities.models import Country, Region, City, District, PostalCode class PlaceListView(ListView): template_name =...
{ "repo_name": "blag/django-cities", "path": "example/urls.py", "copies": "1", "size": "1833", "license": "mit", "hash": 5911643228321612000, "line_mean": 34.25, "line_max": 126, "alpha_frac": 0.6252045827, "autogenerated": false, "ratio": 3.718052738336714, "config_test": false, "has_no_keywo...
from django import VERSION as DJANGO_VERSION from django.conf.urls import include, url from django.contrib import admin from django.views.generic import ListView from cities.models import (Country, Region, City, District, PostalCode) def patterns(prefix, *args): if DJANGO_VERSION < (1, 9): from django.con...
{ "repo_name": "coderholic/django-cities", "path": "example/urls.py", "copies": "2", "size": "1977", "license": "mit", "hash": 7826581287648497000, "line_mean": 33.0862068966, "line_max": 126, "alpha_frac": 0.6312594841, "autogenerated": false, "ratio": 3.7946257197696736, "config_test": false, ...
from django import VERSION as django_version from django.contrib.auth import authenticate, login, logout, get_user, BACKEND_SESSION_KEY, load_backend from django.contrib.auth.middleware import AuthenticationMiddleware as DjangoMiddleware from django.contrib.auth.models import AnonymousUser, BaseUserManager from djangae...
{ "repo_name": "grzes/djangae", "path": "djangae/contrib/gauth/middleware.py", "copies": "3", "size": "3476", "license": "bsd-3-clause", "hash": -7453758000501718000, "line_mean": 44.1428571429, "line_max": 107, "alpha_frac": 0.6593785961, "autogenerated": false, "ratio": 4.291358024691358, "con...
from django import VERSION as DJANGO_VERSION from django.contrib.auth.models import Group, Permission from django.test import TestCase from wagtail.core.models import GroupPagePermission, Page from wagtail.tests.testapp.models import BusinessIndex, EventCategory, EventPage from wagtail.tests.utils import WagtailTestUt...
{ "repo_name": "takeflight/wagtail", "path": "wagtail/contrib/modeladmin/tests/test_page_modeladmin.py", "copies": "1", "size": "13886", "license": "bsd-3-clause", "hash": -3882817009972083000, "line_mean": 35.6385224274, "line_max": 136, "alpha_frac": 0.6578568342, "autogenerated": false, "ratio"...
from django import VERSION as DJANGO_VERSION from django.contrib.contenttypes.models import ContentType from django.core.management import BaseCommand from puput.models import BlogPage from wagtail.core.models import Page, Site class Command(BaseCommand): help = "Load Puput initial dummy data" def handle(se...
{ "repo_name": "APSL/puput", "path": "puput/management/commands/puput_initial_data.py", "copies": "1", "size": "1142", "license": "mit", "hash": 3350181574267260000, "line_mean": 29.0526315789, "line_max": 75, "alpha_frac": 0.6234676007, "autogenerated": false, "ratio": 4.183150183150183, "confi...
from django import VERSION as DJANGO_VERSION from django.contrib.contenttypes.models import ContentType from django.core.management import BaseCommand from wagtail.core.models import Page, Site class Command(BaseCommand): help = "Load Puput initial dummy data" def handle(self, *args, **options): # G...
{ "repo_name": "csalom/puput", "path": "puput/management/commands/puput_initial_data.py", "copies": "1", "size": "1104", "license": "mit", "hash": -9181711766897416000, "line_mean": 28.8378378378, "line_max": 75, "alpha_frac": 0.6150362319, "autogenerated": false, "ratio": 4.213740458015267, "co...
from django import VERSION as django_version from django.contrib import admin from django.contrib import messages from django.template.defaultfilters import ( linebreaksbr, removetags ) from django.contrib.humanize.templatetags.humanize import naturalday from django.contrib.contenttypes.models import ContentType fr...
{ "repo_name": "lvm/django-jot", "path": "jot/admin.py", "copies": "1", "size": "4444", "license": "mit", "hash": 1551424682540213000, "line_mean": 39.7706422018, "line_max": 99, "alpha_frac": 0.5940594059, "autogenerated": false, "ratio": 4.1727699530516436, "config_test": false, "has_no_keyw...
from django import VERSION as DJANGO_VERSION from django.contrib import admin from django.db.models import Count if DJANGO_VERSION < (1, 9): from taggit_helpers import (TaggitCounter, TaggitListFilter, TaggitTabularInline) else: from taggit_helpers.admin import (TaggitCounter, TaggitListFilter, ...
{ "repo_name": "mfcovington/djangocms-lab-publications", "path": "cms_lab_publications/admin.py", "copies": "1", "size": "7142", "license": "bsd-3-clause", "hash": 4198089243705233400, "line_mean": 25.1611721612, "line_max": 83, "alpha_frac": 0.5576869224, "autogenerated": false, "ratio": 4.035028...
from django import VERSION as DJANGO_VERSION from django.core.exceptions import ValidationError from django.db import DataError, models, transaction from django.test import TestCase, override_settings from django.utils.translation import override from modeltrans.fields import TranslationField from .app.models import ...
{ "repo_name": "zostera/django-modeltrans", "path": "tests/test_models.py", "copies": "1", "size": "14209", "license": "bsd-3-clause", "hash": -3989893263090990000, "line_mean": 34.253101737, "line_max": 100, "alpha_frac": 0.6082212994, "autogenerated": false, "ratio": 3.6815237108059082, "confi...
from django import VERSION as DJANGO_VERSION from django.core.files.base import File from django.db.models.fields.files import ( FieldFile, ImageFieldFile, ImageFileDescriptor ) from .mixins import VersatileImageMixIn class VersatileImageFieldFile(VersatileImageMixIn, ImageFieldFile): def __setstate...
{ "repo_name": "respondcreate/django-versatileimagefield", "path": "versatileimagefield/files.py", "copies": "1", "size": "5246", "license": "mit", "hash": -6120018169363155000, "line_mean": 45.0175438596, "line_max": 92, "alpha_frac": 0.6399161266, "autogenerated": false, "ratio": 4.2170418006430...
from django import VERSION as DJANGO_VERSION from django.core.urlresolvers import RegexURLPattern, reverse_lazy from oscar.core.loading import feature_hidden from oscar.views.decorators import permissions_required class Application(object): """ Base application class. This is subclassed by each app to p...
{ "repo_name": "sonofatailor/django-oscar", "path": "src/oscar/core/application.py", "copies": "1", "size": "4716", "license": "bsd-3-clause", "hash": 7020004081201539000, "line_mean": 33.4233576642, "line_max": 79, "alpha_frac": 0.610899067, "autogenerated": false, "ratio": 4.754032258064516, "...
from django import VERSION as DJANGO_VERSION from django.db import transaction, connection from django.test import SimpleTestCase from django_hstore.fields import HStoreDict from django_hstore_tests.models import DataBag class TestNotTransactional(SimpleTestCase): if DJANGO_VERSION[:2] >= (1, 8): def se...
{ "repo_name": "pombredanne/django-hstore", "path": "tests/django_hstore_tests/tests/test_not_transactional.py", "copies": "2", "size": "1655", "license": "mit", "hash": 5902658450594151000, "line_mean": 41.4358974359, "line_max": 84, "alpha_frac": 0.5963746224, "autogenerated": false, "ratio": 3....
from django import VERSION as DJANGO_VERSION from django import forms from django.core import exceptions from django.utils.translation import ugettext_lazy as _ from treebeard.forms import movenodeform_factory from oscar.core.loading import get_class, get_model from oscar.core.utils import slugify from oscar.forms.wid...
{ "repo_name": "sonofatailor/django-oscar", "path": "src/oscar/apps/dashboard/catalogue/forms.py", "copies": "1", "size": "14222", "license": "bsd-3-clause", "hash": 5956398808797185000, "line_mean": 34.4663341646, "line_max": 104, "alpha_frac": 0.6258613416, "autogenerated": false, "ratio": 4.335...
from django import VERSION as DJANGO_VERSION from django import forms from django.template.loader import get_template from django.contrib.admin import widgets from django.conf import settings from django.core.exceptions import ImproperlyConfigured from .settings import ( MARKDOWNX_EDITOR_RESIZABLE, MARKDOWNX_U...
{ "repo_name": "wuga214/Django-Wuga", "path": "env/lib/python2.7/site-packages/markdownx/widgets.py", "copies": "1", "size": "3378", "license": "apache-2.0", "hash": -5645595008000425000, "line_mean": 29.4324324324, "line_max": 103, "alpha_frac": 0.6184132623, "autogenerated": false, "ratio": 3.91...
from django import VERSION as DJANGO_VERSION from django import template from django.conf import settings if DJANGO_VERSION[0] == 1 and DJANGO_VERSION[1] <= 9: from django.core.urlresolvers import reverse, NoReverseMatch else: from django.urls import reverse, NoReverseMatch from django.utils.encoding import esc...
{ "repo_name": "valerymelou/django-active-link", "path": "active_link/templatetags/active_link_tags.py", "copies": "1", "size": "1838", "license": "bsd-3-clause", "hash": 6880303858008355000, "line_mean": 34.3461538462, "line_max": 101, "alpha_frac": 0.6653971708, "autogenerated": false, "ratio": ...
from django import VERSION as DJANGO_VERSION from django.template import Library, Node, NodeList, VariableDoesNotExist from django.core.urlresolvers import NoReverseMatch from django.template.defaulttags import TemplateIfParser if DJANGO_VERSION < (1, 5): from django.templatetags.future import url else: from d...
{ "repo_name": "j4mie/django-activelink", "path": "activelink/templatetags/activelink.py", "copies": "1", "size": "3283", "license": "unlicense", "hash": 3452201599403264500, "line_mean": 30.2666666667, "line_max": 80, "alpha_frac": 0.6652452026, "autogenerated": false, "ratio": 4.053086419753086,...
from django import VERSION as DJANGO_VERSION from django.utils.translation import ugettext_lazy as _ from django.db.models import Lookup, Transform, Func from django.db.models.fields import * from django.core.exceptions import ValidationError from django import forms from rdkit.Chem import AllChem as Chem from rdkit i...
{ "repo_name": "rdkit/django-rdkit", "path": "django_rdkit/models/fields.py", "copies": "1", "size": "13147", "license": "bsd-3-clause", "hash": 7623625792668831000, "line_mean": 29.1536697248, "line_max": 93, "alpha_frac": 0.6065262037, "autogenerated": false, "ratio": 3.8206916594013367, "conf...
from django import VERSION as django_version if django_version >= (1, 5, 0): from hashlib import md5 as md5_constructor, sha1 as sha_constructor else: from django.utils.hashcompat import md5_constructor, sha_constructor from native_tags.decorators import function, filter def hexd(algo, value): lookup = { ...
{ "repo_name": "justquick/django-native-tags", "path": "native_tags/contrib/hash.py", "copies": "1", "size": "1286", "license": "bsd-3-clause", "hash": -4342699809890060300, "line_mean": 29.619047619, "line_max": 79, "alpha_frac": 0.6135303266, "autogenerated": false, "ratio": 3.5921787709497206, ...
from django import VERSION as django_version if django_version >= (1, 5, 0): import json else: from django.utils import simplejson as json from django.core.serializers.json import DateTimeAwareJSONEncoder from django.db.models.query import QuerySet from piston.emitters import Emitter from piston.validate_jsonp ...
{ "repo_name": "ofirr/dojango", "path": "dojango/data/piston/emitters.py", "copies": "1", "size": "2674", "license": "bsd-3-clause", "hash": -7143854487000431000, "line_mean": 32.425, "line_max": 78, "alpha_frac": 0.6133133882, "autogenerated": false, "ratio": 4.412541254125412, "config_test": f...
from django import VERSION as django_version if django_version >= (1, 5, 0): import json else: from django.utils import simplejson as json from django.http import HttpResponseNotAllowed, HttpResponseServerError from util import to_json_response from util import to_dojo_data try: from functools import wrap...
{ "repo_name": "ricard33/dojango", "path": "dojango/decorators.py", "copies": "6", "size": "5526", "license": "bsd-3-clause", "hash": -3045648045221180400, "line_mean": 35.84, "line_max": 117, "alpha_frac": 0.622873688, "autogenerated": false, "ratio": 4.120805369127517, "config_test": false, ...
from django import VERSION as django_version if django_version >= (1, 5, 0): import json else: from django.utils import simplejson as json from django.utils.encoding import smart_unicode from django.core.paginator import Paginator from utils import get_fields_and_servicemethods from exceptions import StoreExc...
{ "repo_name": "william-gr/dojango", "path": "dojango/data/modelstore/stores.py", "copies": "6", "size": "15842", "license": "bsd-3-clause", "hash": -2086556233800367600, "line_mean": 33.3644251627, "line_max": 112, "alpha_frac": 0.5664688802, "autogenerated": false, "ratio": 4.503126776577601, ...
from django import VERSION as djangoVersion if djangoVersion[:2] >= (1, 8): from django.db.backends.base.introspection import BaseDatabaseIntrospection, TableInfo else: from django.db.backends import BaseDatabaseIntrospection from sqlanydb import ProgrammingError, OperationalError import re import sqlanydb cl...
{ "repo_name": "sqlanywhere/sqlany-django", "path": "sqlany_django/introspection.py", "copies": "1", "size": "5278", "license": "bsd-3-clause", "hash": -2710835049391630000, "line_mean": 47.4220183486, "line_max": 114, "alpha_frac": 0.5496400152, "autogenerated": false, "ratio": 3.912527798369162,...
from django import VERSION as DJANGO_VERSION from django.template import TemplateSyntaxError, NodeList, Template if DJANGO_VERSION >= (1, 8): from django.template.context import make_context # TODO: Find out why Django raises InvalidTemplateLibrary without this import. from django.template.loader import get_templ...
{ "repo_name": "AlexHill/djpj", "path": "djpj/template.py", "copies": "1", "size": "9340", "license": "bsd-3-clause", "hash": -5852853094108774000, "line_mean": 39.4329004329, "line_max": 103, "alpha_frac": 0.6448608137, "autogenerated": false, "ratio": 4.306131857999078, "config_test": false, ...
from django import VERSION as djangoVersion if djangoVersion[:2] >= (1, 8): from django.db.backends.base.client import BaseDatabaseClient else: from django.db.backends import BaseDatabaseClient from django.conf import settings import os class DatabaseClient(BaseDatabaseClient): executable_name = 'dbisqlc'...
{ "repo_name": "sqlanywhere/sqlany-django", "path": "sqlany_django/client.py", "copies": "1", "size": "1213", "license": "bsd-3-clause", "hash": 1422083890511914200, "line_mean": 32.6944444444, "line_max": 66, "alpha_frac": 0.6026380874, "autogenerated": false, "ratio": 3.826498422712934, "confi...
from django import VERSION as djangoVersion if djangoVersion[:2] >= (1, 8): from django.db.backends.base.schema import BaseDatabaseSchemaEditor else: from django.db.backends.schema import BaseDatabaseSchemaEditor class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): # Overrideable SQL templates sql_r...
{ "repo_name": "sqlanywhere/sqlany-django", "path": "sqlany_django/schema.py", "copies": "1", "size": "1468", "license": "bsd-3-clause", "hash": -3503559340318398000, "line_mean": 44.875, "line_max": 132, "alpha_frac": 0.6839237057, "autogenerated": false, "ratio": 3.4541176470588235, "config_te...
from django import VERSION as DJANGO_VERSION, template from django.template.defaulttags import token_kwargs from allauth.compat import template_context_value from allauth.socialaccount import providers from allauth.utils import get_request_param register = template.Library() if DJANGO_VERSION < (1, 9): simple_...
{ "repo_name": "okwow123/djangol2", "path": "allauth/socialaccount/templatetags/socialaccount.py", "copies": "6", "size": "3209", "license": "mit", "hash": -6486468941197988000, "line_mean": 30.7722772277, "line_max": 75, "alpha_frac": 0.6372701776, "autogenerated": false, "ratio": 4.0517676767676...
from django import VERSION, forms from django.conf import settings from django.contrib.admin import widgets from django.core.exceptions import ImproperlyConfigured from django.urls import reverse from django.utils.encoding import force_text class DynamicRawIDImproperlyConfigured(ImproperlyConfigured): pass clas...
{ "repo_name": "lincolnloop/django-salmonella", "path": "dynamic_raw_id/widgets.py", "copies": "1", "size": "2534", "license": "mit", "hash": -5868508897094084000, "line_mean": 31.0759493671, "line_max": 76, "alpha_frac": 0.5576164167, "autogenerated": false, "ratio": 3.996845425867508, "config_...
from django import VERSION, forms from django.conf import settings from django.contrib import admin from django.contrib.admin import helpers from django.contrib.admin.options import InlineModelAdmin, reverse from django.contrib.admin.utils import unquote from django.core.exceptions import PermissionDenied from django.d...
{ "repo_name": "s-block/django-nested-inline", "path": "nested_inline/admin.py", "copies": "1", "size": "18690", "license": "mit", "hash": -8822334641481761000, "line_mean": 45.1481481481, "line_max": 114, "alpha_frac": 0.5626538256, "autogenerated": false, "ratio": 4.511223750905141, "config_te...
from django import VERSION from django.apps import apps from django.core.exceptions import ViewDoesNotExist from django.http import Http404 from django.urls import ResolverMatch from django.urls.exceptions import Resolver404 try: from django.urls import re_path # Django 2.x from django.urls import ...
{ "repo_name": "doconix/django-mako-plus", "path": "django_mako_plus/router/resolver.py", "copies": "1", "size": "9188", "license": "apache-2.0", "hash": -846275662230702200, "line_mean": 38.7489177489, "line_max": 109, "alpha_frac": 0.5657808756, "autogenerated": false, "ratio": 4.088156723063223...
from django import VERSION from django.conf import settings as django_settings from wiki.conf import settings as wiki_settings from django.core.exceptions import ImproperlyConfigured # This is not used in django 1.7+ APP_LABEL = 'attachments' if VERSION < (1, 7) else None SLUG = "attachments" # Please see this note a...
{ "repo_name": "Si-elegans/Web-based_GUI_Tools", "path": "wiki/plugins/attachments/settings.py", "copies": "2", "size": "3357", "license": "apache-2.0", "hash": 8582738622423798000, "line_mean": 52.2857142857, "line_max": 111, "alpha_frac": 0.7646708371, "autogenerated": false, "ratio": 3.73, "c...
from django import VERSION from django.conf import settings from django.contrib.contenttypes.generic import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.utils import simplejson from oembed.constants import RESOURCE_CHOICES from oembed.providers i...
{ "repo_name": "worldcompany/djangoembed", "path": "oembed/models.py", "copies": "1", "size": "4399", "license": "mit", "hash": 7953821499335857000, "line_mean": 32.5801526718, "line_max": 92, "alpha_frac": 0.6642418732, "autogenerated": false, "ratio": 4.142184557438795, "config_test": false, ...
from django import VERSION from django.conf.urls import url from django.utils.translation import ugettext_lazy as _ from six import string_types from .components import Dropdown from .views import ModelToolsView def patterns(prefix, *args): if VERSION < (1, 9): from django.conf.urls import patterns as d...
{ "repo_name": "DjangoAdminHackers/django-admin-row-actions", "path": "django_admin_row_actions/admin.py", "copies": "1", "size": "4962", "license": "mit", "hash": 1842608346606741800, "line_mean": 33.4583333333, "line_max": 122, "alpha_frac": 0.5475614672, "autogenerated": false, "ratio": 4.22657...
from django import VERSION 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_lazy as l...
{ "repo_name": "Feverup/django-modelclone", "path": "modelclone/admin.py", "copies": "1", "size": "10338", "license": "mit", "hash": -4641042867989244000, "line_mean": 43.1794871795, "line_max": 103, "alpha_frac": 0.5861868833, "autogenerated": false, "ratio": 4.378653113087675, "config_test": f...
from django import VERSION from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.conf import settings from django.db import models from datetime import datetime from documentcloud import DocumentCloud from django_extensions.db.fields import AutoSlugField from...
{ "repo_name": "BayCitizen/django-doccloud", "path": "doccloud/models.py", "copies": "1", "size": "5040", "license": "apache-2.0", "hash": 9036542877099975000, "line_mean": 35.5217391304, "line_max": 103, "alpha_frac": 0.606547619, "autogenerated": false, "ratio": 4.028776978417266, "config_test...
from django import VERSION from django.contrib.auth.models import User from django.core.exceptions import ValidationError, PermissionDenied from django.core.urlresolvers import reverse from django.db.models import Q from django.http import HttpResponseRedirect, Http404, HttpResponse from django.conf import settings fro...
{ "repo_name": "vladyslav2/django-helpdesk-optimizated", "path": "helpdesk/views/staff_gv.py", "copies": "1", "size": "33637", "license": "bsd-3-clause", "hash": -6817587063144315000, "line_mean": 40.1210268949, "line_max": 439, "alpha_frac": 0.577221512, "autogenerated": false, "ratio": 4.0786952...
from django import VERSION from django.core.exceptions import ( MultipleObjectsReturned, ObjectDoesNotExist, FieldDoesNotExist) from django.contrib.contenttypes.fields import ContentType from django.db.models.query_utils import Q from .models import ExternalKeyMapping from collections import defaultdict imp...
{ "repo_name": "andrewdodd/django-nsync", "path": "src/nsync/actions.py", "copies": "1", "size": "27239", "license": "mit", "hash": 6309189582013233000, "line_mean": 35.0781456954, "line_max": 112, "alpha_frac": 0.544733654, "autogenerated": false, "ratio": 4.897339086659475, "config_test": fals...
from django import VERSION from django.core.management.base import BaseCommand __all__ = ['OutputWrapper', 'MavenBaseCommand'] if VERSION > (1, 5,): from django.core.management.base import OutputWrapper else: from django.utils.encoding import force_unicode class OutputWrapper(object): """ ...
{ "repo_name": "generalov/django-maven", "path": "django_maven/compat.py", "copies": "1", "size": "1309", "license": "isc", "hash": 8174016213573143000, "line_mean": 34.3783783784, "line_max": 79, "alpha_frac": 0.615737204, "autogenerated": false, "ratio": 4.1424050632911396, "config_test": fals...
from django import VERSION from django.core.management.commands.loaddata import Command as LoadDataCommand # Because this command is used (instead of default loaddata), then settings have been imported # and we can safely import MT modules from wagtail_modeltranslation import settings as mt_settings from wagtail_model...
{ "repo_name": "tomdyson/wagtail-modeltranslation", "path": "wagtail_modeltranslation/management/commands/loaddata.py", "copies": "1", "size": "2588", "license": "bsd-3-clause", "hash": -1275360178040231200, "line_mean": 41.4262295082, "line_max": 97, "alpha_frac": 0.6418083462, "autogenerated": fal...
from django import VERSION from django.db import IntegrityError from django.db.models.base import ModelBase from django.db.models.signals import pre_delete as pre_delete_signal from ratings import settings, models, forms, exceptions, signals, cookies def _model_name(model): if VERSION < (1, 7): return mo...
{ "repo_name": "gradel/django-generic-ratings", "path": "ratings/handlers.py", "copies": "2", "size": "26920", "license": "mit", "hash": 182578868010687870, "line_mean": 36.808988764, "line_max": 85, "alpha_frac": 0.6298291233, "autogenerated": false, "ratio": 4.400850089913356, "config_test": f...
from django import VERSION from django.db import models from django.db.backends.util import typecast_timestamp from django.db.models.sql.compiler import SQLCompiler from django.db.models.sql.constants import MULTI try: from django.db.models.sql.datastructures import Date except ImportError: from django.db.model...
{ "repo_name": "ionelmc/django-easyfilters", "path": "src/django_easyfilters/queries.py", "copies": "1", "size": "6502", "license": "mit", "hash": -1703680924294922500, "line_mean": 33.0418848168, "line_max": 80, "alpha_frac": 0.6008920332, "autogenerated": false, "ratio": 3.909801563439567, "co...
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 import Me...
{ "repo_name": "icomms/wqmanager", "path": "apps/django_granular_permissions/models.py", "copies": "3", "size": "5951", "license": "bsd-3-clause", "hash": -1990988636375061200, "line_mean": 39.4829931973, "line_max": 135, "alpha_frac": 0.6240967905, "autogenerated": false, "ratio": 4.0648907103825...
from django import VERSION from django.db import transaction from django.db.models.manager import Manager from django.db.models.query import QuerySet from django.db.models.sql.constants import SINGLE from django.db.models.sql.datastructures import EmptyResultSet from django.db.models.sql.query import Query from django....
{ "repo_name": "spuriousdata/django-pgfields", "path": "pgfields/hstore/query.py", "copies": "1", "size": "5371", "license": "mit", "hash": -9200045415941717000, "line_mean": 37.9202898551, "line_max": 101, "alpha_frac": 0.5876000745, "autogenerated": false, "ratio": 3.955081001472754, "config_t...
from django import VERSION from django.db import transaction from django.db.models.query import QuerySet from django.db.models.sql.constants import SINGLE from django.db.models.sql.datastructures import EmptyResultSet from django.db.models.sql.query import Query from django.db.models.sql.subqueries import UpdateQuery f...
{ "repo_name": "EnTeQuAk/django-orm", "path": "django_orm/postgresql/hstore/query.py", "copies": "1", "size": "4484", "license": "bsd-3-clause", "hash": 2577113261658783000, "line_mean": 39.3963963964, "line_max": 119, "alpha_frac": 0.5880909902, "autogenerated": false, "ratio": 3.9059233449477353...
from django import VERSION from django.db.models.deletion import ( attrgetter, signals, six, sql, transaction, CASCADE, Collector, ) import versions.models class VersionedCollector(Collector): """ A Collector that can be used to collect and delete Versionable objects. The delete operation for ...
{ "repo_name": "pretix/cleanerversion", "path": "versions/deletion.py", "copies": "2", "size": "7944", "license": "apache-2.0", "hash": 6811181836121797000, "line_mean": 44.1363636364, "line_max": 122, "alpha_frac": 0.579305136, "autogenerated": false, "ratio": 4.909765142150803, "config_test": ...
from django import VERSION from django.db.models.signals import post_migrate def mk_permissions(permissions, appname, verbosity): """ Make permission at app level - hack with empty ContentType. Adapted code from http://djangosnippets.org/snippets/334/ """ from django.contrib.auth.models import Pe...
{ "repo_name": "sciyoshi/django-dbsettings", "path": "dbsettings/management.py", "copies": "2", "size": "1579", "license": "bsd-3-clause", "hash": 6876226081068077000, "line_mean": 38.475, "line_max": 98, "alpha_frac": 0.6060797973, "autogenerated": false, "ratio": 4.410614525139665, "config_tes...
from django import VERSION from django.forms import widgets from django.utils.safestring import mark_safe class CountableWidget(widgets.Textarea): class Media: js = ('countable_field/js/scripts.js',) css = { 'all': ('countable_field/css/styles.css',) } def ...
{ "repo_name": "RoboAndie/django-countable-field", "path": "countable_field/widgets.py", "copies": "1", "size": "2736", "license": "mit", "hash": -6224276844594130000, "line_mean": 41.75, "line_max": 104, "alpha_frac": 0.5625, "autogenerated": false, "ratio": 3.948051948051948, "config_test": fa...
from django import VERSION from django.forms.models import ModelMultipleChoiceField, ModelChoiceIterator from django.forms.models import ChoiceField, ModelChoiceField from django.db.models import ManyToManyField try: from django.db import router except ImportError: router = None from django.db.models import sig...
{ "repo_name": "ionelmc/django-admin-customizer", "path": "src/admin_customizer/fields.py", "copies": "1", "size": "10258", "license": "bsd-2-clause", "hash": -204865716936453250, "line_mean": 53.8556149733, "line_max": 151, "alpha_frac": 0.5274907389, "autogenerated": false, "ratio": 4.7119889756...
from django import VERSION from django_hstore.hstore import HStoreManager from django_hstore.query import HStoreQuerySet, HStoreWhereNode from django.db.models.sql.query import Query from django.db.models.sql.datastructures import EmptyResultSet from django.db.models.sql.where import EmptyShortCircuit from django.utils...
{ "repo_name": "praekelt/gem-survey-tool", "path": "gems/core/hstore_helper.py", "copies": "1", "size": "6855", "license": "bsd-2-clause", "hash": 8900933668665035000, "line_mean": 51.3358778626, "line_max": 119, "alpha_frac": 0.5037199125, "autogenerated": false, "ratio": 4.399871630295251, "co...