text stringlengths 0 1.05M | meta dict |
|---|---|
from django.utils import timezone
from waldur_core.core import utils as core_utils
from waldur_mastermind.invoices import models as invoice_models
from waldur_mastermind.invoices import registrators
from waldur_mastermind.slurm_invoices import registrators as slurm_registrators
from . import utils
def add_new_alloc... | {
"repo_name": "opennode/nodeconductor-assembly-waldur",
"path": "src/waldur_mastermind/slurm_invoices/handlers.py",
"copies": "1",
"size": "1910",
"license": "mit",
"hash": -3264317990775856000,
"line_mean": 30.8333333333,
"line_max": 79,
"alpha_frac": 0.6984293194,
"autogenerated": false,
"ratio... |
from django.utils import timezone
from waldur_core.structure import models as structure_models
from . import models, utils
def format_event(tags):
return {
'measurement': 'events',
'tags': tags,
# fields is required, but empty
'fields': {'value': 0},
}
def log_resource_crea... | {
"repo_name": "opennode/nodeconductor-assembly-waldur",
"path": "src/waldur_mastermind/analytics/handlers.py",
"copies": "2",
"size": "1474",
"license": "mit",
"hash": -9005512798393250000,
"line_mean": 26.8113207547,
"line_max": 77,
"alpha_frac": 0.6472184532,
"autogenerated": false,
"ratio": 3.... |
from django.utils import timezone
import pytest
from bulk_update.helper import bulk_update
from osf.models import OSFUser
from django.db.models import Max, DateTimeField
from osf_tests.factories import UserFactory, PreprintFactory
@pytest.mark.django_db
class TestGuidAnnotations:
guid_factories = [
Use... | {
"repo_name": "cwisecarver/osf.io",
"path": "osf_tests/test_guid_annotations.py",
"copies": "3",
"size": "7912",
"license": "apache-2.0",
"hash": 7980368578747418000,
"line_mean": 39.3673469388,
"line_max": 171,
"alpha_frac": 0.6065470172,
"autogenerated": false,
"ratio": 3.8727361722956437,
"c... |
from django.utils import timezone
import re
import datetime
from django import forms
from django.forms.extras.widgets import SelectDateWidget
from django.contrib.auth import authenticate
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translatio... | {
"repo_name": "praekelt/molo",
"path": "molo/profiles/forms.py",
"copies": "1",
"size": "20788",
"license": "bsd-2-clause",
"hash": -6665338175833278000,
"line_mean": 33.2471169687,
"line_max": 79,
"alpha_frac": 0.5570040408,
"autogenerated": false,
"ratio": 4.44377939290295,
"config_test": fal... |
from django.utils import timezone
import re
from django import forms
from django.forms.extras.widgets import SelectDateWidget
from django.contrib.auth import authenticate
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import ugette... | {
"repo_name": "praekelt/molo.profiles",
"path": "molo/profiles/forms.py",
"copies": "1",
"size": "18053",
"license": "bsd-2-clause",
"hash": 7606987510526553000,
"line_mean": 32.8071161049,
"line_max": 78,
"alpha_frac": 0.5625103861,
"autogenerated": false,
"ratio": 4.4663532904502725,
"config_... |
from django.utils import timezone
import requests
from . import settings
from ... import models
from ... import app_settings
class PivotalDataRetriever(object):
def identify_stories(self, stories):
nb_stories_by_type = {"release": 0, "feature": 0, "bug": 0, "chore": 0}
nb_stories_by_state = {"d... | {
"repo_name": "bsvetchine/django-soundcheck",
"path": "soundcheck/instruments/pivotal/tools.py",
"copies": "1",
"size": "2871",
"license": "mit",
"hash": 6351640643614804000,
"line_mean": 38.875,
"line_max": 79,
"alpha_frac": 0.5687913619,
"autogenerated": false,
"ratio": 3.5842696629213484,
"c... |
from django.utils import timezone
import requests
from . import settings
from ... import models
from ... import app_settings
class ZendeskDataRetriever(object):
def identify_tickets(self, tickets):
nb_tickets_by_priority = {"urgent": 0, "high": 0, "normal": 0,
"low": 0... | {
"repo_name": "bsvetchine/django-soundcheck",
"path": "soundcheck/instruments/zendesk/tools.py",
"copies": "1",
"size": "2527",
"license": "mit",
"hash": 2367213054118992000,
"line_mean": 38.484375,
"line_max": 77,
"alpha_frac": 0.5738029284,
"autogenerated": false,
"ratio": 3.4807162534435263,
... |
from django.utils import timezone
class EditedTracableAdmin(object):
def get_fieldsets(self, request, obj=None):
result = super(EditedTracableAdmin, self).get_fieldsets(request, obj)
# since lazy_translation is not easy to distinguished,
# I will always append this to the... | {
"repo_name": "ace-han/quanquan",
"path": "quanquan/admin.py",
"copies": "1",
"size": "1467",
"license": "bsd-3-clause",
"hash": 4605131220275178500,
"line_mean": 42.1764705882,
"line_max": 114,
"alpha_frac": 0.6073619632,
"autogenerated": false,
"ratio": 4.37910447761194,
"config_test": false,... |
from django.utils import timezone
import factory
from .models import (Organisation, Person, EpitomeInstance, Epitome,
Skill, Interest, Rating, OutofTen, RatingInstance)
class OrganisationFactory(factory.DjangoModelFactory):
class Meta:
model = Organisation
name = "N/A"
number = "N/A"
interest_in_... | {
"repo_name": "DarrenFrenkel/django-rea-people",
"path": "rea_people/factories.py",
"copies": "2",
"size": "1638",
"license": "mit",
"hash": 494126874079901700,
"line_mean": 22.1176470588,
"line_max": 70,
"alpha_frac": 0.7234432234,
"autogenerated": false,
"ratio": 3.25,
"config_test": false,
... |
from django.utils import translation
from django.conf import settings
from django.http import HttpResponseRedirect
from django.utils.translation import get_language_from_request
class SubdomainLanguageMiddleware(object):
"""
Set the language for the site based on the subdomain the request
is being served ... | {
"repo_name": "Arthur2e5/arguman.org",
"path": "web/i18n/middleware.py",
"copies": "3",
"size": "2211",
"license": "mit",
"hash": -7928762590197847000,
"line_mean": 30.5857142857,
"line_max": 69,
"alpha_frac": 0.6218905473,
"autogenerated": false,
"ratio": 4.5030549898167,
"config_test": false,... |
from django.utils import translation
from django.conf import settings
from django.middleware.locale import LocaleMiddleware
from django.contrib.sites.models import Site
from django.http import HttpResponseRedirect
from preferences.models import Preference
def get_language_from_request(request, check_path=False):
... | {
"repo_name": "MauricioDinki/translating",
"path": "core/middlewares.py",
"copies": "2",
"size": "2336",
"license": "mit",
"hash": -4007517498017724000,
"line_mean": 35.5,
"line_max": 88,
"alpha_frac": 0.6502568493,
"autogenerated": false,
"ratio": 4.270566727605119,
"config_test": false,
"ha... |
from django.utils import translation
from django.conf import settings
from django.middleware.locale import LocaleMiddleware
# from django.contrib.sites.models import Site
#
# from django.http import HttpResponseRedirect
#
# from preferences.models import Preference
def get_language_from_request(request, check_path=Fa... | {
"repo_name": "Zero-Projects/Mozart",
"path": "mozart/core/middlewares.py",
"copies": "1",
"size": "2380",
"license": "bsd-3-clause",
"hash": -7995410127440915000,
"line_mean": 36.1875,
"line_max": 90,
"alpha_frac": 0.6382352941,
"autogenerated": false,
"ratio": 4.054514480408859,
"config_test"... |
from django.utils import translation
from django.conf import settings
from django.middleware.locale import LocaleMiddleware
class LocaleMiddlewareEx(LocaleMiddleware):
LANG_GET_KEY = 'lang'
def process_request(self, request):
check_path = self.is_language_prefix_patterns_used()
language = se... | {
"repo_name": "Nnonexistent/chemphys",
"path": "src/chemphys/middleware.py",
"copies": "1",
"size": "1031",
"license": "mit",
"hash": -6746723126964744000,
"line_mean": 29.3529411765,
"line_max": 123,
"alpha_frac": 0.6537342386,
"autogenerated": false,
"ratio": 4.091269841269841,
"config_test":... |
from django.utils import translation
from django.conf import settings
class TranslationErrorKey(str):
pass
class TranslationErrorValue(unicode):
pass
def get_current_language():
current_language = translation.get_language()
#TODO: Do magic
return current_language
def get_default_language():
... | {
"repo_name": "azdyb/django-transtrans",
"path": "transtrans/helpers.py",
"copies": "1",
"size": "1056",
"license": "bsd-2-clause",
"hash": 8342141314909346000,
"line_mean": 21.9565217391,
"line_max": 56,
"alpha_frac": 0.65625,
"autogenerated": false,
"ratio": 3.925650557620818,
"config_test": ... |
from django.utils import translation
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from django.contrib.auth.models import SiteProfileNotAvailable
from userena import settings as userena_settings
class UserenaLocaleMiddleware(object):
"""
Set the language by looking at ... | {
"repo_name": "matachi/django-userena",
"path": "userena/middleware.py",
"copies": "14",
"size": "1187",
"license": "bsd-3-clause",
"hash": 808197246606322200,
"line_mean": 38.5666666667,
"line_max": 88,
"alpha_frac": 0.6394271272,
"autogenerated": false,
"ratio": 5.138528138528138,
"config_tes... |
from django.utils import translation
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from django.utils.deprecation import MiddlewareMixin
from userena import settings as userena_settings
from userena.compat import SiteProfileNotAvailable
from userena.utils import get_user_profile... | {
"repo_name": "RDXT/django-userena",
"path": "userena/middleware.py",
"copies": "1",
"size": "1290",
"license": "bsd-3-clause",
"hash": -1674416286678362600,
"line_mean": 38.0909090909,
"line_max": 88,
"alpha_frac": 0.6581395349,
"autogenerated": false,
"ratio": 5.0390625,
"config_test": false,... |
from django.utils import translation
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from userena import settings as userena_settings
from userena.compat import SiteProfileNotAvailable
from userena.utils import get_user_profile
class UserenaLocaleMiddleware(object):
"""
... | {
"repo_name": "ugoertz/django-userena",
"path": "userena/middleware.py",
"copies": "12",
"size": "1228",
"license": "bsd-3-clause",
"hash": -4375690484558129000,
"line_mean": 37.375,
"line_max": 88,
"alpha_frac": 0.6457654723,
"autogenerated": false,
"ratio": 5.032786885245901,
"config_test": f... |
from django.utils import translation
from django import http
from django.conf import settings
from django.views.generic.base import TemplateView
from django.contrib.admin.templatetags.admin_list import results
from let_me_play import forms
from django.core.urlresolvers import reverse
from django.utils.translation impor... | {
"repo_name": "oleg-chubin/let_me_play",
"path": "let_me_play/views.py",
"copies": "1",
"size": "1066",
"license": "apache-2.0",
"hash": 2291722865159746300,
"line_mean": 37.0714285714,
"line_max": 79,
"alpha_frac": 0.6707317073,
"autogenerated": false,
"ratio": 3.7403508771929825,
"config_test... |
from django.utils import translation
from django.shortcuts import render, render_to_response
from django.core.urlresolvers import reverse
from django.utils.six.moves.urllib.parse import urlparse
from django.http import HttpResponseRedirect
from django.views.decorators.csrf import csrf_protect #CSRF attack prevention
fr... | {
"repo_name": "tfiers/arenberg-online",
"path": "core/views.py",
"copies": "1",
"size": "14185",
"license": "mit",
"hash": -6123766773322727000,
"line_mean": 43.8924050633,
"line_max": 166,
"alpha_frac": 0.6506873458,
"autogenerated": false,
"ratio": 3.9163445610160132,
"config_test": false,
... |
from django.utils import translation
from django.utils.encoding import force_text
from django.utils.http import urlsafe_base64_decode
from django.utils.translation import ugettext
import colorgram
from elasticsearch_dsl import Q, query
from rest_framework import serializers
from rest_framework.filters import BaseFilte... | {
"repo_name": "psiinon/addons-server",
"path": "src/olympia/search/filters.py",
"copies": "1",
"size": "37118",
"license": "bsd-3-clause",
"hash": 8266519762358068000,
"line_mean": 39.0842332613,
"line_max": 79,
"alpha_frac": 0.5607252546,
"autogenerated": false,
"ratio": 4.312536307656559,
"co... |
from django.utils import translation
from django.utils.translation import gettext_lazy as _
from geotrek.common.tests import CommonTest
from geotrek.sensitivity.models import SensitiveArea
from geotrek.sensitivity.factories import (SensitiveAreaFactory, SpeciesFactory, SportPracticeFactory,
... | {
"repo_name": "makinacorpus/Geotrek",
"path": "geotrek/sensitivity/tests/test_functional.py",
"copies": "2",
"size": "5185",
"license": "bsd-2-clause",
"hash": 3633429734828565000,
"line_mean": 34.7586206897,
"line_max": 113,
"alpha_frac": 0.5552555448,
"autogenerated": false,
"ratio": 3.55380397... |
from django.utils import translation
from django.utils.translation import gettext_noop
from i18nfield.strings import LazyI18nString
def test_explicit_translation():
data = {
'de': 'Hallo',
'en': 'Hello'
}
s = LazyI18nString(data)
translation.activate('en')
assert str(s) == 'Hello'... | {
"repo_name": "raphaelm/django-i18nfield",
"path": "tests/test_strings.py",
"copies": "1",
"size": "3231",
"license": "apache-2.0",
"hash": 8556095002727174000,
"line_mean": 20.8310810811,
"line_max": 49,
"alpha_frac": 0.5605075828,
"autogenerated": false,
"ratio": 3.0859598853868193,
"config_t... |
from django.utils import translation
from django.utils.translation import ugettext as _, ugettext_noop
from corehq.apps.sms.api import send_sms, send_sms_to_verified_number
from corehq.apps.sms.mixin import VerifiedNumber, MobileBackend
from corehq.apps.users.models import CommCareUser
from corehq.apps.sms import util
... | {
"repo_name": "SEL-Columbia/commcare-hq",
"path": "corehq/apps/sms/verify.py",
"copies": "1",
"size": "2008",
"license": "bsd-3-clause",
"hash": -6785924116419732000,
"line_mean": 38.3725490196,
"line_max": 149,
"alpha_frac": 0.703685259,
"autogenerated": false,
"ratio": 3.4680483592400693,
"co... |
from django.utils import translation
from django.utils.translation import ugettext
from elasticsearch_dsl import Q, query
from rest_framework import serializers
from rest_framework.filters import BaseFilterBackend
import waffle
from olympia import amo
from olympia.addons.indexers import WEBEXTENSIONS_WEIGHT
from olym... | {
"repo_name": "tsl143/addons-server",
"path": "src/olympia/search/filters.py",
"copies": "1",
"size": "19458",
"license": "bsd-3-clause",
"hash": 6753770969108418000,
"line_mean": 36.9298245614,
"line_max": 79,
"alpha_frac": 0.596721143,
"autogenerated": false,
"ratio": 4.204407951598963,
"conf... |
from django.utils import translation
from django.utils.translation import ugettext
import waffle
from elasticsearch_dsl import Q, query
from rest_framework import serializers
from rest_framework.filters import BaseFilterBackend
from olympia import amo
from olympia.addons.indexers import WEBEXTENSIONS_WEIGHT
from oly... | {
"repo_name": "atiqueahmedziad/addons-server",
"path": "src/olympia/search/filters.py",
"copies": "3",
"size": "22078",
"license": "bsd-3-clause",
"hash": 3146181257644073500,
"line_mean": 37.1312607945,
"line_max": 79,
"alpha_frac": 0.5986502401,
"autogenerated": false,
"ratio": 4.17748344370860... |
from django.utils import translation
from parler.models import TranslationDoesNotExist
from .utils import AppTestCase
from .testapp.models import SimpleModel, AnyLanguageModel, EmptyModel, NotRequiredModel
class ModelAttributeTests(AppTestCase):
"""
Test model construction
"""
def test_untranslated_g... | {
"repo_name": "django-parler/django-parler",
"path": "parler/tests/test_model_attributes.py",
"copies": "2",
"size": "12317",
"license": "apache-2.0",
"hash": -1974639725554833200,
"line_mean": 36.6666666667,
"line_max": 161,
"alpha_frac": 0.6149224649,
"autogenerated": false,
"ratio": 3.93891909... |
from django.utils import translation
from corehq.util.translation import localize
from custom.ilsgateway.tanzania.reminders import LANGUAGE_CONFIRM, LANGUAGE_UNKNOWN, HELP_REGISTERED
from custom.ilsgateway.tests.handlers.utils import ILSTestScript
class ILSLanguageTest(ILSTestScript):
def _verify_language(self,... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "custom/ilsgateway/tests/handlers/language.py",
"copies": "1",
"size": "1770",
"license": "bsd-3-clause",
"hash": 3872617228082154000,
"line_mean": 35.875,
"line_max": 100,
"alpha_frac": 0.6079096045,
"autogenerated": false,
"ratio": 4.041095890410... |
from django.utils import translation
from elasticsearch_dsl import F, query
from elasticsearch_dsl.filter import Bool
from rest_framework.filters import BaseFilterBackend
from olympia import amo
from olympia.constants.categories import CATEGORIES, CATEGORIES_BY_ID
from olympia.versions.compare import version_int
de... | {
"repo_name": "Prashant-Surya/addons-server",
"path": "src/olympia/search/filters.py",
"copies": "1",
"size": "12683",
"license": "bsd-3-clause",
"hash": -8344402398761811000,
"line_mean": 36.3029411765,
"line_max": 79,
"alpha_frac": 0.6064811165,
"autogenerated": false,
"ratio": 4.17066754357119... |
from django.utils import translation
from elasticsearch_dsl import F, query
from elasticsearch_dsl.filter import Bool
from rest_framework.filters import BaseFilterBackend
from olympia import amo
def get_locale_analyzer(lang):
analyzer = amo.SEARCH_LANGUAGE_TO_ANALYZER.get(lang)
return analyzer
class Addon... | {
"repo_name": "andymckay/addons-server",
"path": "src/olympia/search/filters.py",
"copies": "2",
"size": "10153",
"license": "bsd-3-clause",
"hash": 4697920598918712000,
"line_mean": 35.92,
"line_max": 79,
"alpha_frac": 0.5998227125,
"autogenerated": false,
"ratio": 4.242791475135813,
"config_t... |
from django.utils import translation
from elasticsearch_dsl import F, query
from elasticsearch_dsl.filter import Bool
from rest_framework import serializers
from rest_framework.filters import BaseFilterBackend
import waffle
from olympia import amo
from olympia.addons.indexers import WEBEXTENSIONS_WEIGHT
from olympia.... | {
"repo_name": "harikishen/addons-server",
"path": "src/olympia/search/filters.py",
"copies": "1",
"size": "14233",
"license": "bsd-3-clause",
"hash": -3713226831329530000,
"line_mean": 37.0561497326,
"line_max": 79,
"alpha_frac": 0.6028244221,
"autogenerated": false,
"ratio": 4.203484937979917,
... |
from django.utils import translation
from jinja2 import DictLoader, Environment
def build_environment(template):
"""Create environment with newstyle gettext and autoescape"""
env = Environment(
autoescape=True,
loader=DictLoader({'tmpl.html': template}),
extensions=[
'puen... | {
"repo_name": "mozilla/puente",
"path": "tests/test_ext.py",
"copies": "1",
"size": "10476",
"license": "bsd-3-clause",
"hash": -5114210527881332000,
"line_mean": 37.3736263736,
"line_max": 115,
"alpha_frac": 0.4746086292,
"autogenerated": false,
"ratio": 3.378265075782006,
"config_test": true,... |
from django.utils import translation
from nose.tools import eq_
import test_utils
import amo.tests
from addons.models import Addon
from reviews import tasks
from reviews.models import check_spam, Review, GroupedRating, Spam
from users.models import UserProfile
class TestReviewModel(amo.tests.TestCase):
fixtures... | {
"repo_name": "anaran/olympia",
"path": "apps/reviews/tests/test_models.py",
"copies": "2",
"size": "3319",
"license": "bsd-3-clause",
"hash": -8041565458003525000,
"line_mean": 29.4495412844,
"line_max": 78,
"alpha_frac": 0.6260921964,
"autogenerated": false,
"ratio": 3.2317429406037,
"config_... |
from django.utils import translation
from nose.tools import eq_
import amo.tests
from addons.models import Addon
from reviews import tasks
from reviews.models import check_spam, Review, GroupedRating, Spam
from users.models import UserProfile
class TestReviewModel(amo.tests.TestCase):
fixtures = ['reviews/test_... | {
"repo_name": "SuriyaaKudoIsc/olympia",
"path": "apps/reviews/tests/test_models.py",
"copies": "1",
"size": "3620",
"license": "bsd-3-clause",
"hash": -5300722367782828000,
"line_mean": 28.4308943089,
"line_max": 78,
"alpha_frac": 0.6171270718,
"autogenerated": false,
"ratio": 3.267148014440433,
... |
from django.utils import translation
from olympia import amo
from olympia.amo.tests import TestCase, ESTestCase
from olympia.addons.models import Addon
from olympia.reviews import tasks
from olympia.reviews.models import (
check_spam, GroupedRating, Review, ReviewFlag, Spam)
from olympia.users.models import UserPr... | {
"repo_name": "Prashant-Surya/addons-server",
"path": "src/olympia/reviews/tests/test_models.py",
"copies": "1",
"size": "5498",
"license": "bsd-3-clause",
"hash": -6436686236674307000,
"line_mean": 31.9221556886,
"line_max": 78,
"alpha_frac": 0.623863223,
"autogenerated": false,
"ratio": 3.56088... |
from django.utils import translation
import jingo
from mock import Mock
from nose.tools import eq_
from amo.tests.test_helpers import render
def test_showing_helper():
translation.activate('en-US')
tpl = "{{ showing(query, tag, pager) }}"
pager = Mock()
pager.start_index = lambda: 1
pager.end_in... | {
"repo_name": "wagnerand/zamboni",
"path": "apps/search/tests/test_helpers.py",
"copies": "7",
"size": "1249",
"license": "bsd-3-clause",
"hash": -8256067174194938000,
"line_mean": 28.7380952381,
"line_max": 74,
"alpha_frac": 0.6020816653,
"autogenerated": false,
"ratio": 3.35752688172043,
"con... |
from django.utils import translation
import jingo
import pytest
from mock import Mock
from olympia.amo.tests.test_helpers import render
pytestmark = pytest.mark.django_db
def test_showing_helper():
translation.activate('en-US')
tpl = "{{ showing(query, tag, pager) }}"
pager = Mock()
pager.start_in... | {
"repo_name": "andymckay/olympia",
"path": "src/olympia/search/tests/test_helpers.py",
"copies": "2",
"size": "1337",
"license": "bsd-3-clause",
"hash": 4990280534857502000,
"line_mean": 26.8541666667,
"line_max": 76,
"alpha_frac": 0.5968586387,
"autogenerated": false,
"ratio": 3.3848101265822783... |
from django.utils import translation, timezone
from django.conf import settings as global_settings
import pytz
class ForumMiddleware(object):
def process_request(self, request):
if request.user.is_authenticated():
profile = request.user.forum_profile
language = translation.get_langu... | {
"repo_name": "hsoft/slimbb",
"path": "slimbb/middleware.py",
"copies": "1",
"size": "1096",
"license": "bsd-3-clause",
"hash": -907348754054551900,
"line_mean": 36.7931034483,
"line_max": 69,
"alpha_frac": 0.6350364964,
"autogenerated": false,
"ratio": 4.936936936936937,
"config_test": false,
... |
from django.utils import tree
import re
FILTER_CONTAINS = u'%(field)s:%(value)s'
FILTER_EXACT = u'%(field)s:"%(value)s"'
FILTER_COMPARE = {
'gt': u'%(field)s:{%(value)s TO *}',
'gte': u'%(field)s:[%(value)s TO *]',
'lt': u'%(field)s:{* TO %(value)s}',
'lte': u'%(field)s:[* TO %(value)s]',
}
FILTER_RANG... | {
"repo_name": "sophilabs/django-solr",
"path": "djangosolr/documents/query.py",
"copies": "1",
"size": "6125",
"license": "bsd-3-clause",
"hash": 692510127755410400,
"line_mean": 33.8011363636,
"line_max": 134,
"alpha_frac": 0.4688979592,
"autogenerated": false,
"ratio": 3.6545346062052504,
"co... |
from django.utils import unittest, importlib
from django.test import TestCase as DjangoTestCase
from django.test.client import RequestFactory
from django.conf import settings as project_settings
from django.core.exceptions import MiddlewareNotUsed
from django import template
from require_media.conf import settings
fro... | {
"repo_name": "jeffkistler/django-require-media",
"path": "src/require_media/tests.py",
"copies": "1",
"size": "19338",
"license": "bsd-3-clause",
"hash": 1420467385740606500,
"line_mean": 52.567867036,
"line_max": 219,
"alpha_frac": 0.6800599855,
"autogenerated": false,
"ratio": 4.19388418998048... |
from django.utils import unittest
from django.contrib.sites.models import Site
from dockit import backends
from dockit import schema
from dockit.tests.backends.common import BackendTestCase
from dockit.backends.djangodocument.models import RegisteredIndex, RegisteredIndexDocument, StringIndex
class Book(schema.Docum... | {
"repo_name": "zbyte64/django-dockit",
"path": "dockit/backends/djangodocument/tests.py",
"copies": "1",
"size": "6601",
"license": "bsd-3-clause",
"hash": 5437556952013088000,
"line_mean": 44.2123287671,
"line_max": 176,
"alpha_frac": 0.6477806393,
"autogenerated": false,
"ratio": 3.959808038392... |
from django.utils import unittest
from django import http
from cmsplugin_quotes.cms_plugins import RotatingQuotes, START_VAR
from cmsplugin_quotes.models import Quote
class DummyRequest(http.HttpRequest):
def __init__(self, GET=None):
super(DummyRequest, self).__init__()
self.method = GET and "GET... | {
"repo_name": "vilos/cmsplugin-quotes",
"path": "cmsplugin_quotes/tests/test_plugin.py",
"copies": "2",
"size": "2309",
"license": "bsd-3-clause",
"hash": 3859572090077641000,
"line_mean": 25.8488372093,
"line_max": 79,
"alpha_frac": 0.5331312256,
"autogenerated": false,
"ratio": 3.95376712328767... |
from django.utils import unittest
from django.template import Template, loader, Context
from mapomatic.models import MapPoint
class TemplateTestCase(unittest.TestCase):
def setUp(self):
MapPoint.objects.create(name='NYC', location='POINT(-73.9869510 40.7560540)')
MapPoint.objects.create(name='Atlan... | {
"repo_name": "sbnoemi/django-mapomatic",
"path": "mapomatic/tests.py",
"copies": "1",
"size": "1791",
"license": "bsd-3-clause",
"hash": -3677733443612318000,
"line_mean": 47.4324324324,
"line_max": 100,
"alpha_frac": 0.617532105,
"autogenerated": false,
"ratio": 3.5048923679060664,
"config_te... |
from django.utils import unittest
from django.test.client import Client
from django.test.simple import DjangoTestSuiteRunner
from django.core.urlresolvers import get_resolver, Resolver404
import simplejson
import logging
import mongoutils
class TestRunner(DjangoTestSuiteRunner):
def setup_databases(self,**kwargs)... | {
"repo_name": "ireapps/census",
"path": "censusweb/api/tests.py",
"copies": "1",
"size": "2729",
"license": "mit",
"hash": -7903467903484808000,
"line_mean": 31.1058823529,
"line_max": 67,
"alpha_frac": 0.5610113595,
"autogenerated": false,
"ratio": 3.723055934515689,
"config_test": true,
"ha... |
from django.utils import unittest
from django.test.client import RequestFactory, Client
import json
class ApiTestCase(unittest.TestCase):
def setUp(self):
pass
def test_one_plus_one(self):
one = 1
assert one == 1
class SendEmailIntegrationTests(unittest.TestCase):
def setUp(self... | {
"repo_name": "TangentMicroServices/EmailService",
"path": "api/tests.py",
"copies": "1",
"size": "1689",
"license": "mit",
"hash": 2495870014559199000,
"line_mean": 26.2419354839,
"line_max": 97,
"alpha_frac": 0.5902901125,
"autogenerated": false,
"ratio": 4.002369668246446,
"config_test": tru... |
from django.utils import unittest
from django.test.client import RequestFactory
from django.contrib.auth.models import User, AnonymousUser
from django.conf import settings
import logging
class DjangoHandlerTestCase(unittest.TestCase):
"""
Tests for Django integration - logging configuration etc.
This tes... | {
"repo_name": "yunojuno/django-errordite",
"path": "test_app/tests.py",
"copies": "1",
"size": "4162",
"license": "bsd-2-clause",
"hash": -2152782409160287000,
"line_mean": 39.4077669903,
"line_max": 76,
"alpha_frac": 0.6102835175,
"autogenerated": false,
"ratio": 4.3219106957424716,
"config_te... |
from django.utils import unittest
from django.test.client import RequestFactory
from django.contrib.auth.models import User
from django.contrib import admin
from dockit.admin.documentadmin import DocumentAdmin, SchemaAdmin
from common import SimpleDocument, SimpleSchema
class MockView:
def __init__(self, request... | {
"repo_name": "zbyte64/django-dockit",
"path": "dockit/tests/admin/documentadmin.py",
"copies": "1",
"size": "2952",
"license": "bsd-3-clause",
"hash": 3181480770063880000,
"line_mean": 40,
"line_max": 122,
"alpha_frac": 0.6531165312,
"autogenerated": false,
"ratio": 3.9730820995962315,
"config... |
from django.utils import unittest
from django.test import TestCase
from django.test.client import Client
from website.models import Jurisdiction
from django.conf import settings
class AHJUrlsTestCase(TestCase):
def test_ahj_urls(self):
j = Jurisdiction.objects.create(city = "foo city",
... | {
"repo_name": "solarpermit/solarpermit",
"path": "website/tests/test_ahj_urls.py",
"copies": "1",
"size": "1121",
"license": "bsd-3-clause",
"hash": 8032731335973533000,
"line_mean": 42.1153846154,
"line_max": 65,
"alpha_frac": 0.506690455,
"autogenerated": false,
"ratio": 4.632231404958677,
"c... |
from django.utils import unittest
from django_toolkit.csv.unicode import UnicodeWriter, UnicodeReader, CastingUnicodeWriter
from tempfile import NamedTemporaryFile
class UnicodeWriterTestCase(unittest.TestCase):
def test_write(self):
f = NamedTemporaryFile(mode='w+')
csv_writer = UnicodeWriter(f,... | {
"repo_name": "alexhayes/django-toolkit",
"path": "django_toolkit/tests/csv/unicode.py",
"copies": "1",
"size": "1679",
"license": "mit",
"hash": 2127023869639980500,
"line_mean": 31.2884615385,
"line_max": 89,
"alpha_frac": 0.5789160214,
"autogenerated": false,
"ratio": 3.8955916473317864,
"co... |
from django.utils import unittest
from django_toolkit.markup.html import get_anchor_href, get_anchor_contents
class HtmlGetAnchorHrefTestCase(unittest.TestCase):
def test_finds_single_href(self):
self.assertEquals(
get_anchor_href('<a href="http://example.com">Test</a>'),
[u'http:... | {
"repo_name": "alexhayes/django-toolkit",
"path": "django_toolkit/tests/markup.py",
"copies": "1",
"size": "2046",
"license": "mit",
"hash": 6346397216027184000,
"line_mean": 35.5357142857,
"line_max": 136,
"alpha_frac": 0.5904203324,
"autogenerated": false,
"ratio": 3.4677966101694917,
"config... |
from django.utils import unittest
from django_toolkit.tests.testapp.models import ModelWithChainedQuerySet
class QuerySetManagerTestCase(unittest.TestCase):
def test_chaining(self):
ModelWithChainedQuerySet.objects.bulk_create([
ModelWithChainedQuerySet(foo=False, bar=False),
Mode... | {
"repo_name": "alexhayes/django-toolkit",
"path": "django_toolkit/tests/db/models.py",
"copies": "1",
"size": "1163",
"license": "mit",
"hash": 1850252652595582200,
"line_mean": 54.380952381,
"line_max": 91,
"alpha_frac": 0.7119518487,
"autogenerated": false,
"ratio": 3.763754045307443,
"config... |
from django.utils import unittest
from django_toolkit.url.resolve import url_with_protocol, resolve_url, \
DESKTOP_USER_AGENT, MOBILE_USER_AGENT
from httmock import all_requests, HTTMock, response
@all_requests
def response_content(url, request):
if request.headers['User-Agent'] == DESKTOP_USER_AGENT:
... | {
"repo_name": "alexhayes/django-toolkit",
"path": "django_toolkit/tests/url/resolve.py",
"copies": "1",
"size": "1651",
"license": "mit",
"hash": -8450132911357073000,
"line_mean": 32.693877551,
"line_max": 72,
"alpha_frac": 0.6414294367,
"autogenerated": false,
"ratio": 3.5277777777777777,
"co... |
from django.utils import unittest
from django.utils.termcolors import (parse_color_setting, PALETTES,
DEFAULT_PALETTE, LIGHT_PALETTE, DARK_PALETTE, NOCOLOR_PALETTE, colorize)
class TermColorTests(unittest.TestCase):
def test_empty_string(self):
self.assertEqual(parse_color_setting(''), PALETTES[DEFAU... | {
"repo_name": "Peddle/hue",
"path": "desktop/core/ext-py/Django-1.6.10/tests/utils_tests/test_termcolors.py",
"copies": "60",
"size": "7696",
"license": "apache-2.0",
"hash": 7110370803064340000,
"line_mean": 48.0191082803,
"line_max": 91,
"alpha_frac": 0.5339137214,
"autogenerated": false,
"rati... |
from django.utils import unittest
from django.utils.translation import activate as activate_language
import translatable
from models import Translatable, Translation
class BaseClassesTestCase(unittest.TestCase):
def test_is_translatable_model_abstract(self):
try:
abstract = translatable.models... | {
"repo_name": "artscoop/django-translatable",
"path": "tests/models/tests.py",
"copies": "1",
"size": "8557",
"license": "bsd-3-clause",
"hash": -7337507840107045000,
"line_mean": 40.7414634146,
"line_max": 99,
"alpha_frac": 0.6712632932,
"autogenerated": false,
"ratio": 4.213195470211718,
"con... |
from django.utils import unittest
from .models import *
class OceanStorySectionTestCase(unittest.TestCase):
def setUp(self):
self.section = OceanStorySection()
def testJsonMapState(self):
self.section.map_state = "{}"
self.assertEqual(self.section.parsed_map_state, {})
def testUrl... | {
"repo_name": "MidAtlanticPortal/marco-portal2",
"path": "marco/portal/ocean_stories/test.py",
"copies": "1",
"size": "1633",
"license": "isc",
"hash": 3119624579850073000,
"line_mean": 45.6571428571,
"line_max": 283,
"alpha_frac": 0.6178812002,
"autogenerated": false,
"ratio": 2.9370503597122304... |
from django.utils import unittest
from models_project.models import Group, Student
from django.test.client import Client
class SimpleTest(unittest.TestCase):
def setUp(self):
self.c = Client()
def test_login(self):
response = self.c.post('/auth/register/',
{'us... | {
"repo_name": "polinaleonova/Project_Students_DB",
"path": "models_project/tests.py",
"copies": "1",
"size": "1818",
"license": "mit",
"hash": -4940516577719166000,
"line_mean": 33.3018867925,
"line_max": 70,
"alpha_frac": 0.5253025303,
"autogenerated": false,
"ratio": 4.179310344827586,
"confi... |
from django.utils import unittest
from taggit.models import Tag
from bluebottle.accounts.tests import UserTestsMixin
from apps.organizations.tests import OrganizationTestsMixin
from apps.projects.tests import ProjectTestsMixin
class TestTags(unittest.TestCase, ProjectTestsMixin, OrganizationTestsMixin, UserTestsMixin... | {
"repo_name": "gannetson/sportschooldeopenlucht",
"path": "sportschool/tests/tags.py",
"copies": "1",
"size": "2077",
"license": "bsd-3-clause",
"hash": -6198132027178817000,
"line_mean": 30.4696969697,
"line_max": 93,
"alpha_frac": 0.6475686086,
"autogenerated": false,
"ratio": 4.129224652087475... |
from django.utils import unittest
import sys
import os
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.conf import settings
from django.core.files import File
from springboard.models import IntranetApplication
from alerts.models import Alert
import libs.test_utils as te... | {
"repo_name": "instituteofdesign/django-lms",
"path": "apps/springboard/tests.py",
"copies": "1",
"size": "1518",
"license": "bsd-3-clause",
"hash": -4967521156080583000,
"line_mean": 32,
"line_max": 70,
"alpha_frac": 0.6251646904,
"autogenerated": false,
"ratio": 4.170329670329671,
"config_tes... |
from django.utils import unittest
import sys
class RegistryProcessTestCase(unittest.TestCase):
def setUp(self):
"""
Start with a clean registry for each test.
"""
from test_appregister import models
models.registry = models.QuestionRegistry()
def test_register(self):... | {
"repo_name": "d0ugal-archive/django-appregister",
"path": "tests/test_appregister/tests.py",
"copies": "1",
"size": "9599",
"license": "mit",
"hash": 4533389627183533600,
"line_mean": 25.4435261708,
"line_max": 90,
"alpha_frac": 0.6382956558,
"autogenerated": false,
"ratio": 4.92508978963571,
... |
from django.utils import unittest
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.core.exceptions import ImproperlyConfigured
from newsletter.settings import newsletter_settings
class SettingsTestCase(TestCase):
@override_settings(N... | {
"repo_name": "Glasgow2015/team-10",
"path": "project/newsletter/tests/test_settings.py",
"copies": "4",
"size": "3471",
"license": "apache-2.0",
"hash": -1425339650746521300,
"line_mean": 32.6990291262,
"line_max": 78,
"alpha_frac": 0.6767502161,
"autogenerated": false,
"ratio": 4.02201622247972... |
from django.utils import unittest
import datetime
from django.contrib.auth.models import User
from .models import UserProfile, Mentorship, may_access_control, secret_society
def create_a_user(dict):
user = User.objects.create_user(
username=dict['username'],
first_name=dict['first_name'],
... | {
"repo_name": "kern3020/opportunity",
"path": "opportunity/tracker/tests.py",
"copies": "1",
"size": "4181",
"license": "mit",
"hash": -8728740595230356000,
"line_mean": 33.8416666667,
"line_max": 79,
"alpha_frac": 0.5448457307,
"autogenerated": false,
"ratio": 3.510495382031906,
"config_test":... |
from django.utils.log import AdminEmailHandler
from django.core.cache import get_cache
class ThrottledAdminEmailHandler(AdminEmailHandler):
# as of August 15, 2019 we're using the in-memory cache, which means that
# each worker (currently 4) has its own copy of this variable, so we'll
# actually send 4x as... | {
"repo_name": "ResEnv/chain-api",
"path": "chain/helpers/logging.py",
"copies": "1",
"size": "1043",
"license": "mit",
"hash": -9090629428189073000,
"line_mean": 36.25,
"line_max": 79,
"alpha_frac": 0.652924257,
"autogenerated": false,
"ratio": 3.8205128205128207,
"config_test": false,
"has_n... |
from django.utils.log import getLogger
from restthumbnails import processors, exceptions
from restthumbnails.base import ThumbnailBase
import os
logger = getLogger(__name__)
class ThumbnailFileBase(ThumbnailBase):
@property
def name(self):
raise NotImplementedError
@property
def path(self... | {
"repo_name": "hcarvalhoalves/django-rest-thumbnails",
"path": "restthumbnails/files.py",
"copies": "1",
"size": "2171",
"license": "bsd-3-clause",
"hash": -2317209359233318000,
"line_mean": 26.1375,
"line_max": 80,
"alpha_frac": 0.6172270843,
"autogenerated": false,
"ratio": 4.159003831417625,
... |
from django.utils.lru_cache import lru_cache
from manabi.apps.flashcards.models import (
CardHistory,
)
from manabi.apps.flashcards.models.constants import (
DEFAULT_TIME_ZONE,
NEW_CARDS_PER_DAY_LIMIT,
)
class NewCardsLimit:
'''
How many more new cards can the user learn today?
'''
def _... | {
"repo_name": "aehlke/manabi",
"path": "manabi/apps/flashcards/models/new_cards_limit.py",
"copies": "1",
"size": "1621",
"license": "mit",
"hash": -437376671908699500,
"line_mean": 26.4745762712,
"line_max": 76,
"alpha_frac": 0.6020974707,
"autogenerated": false,
"ratio": 3.377083333333333,
"c... |
from django.utils.module_loading import autodiscover_modules
from django.utils.translation import gettext as _
from .wizard_base import Wizard
class AlreadyRegisteredException(Exception):
pass
def entry_choices(user, page):
"""
Yields a list of wizard entries that the current user can use based on thei... | {
"repo_name": "rsalmaso/django-cms",
"path": "cms/wizards/wizard_pool.py",
"copies": "2",
"size": "3484",
"license": "bsd-3-clause",
"hash": 468277160648882700,
"line_mean": 28.2100840336,
"line_max": 80,
"alpha_frac": 0.5963751438,
"autogenerated": false,
"ratio": 4.450704225352113,
"config_te... |
from django.utils.module_loading import import_string
from contento.settings import CONTENTO_BACKEND
from django.core.urlresolvers import reverse_lazy
from contento.helpers import get_current_backend
class Registry(object):
"""
Content registry.
"""
def __init__(self, language=None, build=True):
... | {
"repo_name": "inmagik/contento",
"path": "contento/registry.py",
"copies": "1",
"size": "1161",
"license": "mit",
"hash": -5978971721017397000,
"line_mean": 27.3170731707,
"line_max": 80,
"alpha_frac": 0.5693367786,
"autogenerated": false,
"ratio": 3.962457337883959,
"config_test": false,
"h... |
from django.utils.module_loading import import_string
import json
import logging
from ..version import __version__
from ..util import log
from .base import BaseProvider
###################################
### JS Context Provider
class JsContextProvider(BaseProvider):
'''
Adds all js_context() variables to DM... | {
"repo_name": "doconix/django-mako-plus",
"path": "django_mako_plus/provider/context.py",
"copies": "1",
"size": "2543",
"license": "apache-2.0",
"hash": 7978148596370466000,
"line_mean": 36.3970588235,
"line_max": 119,
"alpha_frac": 0.5961462839,
"autogenerated": false,
"ratio": 4.16885245901639... |
from django.utils.module_loading import import_string
from django.shortcuts import Http404
from rest_framework.views import APIView
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework import status
class EditableContentView(APIView):
permission_cla... | {
"repo_name": "HurtowniaPixeli/pixelcms-server",
"path": "cms/live_admin/views.py",
"copies": "1",
"size": "1994",
"license": "mit",
"hash": -5650262376292679000,
"line_mean": 33.3793103448,
"line_max": 65,
"alpha_frac": 0.5677031093,
"autogenerated": false,
"ratio": 4.363238512035011,
"config_... |
from django.utils.module_loading import import_string
from djrichtextfield import settings
def noop(value):
return value
class SanitizerMixin:
"""
Get the field sanitizer from the provided kwargs during init, or from the settings.
"""
SANITIZER_KEY = 'sanitizer'
SANITIZER_PROFILES_KEY = 's... | {
"repo_name": "jaap3/django-richtextfield",
"path": "djrichtextfield/sanitizer.py",
"copies": "1",
"size": "1486",
"license": "mit",
"hash": -4740243769457588000,
"line_mean": 30.6170212766,
"line_max": 87,
"alpha_frac": 0.6393001346,
"autogenerated": false,
"ratio": 4.049046321525886,
"config_... |
from django.utils.module_loading import import_string
def _load(module):
return import_string(module) if isinstance(module, str) else module
class View(object):
"""
Позволяет организовать url для древовидных моделей
"""
def __init__(self, model, view, slug_field):
self.model = _load(mod... | {
"repo_name": "webadmin87/midnight",
"path": "midnight_main/mptt_urls.py",
"copies": "1",
"size": "1324",
"license": "bsd-3-clause",
"hash": 4431964735920561700,
"line_mean": 35.6285714286,
"line_max": 156,
"alpha_frac": 0.600624025,
"autogenerated": false,
"ratio": 3.8848484848484848,
"config_... |
from django.utils.module_loading import module_has_submodule
from django.utils.importlib import import_module
from celery.contrib.methods import task
from django.conf import settings
from .loaders import ExcelLoader, CSVLoader
from drift.loaders import Loader
default_queue = getattr(
settings,
'DRIFT_DEFAULT... | {
"repo_name": "monokrome/django-drift",
"path": "drift/importers.py",
"copies": "1",
"size": "5217",
"license": "mit",
"hash": -4716839982421542000,
"line_mean": 29.1560693642,
"line_max": 79,
"alpha_frac": 0.6193214491,
"autogenerated": false,
"ratio": 4.658035714285714,
"config_test": false,
... |
from django.utils._os import safe_join
import os
from django.conf import settings
from django.contrib.staticfiles.finders import FileSystemFinder
from bluebottle.clients.models import Client
class TenantStaticFilesFinder(FileSystemFinder):
def find(self, path, all=False):
"""
Looks for files in th... | {
"repo_name": "jfterpstra/bluebottle",
"path": "bluebottle/utils/staticfiles_finders.py",
"copies": "2",
"size": "1192",
"license": "bsd-3-clause",
"hash": 1089561849296188200,
"line_mean": 35.1212121212,
"line_max": 77,
"alpha_frac": 0.5645973154,
"autogenerated": false,
"ratio": 4.3823529411764... |
from django.utils.safestring import mark_safe
from cmsplugin_cascade.models import IconFont
from cmsplugin_cascade.plugin_base import CascadePluginMixinBase
from entangled.utils import get_related_object
class IconPluginMixin(CascadePluginMixinBase):
change_form_template = 'cascade/admin/change_form.html'
rin... | {
"repo_name": "jrief/djangocms-cascade",
"path": "cmsplugin_cascade/icon/plugin_base.py",
"copies": "1",
"size": "1324",
"license": "mit",
"hash": -3981324641494175000,
"line_mean": 44.6551724138,
"line_max": 88,
"alpha_frac": 0.6722054381,
"autogenerated": false,
"ratio": 3.7613636363636362,
"... |
from django.utils.safestring import mark_safe
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from cms.plugin_rendering import render_plugins
from stacks.fields import StackSearchField
from stacks.models import StackLink, Stack
fr... | {
"repo_name": "divio/djangocms-stacks",
"path": "stacks/cms_plugins.py",
"copies": "1",
"size": "1516",
"license": "bsd-3-clause",
"hash": -8331279202901723000,
"line_mean": 37.8717948718,
"line_max": 101,
"alpha_frac": 0.687994723,
"autogenerated": false,
"ratio": 4.119565217391305,
"config_te... |
from django.utils.safestring import mark_safe
from corehq.apps.data_interfaces.dispatcher import EditDataInterfaceDispatcher
from corehq.apps.groups.models import Group
from django.core.urlresolvers import reverse
from corehq.apps.reports import util
from corehq.apps.reports.datatables import DataTablesHeader, DataTabl... | {
"repo_name": "gmimano/commcaretest",
"path": "corehq/apps/data_interfaces/interfaces.py",
"copies": "1",
"size": "3559",
"license": "bsd-3-clause",
"hash": -145498357430235840,
"line_mean": 44.0506329114,
"line_max": 218,
"alpha_frac": 0.6824950829,
"autogenerated": false,
"ratio": 3.94567627494... |
from django.utils.safestring import mark_safe
from corehq.apps.indicators.admin import BaseIndicatorAdminInterface
from corehq.apps.indicators.admin.forms import (CouchIndicatorForm, CountUniqueCouchIndicatorForm,
MedianCouchIndicatorForm, SumLastEmittedCouchIndicatorForm... | {
"repo_name": "benrudolph/commcare-hq",
"path": "corehq/apps/indicators/admin/couch_indicators.py",
"copies": "5",
"size": "2884",
"license": "bsd-3-clause",
"hash": 8790977007086728000,
"line_mean": 49.5964912281,
"line_max": 116,
"alpha_frac": 0.73370319,
"autogenerated": false,
"ratio": 3.9184... |
from django.utils.safestring import mark_safe
from dimagi.utils.data.crud import TabularCRUDManager, BaseCRUDForm
from dimagi.utils.decorators.memoized import memoized
class BaseAdminHQTabularCRUDManager(TabularCRUDManager):
"""
All Tabular CRUD Managers for CoreHQ-based CRUD should extend this.
"""
... | {
"repo_name": "benrudolph/commcare-hq",
"path": "corehq/apps/crud/models.py",
"copies": "4",
"size": "1749",
"license": "bsd-3-clause",
"hash": 6532869784308298000,
"line_mean": 30.2321428571,
"line_max": 99,
"alpha_frac": 0.6375071469,
"autogenerated": false,
"ratio": 3.939189189189189,
"confi... |
from django.utils.safestring import mark_safe
from dimagi.utils.data.crud import TabularCRUDManager, BaseCRUDForm
from dimagi.utils.decorators.memoized import memoized
class BaseAdminHQTabularCRUDManager(TabularCRUDManager):
"""
All Tabular CRUD Managers for CoreHQ-based CRUD should extend this.
"""
... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/apps/crud/models.py",
"copies": "1",
"size": "1758",
"license": "bsd-3-clause",
"hash": -3741919602445222400,
"line_mean": 29.8421052632,
"line_max": 99,
"alpha_frac": 0.6376564278,
"autogenerated": false,
"ratio": 3.9328859060402683,
"co... |
from django.utils.safestring import mark_safe
from django.conf import settings
from django.core.cache import cache
from django.db.models.loading import get_model
from cms.models import Page
from menus.base import NavigationNode
from menus.menu_pool import menu_pool
from menus.base import Modifier
from arkestra_utili... | {
"repo_name": "bubenkoff/Arkestra",
"path": "arkestra_utilities/menu.py",
"copies": "2",
"size": "8488",
"license": "bsd-2-clause",
"hash": 7798788402573339000,
"line_mean": 37.0627802691,
"line_max": 79,
"alpha_frac": 0.5279217719,
"autogenerated": false,
"ratio": 4.295546558704453,
"config_te... |
from django.utils.safestring import mark_safe
from django.forms import ChoiceField
from treemenus.models import MenuItem
class MenuItemChoiceField(ChoiceField):
''' Custom field to display the list of items in a tree manner '''
def clean(self, value):
return MenuItem.objects.get(pk=value)
def move_... | {
"repo_name": "sandow-digital/django-treemenus",
"path": "treemenus/utils.py",
"copies": "3",
"size": "2193",
"license": "bsd-3-clause",
"hash": -7995105565216761000,
"line_mean": 33.265625,
"line_max": 136,
"alpha_frac": 0.6484268126,
"autogenerated": false,
"ratio": 3.716949152542373,
"config... |
from django.utils.safestring import mark_safe
from django.forms import ChoiceField
from treemenusplus.models import MenuItem
class MenuItemChoiceField(ChoiceField):
''' Custom field to display the list of items in a tree manner '''
def clean(self, value):
return MenuItem.objects.get(pk=value)
def m... | {
"repo_name": "artscoop/django-treemenus-plus",
"path": "treemenusplus/utils.py",
"copies": "1",
"size": "2197",
"license": "bsd-3-clause",
"hash": -2789958354672491000,
"line_mean": 33.328125,
"line_max": 136,
"alpha_frac": 0.6490669094,
"autogenerated": false,
"ratio": 3.7174280879864634,
"co... |
from django.utils.safestring import mark_safe
from django.forms.util import flatatt
from django.forms.widgets import TextInput, Widget
class CommaSeparatedInput(TextInput):
def render(self, name, value, attrs=None):
if isinstance(value, list):
value = ', '.join(value)
return super(Comm... | {
"repo_name": "grischa/mytardis-mrtardis",
"path": "tardis/tardis_portal/widgets.py",
"copies": "1",
"size": "1151",
"license": "bsd-3-clause",
"hash": 4292871708829952000,
"line_mean": 33.8787878788,
"line_max": 75,
"alpha_frac": 0.5238922676,
"autogenerated": false,
"ratio": 4.278810408921933,
... |
from django.utils.safestring import mark_safe
from django.forms.util import flatatt
from django.forms.widgets import TextInput, Widget
class CommaSeparatedInput(TextInput):
def render(self, name, value, attrs=None):
if isinstance(value, list):
value = ', '.join(value)
return super(Com... | {
"repo_name": "eresearchrmit/hpctardis",
"path": "tardis/tardis_portal/widgets.py",
"copies": "9",
"size": "1152",
"license": "bsd-3-clause",
"hash": 5117354418689126000,
"line_mean": 32.8823529412,
"line_max": 75,
"alpha_frac": 0.5234375,
"autogenerated": false,
"ratio": 4.282527881040892,
"co... |
from django.utils.safestring import mark_safe
from django.forms.widgets import Media, media_property
from django.utils.copycompat import deepcopy
from declarative import *
from .entry import *
##
# This is used to build a set of entries on Nav classes. Refer to
# django/forms/forms.py for the original.
class Declara... | {
"repo_name": "furious-luke/django-lightnav",
"path": "lightnav/nav.py",
"copies": "1",
"size": "1453",
"license": "bsd-3-clause",
"hash": 239387698374547420,
"line_mean": 26.9423076923,
"line_max": 92,
"alpha_frac": 0.6600137646,
"autogenerated": false,
"ratio": 3.8643617021276597,
"config_tes... |
from django.utils.safestring import mark_safe
from django import forms
import json as simmplejson
from django.utils.encoding import force_text
from django.utils.encoding import python_2_unicode_compatible
try:
from django.utils.encoding import StrAndUnicode
except ImportError:
from django.utils.encoding import... | {
"repo_name": "CARocha/plataforma_fadcanic",
"path": "actividades/formutils/forms.py",
"copies": "3",
"size": "4703",
"license": "mit",
"hash": 4767625286662241000,
"line_mean": 39.9043478261,
"line_max": 130,
"alpha_frac": 0.4163300021,
"autogenerated": false,
"ratio": 4.774619289340102,
"conf... |
from django.utils.safestring import mark_safe
from django import forms
class ForeignKeyAsTextWidget(forms.HiddenInput):
def __init__(self, append_text, *args, **kwargs):
self.append_text = append_text
super(ForeignKeyAsTextWidget, self).__init__()
def render(self, *args, **kwargs):
fi... | {
"repo_name": "django-de/django-de-v2",
"path": "django_de/apps/ticker/admin/widgets.py",
"copies": "1",
"size": "2101",
"license": "bsd-3-clause",
"hash": 3254119537976715000,
"line_mean": 33.4590163934,
"line_max": 90,
"alpha_frac": 0.5292717753,
"autogenerated": false,
"ratio": 4.0559845559845... |
from django.utils.safestring import mark_safe
from django import forms
class DjangoAdminMultiselect(forms.SelectMultiple):
class Media:
extend = False
css = {
'all': ('css/django-admin-multiselect.css',)
}
js = ('js/django-admin-multiselect.js', )
def render(self, ... | {
"repo_name": "kreioslu/django-admin-multiselect",
"path": "admin_multiselect/widgets.py",
"copies": "2",
"size": "2437",
"license": "mit",
"hash": 9145725174131627000,
"line_mean": 31.9324324324,
"line_max": 116,
"alpha_frac": 0.5777595404,
"autogenerated": false,
"ratio": 3.4567375886524823,
... |
from django.utils.safestring import mark_safe
from django import forms
class ReviewForm(forms.Form):
campus_audience = forms.CharField(
widget=forms.widgets.Textarea(),
label='What UW audiences does your application target?')
campus_need = forms.CharField(
widget=forms.widgets.Textarea... | {
"repo_name": "uw-it-aca/mdot-developers",
"path": "mdotdevs/forms.py",
"copies": "1",
"size": "2087",
"license": "apache-2.0",
"hash": -4108817058621531600,
"line_mean": 39.1346153846,
"line_max": 73,
"alpha_frac": 0.6276952563,
"autogenerated": false,
"ratio": 3.967680608365019,
"config_test"... |
# from django.utils.safestring import mark_safe
from django.shortcuts import render,redirect
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.decorators import login_required
from django.db.models import Count
from django.http import JsonResponse
from account.forms import UserCreatio... | {
"repo_name": "topaz1874/srvup",
"path": "src/srvup/views.py",
"copies": "1",
"size": "2612",
"license": "mit",
"hash": -8770092535428948000,
"line_mean": 34.7808219178,
"line_max": 77,
"alpha_frac": 0.6428024502,
"autogenerated": false,
"ratio": 3.8811292719167905,
"config_test": false,
"has... |
from django.utils.safestring import mark_safe
from django.template import Context, Template, RequestContext
from django.template.context_processors import csrf
from django.http import HttpResponse
from django.shortcuts import *
from launchlist.models import *
from launchlist.itemdict import *
from math import *
butto... | {
"repo_name": "tachk/LaunchList",
"path": "launchlist/views.py",
"copies": "1",
"size": "9871",
"license": "mit",
"hash": 7096023687997990000,
"line_mean": 45.7867298578,
"line_max": 236,
"alpha_frac": 0.6786546449,
"autogenerated": false,
"ratio": 3.917063492063492,
"config_test": false,
"ha... |
from django.utils.safestring import mark_safe
from django.template import Library
from django.contrib.auth.models import User
import json
register = Library()
@register.filter(is_safe=True)
def js(obj):
return mark_safe(json.dumps(obj))
@register.filter(name='lookup')
def lookup(d, key):
return d[key]
@regis... | {
"repo_name": "ejerzyk/editBoard",
"path": "BDHapp/accounts/templatetags/custom_filters.py",
"copies": "1",
"size": "1664",
"license": "apache-2.0",
"hash": 7249642604120761000,
"line_mean": 25.015625,
"line_max": 63,
"alpha_frac": 0.6766826923,
"autogenerated": false,
"ratio": 2.8689655172413793... |
from django.utils.safestring import mark_safe
from django.template import Library
from django.template import Node
from django.utils.html import escape
register = Library()
class CsrfTokenNode(Node):
""" Provide safer CSRF Token Node """
def render(self, context):
csrf_token = context.get('csrf_token... | {
"repo_name": "mozilla/FlightDeck",
"path": "apps/base/templatetags/safe_csrf.py",
"copies": "1",
"size": "1282",
"license": "bsd-3-clause",
"hash": -8312637485981335000,
"line_mean": 35.6285714286,
"line_max": 78,
"alpha_frac": 0.5787831513,
"autogenerated": false,
"ratio": 4.530035335689046,
... |
from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
from django.conf.urls import patterns
from datetime import datetime, timedelta
def tiles():
return []
# weather = get_weather()
# return [(30, render_to_string('tile.html', {
# 'url': '',
# ... | {
"repo_name": "boxed/CMi",
"path": "web_frontend/CMi/weather/api.py",
"copies": "1",
"size": "3304",
"license": "mit",
"hash": 5406244991098887000,
"line_mean": 31.0873786408,
"line_max": 129,
"alpha_frac": 0.5487288136,
"autogenerated": false,
"ratio": 3.729119638826185,
"config_test": false,
... |
from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
from django.forms import Textarea
from django.conf import settings
from cms.utils import cms_static_url
from cms.plugins.text import settings as text_settings
from django.utils.translation.trans_real import get_language
... | {
"repo_name": "ITrex/cmsplugin-newsplus",
"path": "cmsplugin_newsplus/widgets/wymeditor_widget.py",
"copies": "4",
"size": "2034",
"license": "bsd-2-clause",
"hash": 2454751669108106000,
"line_mean": 38.1153846154,
"line_max": 78,
"alpha_frac": 0.6401179941,
"autogenerated": false,
"ratio": 3.555... |
from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
from ..mixins import ModelPathBaseMixin
class BasicLayoutBackend(ModelPathBaseMixin):
"""
Look up model templates using model inheritance as a directory structure.
This is the default backend. Template look... | {
"repo_name": "armstrong/armstrong.core.arm_layout",
"path": "armstrong/core/arm_layout/backends/basic.py",
"copies": "1",
"size": "1396",
"license": "apache-2.0",
"hash": 327021734054427140,
"line_mean": 33.9,
"line_max": 77,
"alpha_frac": 0.6504297994,
"autogenerated": false,
"ratio": 4.2691131... |
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
from django.contrib.sites.models import Site
from django.conf import settings
from django.utils.translation import ugettext as _
from django.template.loader import render_to_string
from django.forms.widgets import Select, Mult... | {
"repo_name": "dibaunaumh/tikal-corp-website",
"path": "cms/forms/widgets.py",
"copies": "1",
"size": "8762",
"license": "bsd-3-clause",
"hash": -3894378405244227600,
"line_mean": 39.1972477064,
"line_max": 157,
"alpha_frac": 0.5685916457,
"autogenerated": false,
"ratio": 3.9415204678362574,
"c... |
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
from django import http
from djpcms.utils.ajax import jsonbase, jservererror
def saferender(f):
def wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)
except Exception, e:
... | {
"repo_name": "strogo/djpcms",
"path": "djpcms/utils/deco.py",
"copies": "1",
"size": "1166",
"license": "bsd-3-clause",
"hash": -1110438810164878300,
"line_mean": 28.175,
"line_max": 84,
"alpha_frac": 0.5823327616,
"autogenerated": false,
"ratio": 4.51937984496124,
"config_test": false,
"has... |
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
class LiteralToken(unicode):
"""
Represents a literal token (i.e. some text).
"""
class VariableToken(object):
"""
Represents a variable token (i.e. a placeholder).
"""
def __init__(self, key, v... | {
"repo_name": "bradleyayers/django-tokenfield",
"path": "django_tokenfield/utils.py",
"copies": "1",
"size": "1209",
"license": "bsd-2-clause",
"hash": 3728814314817685500,
"line_mean": 26.4772727273,
"line_max": 79,
"alpha_frac": 0.582299421,
"autogenerated": false,
"ratio": 4.112244897959184,
... |
from django.utils.safestring import mark_safe
from django.utils.html import escape, conditional_escape
from django.utils.encoding import force_unicode
from django.forms.widgets import ClearableFileInput, Input, CheckboxInput
class CustomClearableFileInput(ClearableFileInput):
"""A custom ClearableFileInput widget... | {
"repo_name": "timlinux/inasafe-django",
"path": "django_project/user_map/forms/custom_widget.py",
"copies": "4",
"size": "1846",
"license": "bsd-2-clause",
"hash": -7708532893213961000,
"line_mean": 45.15,
"line_max": 78,
"alpha_frac": 0.5964247021,
"autogenerated": false,
"ratio": 4.42685851318... |
from django.utils.safestring import mark_safe
from django.utils.html import format_html, format_html_join
from django.conf import settings
from wagtail.wagtailcore import hooks
from wagtail.wagtailcore.whitelist import attribute_rule, check_url, allow_without_attributes
@hooks.register('construct_whitelister_element_... | {
"repo_name": "DonaldTrumpHasTinyHands/tiny_hands_pac",
"path": "pages/wagtail_hooks.py",
"copies": "2",
"size": "1437",
"license": "mit",
"hash": -7271500961624324000,
"line_mean": 30.2608695652,
"line_max": 115,
"alpha_frac": 0.6541405706,
"autogenerated": false,
"ratio": 3.72279792746114,
"c... |
from django.utils.safestring import mark_safe
from django.utils.six import text_type
from django_select2.views import NO_ERR_RESP
from django.core.exceptions import ValidationError
from django_select2.widgets import AutoHeavySelect2Widget
from django_select2.fields import AutoSelect2MultipleField, AutoModelSelect2Field... | {
"repo_name": "savioabuga/phoenix",
"path": "phoenix/animals/fields.py",
"copies": "1",
"size": "1531",
"license": "bsd-3-clause",
"hash": -4609620735604784000,
"line_mean": 32.2826086957,
"line_max": 107,
"alpha_frac": 0.7237099935,
"autogenerated": false,
"ratio": 3.645238095238095,
"config_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.