text stringlengths 0 1.05M | meta dict |
|---|---|
from django.urls import reverse
from moviesapp.models import List, Movie
from .base import BaseTestLoginCase
class AddMoviesTestCase(BaseTestLoginCase):
"""
Test Add Movies.
Dumpdata commands:
manage dumpdata moviesapp.Movie --indent 2 > moviesapp/fixtures/movies.json
manage dumpdata moviesapp.... | {
"repo_name": "desecho/movies",
"path": "src/moviesapp/tests/test_list.py",
"copies": "1",
"size": "2330",
"license": "mit",
"hash": -7916947317946891000,
"line_mean": 34.8461538462,
"line_max": 94,
"alpha_frac": 0.6231759657,
"autogenerated": false,
"ratio": 3.5846153846153848,
"config_test": ... |
from django.urls import reverse
from nucleus.models import TeamMember
from social_core.pipeline.partial import partial
@partial
def require_email(strategy, details, user=None, is_new=False, request=None, *args, **kwargs):
if user and user.email:
return
elif is_new and not details.get('email'):
... | {
"repo_name": "prattl/wepickheroes",
"path": "api/wph/social/pipeline.py",
"copies": "1",
"size": "1060",
"license": "mit",
"hash": 6059503013596722000,
"line_mean": 27.6486486486,
"line_max": 93,
"alpha_frac": 0.5726415094,
"autogenerated": false,
"ratio": 4.223107569721115,
"config_test": fal... |
from django.urls import reverse
from olympia import amo
from olympia.amo.tests import addon_factory, TestCase, user_factory, version_factory
from olympia.amo.tests.test_helpers import get_uploaded_file
from olympia.amo.reverse import django_reverse
from olympia.constants.promoted import (
LINE,
RECOMMENDED,
... | {
"repo_name": "wagnerand/addons-server",
"path": "src/olympia/promoted/tests/test_admin.py",
"copies": "4",
"size": "22307",
"license": "bsd-3-clause",
"hash": -4002553367191968000,
"line_mean": 39.7550274223,
"line_max": 88,
"alpha_frac": 0.5833669762,
"autogenerated": false,
"ratio": 3.96813812... |
from django.urls import reverse
from plans.models import UserPlan
def account_status(request):
"""
Set following ``RequestContext`` variables:
* ``ACCOUNT_EXPIRED = boolean``, account was expired state,
* ``ACCOUNT_NOT_ACTIVE = boolean``, set when account is not expired, but it is over quotas so i... | {
"repo_name": "cypreess/django-plans",
"path": "plans/context_processors.py",
"copies": "1",
"size": "1199",
"license": "mit",
"hash": -6070162032465419000,
"line_mean": 37.6774193548,
"line_max": 104,
"alpha_frac": 0.5896580484,
"autogenerated": false,
"ratio": 4.36,
"config_test": false,
"h... |
from django.urls import reverse
from pyquery import PyQuery as pq
from olympia.amo.tests import TestCase, addon_factory, user_factory
class TestVersionAdmin(TestCase):
def test_authorized_user_has_access(self):
addon = addon_factory()
version = addon.current_version
detail_url = reverse(... | {
"repo_name": "mozilla/addons-server",
"path": "src/olympia/versions/tests/test_admin.py",
"copies": "4",
"size": "1140",
"license": "bsd-3-clause",
"hash": 9028592924857741000,
"line_mean": 38.3103448276,
"line_max": 81,
"alpha_frac": 0.6745614035,
"autogenerated": false,
"ratio": 3.8,
"config... |
from django.urls import reverse
from rest_framework import generics
from rest_framework import serializers, viewsets
from rest_framework import mixins
from rest_framework import permissions
from studygroups.models import Feedback
from studygroups.models import StudyGroup
from studygroups.models import TeamMembership
... | {
"repo_name": "p2pu/learning-circles",
"path": "studygroups/views/drf.py",
"copies": "1",
"size": "3302",
"license": "mit",
"hash": -3888959166791147500,
"line_mean": 37.3953488372,
"line_max": 177,
"alpha_frac": 0.7104784979,
"autogenerated": false,
"ratio": 4.086633663366337,
"config_test": f... |
from django.urls import reverse
from rest_framework import serializers
from backend.cases.models import (
Case,
Candidate,
Nodule,
)
from backend.images.models import (
ImageFile,
ImageSeries,
ImageLocation,
)
class ImageFileSerializer(serializers.ModelSerializer):
""" Serializes an Imag... | {
"repo_name": "vessemer/concept-to-clinic",
"path": "interface/backend/api/serializers.py",
"copies": "1",
"size": "3697",
"license": "mit",
"hash": -7789642161114083000,
"line_mean": 30.3305084746,
"line_max": 85,
"alpha_frac": 0.6651338923,
"autogenerated": false,
"ratio": 4.313885647607934,
... |
from django.urls import reverse
from rest_framework import serializers
from common.utils import full_url
from data_import.models import DataFile, DataType
from data_import.serializers import DataFileSerializer
from .models import DataRequestProject, DataRequestProjectMember
class ProjectDataSerializer(serializers.... | {
"repo_name": "PersonalGenomesOrg/open-humans",
"path": "private_sharing/serializers.py",
"copies": "2",
"size": "5181",
"license": "mit",
"hash": 2836961483263013000,
"line_mean": 29.298245614,
"line_max": 90,
"alpha_frac": 0.5929357267,
"autogenerated": false,
"ratio": 4.505217391304348,
"con... |
from django.urls import reverse
from rest_framework import serializers, viewsets
from rest_framework import generics
import pytz
import datetime
from django.utils import timezone
from django.contrib.auth.models import User
from .models import Event
# Serializers define the API representation.
class UserSerializer... | {
"repo_name": "p2pu/learning-circles",
"path": "community_calendar/api.py",
"copies": "1",
"size": "2651",
"license": "mit",
"hash": -1644976184984718300,
"line_mean": 27.8152173913,
"line_max": 135,
"alpha_frac": 0.6118445869,
"autogenerated": false,
"ratio": 4.396351575456053,
"config_test": ... |
from django.urls import reverse
from rest_framework import status
from conf_site.api.tests import ConferenceSiteAPITestCase
from conf_site.speakers.tests.factories import SpeakerFactory
class TestSpeaker(ConferenceSiteAPITestCase):
@classmethod
def setUpTestData(cls):
super(TestSpeaker, cls).setUpT... | {
"repo_name": "pydata/conf_site",
"path": "conf_site/api/tests/test_speaker.py",
"copies": "1",
"size": "1808",
"license": "mit",
"hash": -3505896017370252300,
"line_mean": 39.1777777778,
"line_max": 74,
"alpha_frac": 0.6692477876,
"autogenerated": false,
"ratio": 3.782426778242678,
"config_tes... |
from django.urls import reverse
from saleor.core.templatetags.shop import get_sort_by_url, menu
from saleor.core.templatetags.status import (
LABEL_SUCCESS, render_page_availability)
def test_sort_by_url_ascending(admin_client, category):
url = reverse(
'product:category',
kwargs={'slug': cat... | {
"repo_name": "UITools/saleor",
"path": "tests/test_templatetags.py",
"copies": "1",
"size": "1422",
"license": "bsd-3-clause",
"hash": -4755097757519850000,
"line_mean": 31.3181818182,
"line_max": 71,
"alpha_frac": 0.6666666667,
"autogenerated": false,
"ratio": 3.4514563106796117,
"config_test... |
from django.urls import reverse
from saleor.dashboard.templatetags.utils import sorting_header
def test_sorting_header_prepare_initial_data(admin_client):
url = reverse('dashboard:product-list')
response = admin_client.get(url)
result = sorting_header(response.context, 'name', 'Name')
assert result['... | {
"repo_name": "UITools/saleor",
"path": "tests/dashboard/test_templatetags.py",
"copies": "3",
"size": "1534",
"license": "bsd-3-clause",
"hash": -6234691606611787000,
"line_mean": 35.5238095238,
"line_max": 63,
"alpha_frac": 0.6564537158,
"autogenerated": false,
"ratio": 3.4784580498866213,
"c... |
from django.urls import reverse
from tests.base import TestCase, get_uploaded_file
from pybb import defaults
from pybb.models import Post, Attachment
class AttachmentTest(TestCase):
def setUp(self):
self.PYBB_ATTACHMENT_ENABLE = defaults.PYBB_ATTACHMENT_ENABLE
defaults.PYBB_ATTACHMENT_ENABLE = Tr... | {
"repo_name": "thoas/pybbm",
"path": "tests/views/test_attachments.py",
"copies": "2",
"size": "5227",
"license": "bsd-2-clause",
"hash": 5331423294953312000,
"line_mean": 31.2654320988,
"line_max": 108,
"alpha_frac": 0.6248326,
"autogenerated": false,
"ratio": 3.8718518518518517,
"config_test"... |
from django.urls import reverse
from tests.base import TestCase
from pybb.forms import ForumForm, ModerationForm
from pybb.models import Forum, Moderator
from pybb import defaults
class ForumsTest(TestCase):
def test_create_view(self):
url = reverse('pybb:forum_create', kwargs={
'forum_id': s... | {
"repo_name": "thoas/pybbm",
"path": "tests/views/test_forum.py",
"copies": "2",
"size": "6782",
"license": "bsd-2-clause",
"hash": -2569324522175281700,
"line_mean": 30.691588785,
"line_max": 120,
"alpha_frac": 0.6027720436,
"autogenerated": false,
"ratio": 3.949912638322656,
"config_test": tr... |
from django.urls import reverse
from tests.base import TestCase
class UsersTest(TestCase):
def test_user_posts_view(self):
url = reverse('pybb:user_posts', kwargs={
'username': self.user.username
})
response = self.client.get(url)
self.assertEqual(response.status_cod... | {
"repo_name": "ulule/pybbm",
"path": "tests/views/test_users.py",
"copies": "2",
"size": "1444",
"license": "bsd-2-clause",
"hash": 7420851075984219000,
"line_mean": 26.7692307692,
"line_max": 74,
"alpha_frac": 0.6011080332,
"autogenerated": false,
"ratio": 4,
"config_test": true,
"has_no_key... |
from django.urls import reverse
from tests.test_utils import create_generic_job
from treeherder.model.models import JobLog
def test_get_job_log_urls(test_repository, push_stored,
failure_classifications,
generic_reference_data, client):
job1 = create_generic_jo... | {
"repo_name": "KWierso/treeherder",
"path": "tests/webapp/api/test_job_log_url_api.py",
"copies": "2",
"size": "1505",
"license": "mpl-2.0",
"hash": -9222913347321297000,
"line_mean": 38.6052631579,
"line_max": 65,
"alpha_frac": 0.5029900332,
"autogenerated": false,
"ratio": 4.227528089887641,
... |
from django.urls import reverse
from twilio.twiml.messaging_response import MessagingResponse
from phone_numbers.models import PhoneNumber
from phone_numbers.tasks import buy_new_phone_number
from sms.decorators import twilio_view
from .tasks import send_deterrence_campaign
from .tasks import handle_deterrence_mess... | {
"repo_name": "RobSpectre/garfield",
"path": "garfield/deterrence/views.py",
"copies": "1",
"size": "2379",
"license": "mit",
"hash": 3936063154238586400,
"line_mean": 28.7375,
"line_max": 76,
"alpha_frac": 0.6124422026,
"autogenerated": false,
"ratio": 4.203180212014134,
"config_test": false,
... |
from django.urls import reverse
from twilio.twiml.messaging_response import MessagingResponse
from phone_numbers.tasks import buy_new_phone_number
from phone_numbers.models import PhoneNumber
from .decorators import twilio_view
@twilio_view
def index(request):
response = MessagingResponse()
base_uri = "{0... | {
"repo_name": "RobSpectre/garfield",
"path": "garfield/sms/views.py",
"copies": "1",
"size": "1094",
"license": "mit",
"hash": 497137264222394750,
"line_mean": 32.1515151515,
"line_max": 68,
"alpha_frac": 0.5612431444,
"autogenerated": false,
"ratio": 4.4471544715447155,
"config_test": false,
... |
from django.urls import reverse
from users.models import Token
from utils.tests import ViewTestCase
class UserTestCase(ViewTestCase):
def setUp(self):
super().setUp()
self.token = Token.objects.create(user=self.user)
def test_login_view(self):
response = self.client.get(reverse("logi... | {
"repo_name": "respawner/peering-manager",
"path": "users/tests/test_views.py",
"copies": "1",
"size": "4537",
"license": "apache-2.0",
"hash": -4479110677559747600,
"line_mean": 39.5089285714,
"line_max": 84,
"alpha_frac": 0.6462420101,
"autogenerated": false,
"ratio": 4.102169981916817,
"conf... |
from django.urls import reverse
from wakawaka.tests.base import BaseTestCase
class ChangesTestCase(BaseTestCase):
"""
The Changes view displays the actual diff of two revisons.
"""
def setUp(self):
super(ChangesTestCase, self).setUp()
# Create one page with two revisions
sel... | {
"repo_name": "bartTC/django-wakawaka",
"path": "wakawaka/tests/test_changes.py",
"copies": "1",
"size": "1169",
"license": "bsd-3-clause",
"hash": -5004360992960081000,
"line_mean": 32.4,
"line_max": 88,
"alpha_frac": 0.6475620188,
"autogenerated": false,
"ratio": 3.4688427299703264,
"config_t... |
from django.urls import reverse
from workshops.models import Person, Qualification, KnowledgeDomain
from workshops.test import TestBase
class TestAutoUpdateProfile(TestBase):
def setUp(self):
self._setUpAirports()
self._setUpLessons()
self._setUpLanguages()
self.user = Person.obj... | {
"repo_name": "vahtras/amy",
"path": "workshops/test/test_autoupdate_profile.py",
"copies": "1",
"size": "2553",
"license": "mit",
"hash": -4037967167948789000,
"line_mean": 36,
"line_max": 79,
"alpha_frac": 0.5961613788,
"autogenerated": false,
"ratio": 3.8275862068965516,
"config_test": true,... |
from django.urls import reverse
from workshops.tests.base import TestBase
class TestBadge(TestBase):
"""Tests for badge model and views, including some tests for awards."""
def setUp(self):
super().setUp()
self._setUpUsersAndLogin()
def test_badge_display(self):
"""Ensure the ba... | {
"repo_name": "swcarpentry/amy",
"path": "amy/workshops/tests/test_badge.py",
"copies": "1",
"size": "2400",
"license": "mit",
"hash": 8376862621391619000,
"line_mean": 38.3442622951,
"line_max": 88,
"alpha_frac": 0.625,
"autogenerated": false,
"ratio": 3.8095238095238093,
"config_test": true,
... |
from django.urls import reverse
class ChangeList(object):
"""
A list of model objects modified for comfy rendering. The class gets controller and queryset and
then provide only attributes which can be used on object list page.
"""
def __init__(self, controller, queryset):
super(ChangeList,... | {
"repo_name": "raizanshine/django-admin-crud",
"path": "admin_crud/changelist.py",
"copies": "1",
"size": "1465",
"license": "mit",
"hash": 5542185278820468000,
"line_mean": 32.2954545455,
"line_max": 100,
"alpha_frac": 0.5699658703,
"autogenerated": false,
"ratio": 4.425981873111782,
"config_t... |
from django.urls import reverse
def test_graphql_options(client, eleven_jobs_stored, test_repository):
"""
Retrieve a GraphQL set of the Options and OptionCollectionHashes.
"""
url = "{}?{}".format(
reverse("graphql"),
'query=query{allOptionCollections{optionCollectionHash option{name}... | {
"repo_name": "KWierso/treeherder",
"path": "tests/webapp/graphql/test_schema.py",
"copies": "2",
"size": "3972",
"license": "mpl-2.0",
"hash": -1169613675191286500,
"line_mean": 37.5631067961,
"line_max": 91,
"alpha_frac": 0.3985397784,
"autogenerated": false,
"ratio": 4.84390243902439,
"confi... |
from django.urls import reverse
def test_pending_job_available(test_repository, pending_jobs_stored, client):
resp = client.get(reverse("jobs-list", kwargs={"project": test_repository.name}))
assert resp.status_code == 200
jobs = resp.json()
assert len(jobs['results']) == 1
assert jobs['results'... | {
"repo_name": "mozilla/treeherder",
"path": "tests/e2e/test_jobs_loaded.py",
"copies": "2",
"size": "2371",
"license": "mpl-2.0",
"hash": -9044693433222461000,
"line_mean": 31.4794520548,
"line_max": 99,
"alpha_frac": 0.6642766765,
"autogenerated": false,
"ratio": 3.7996794871794872,
"config_te... |
from django.urls import reverse
table_headers = [
'Community',
'Your Role',
'Subscribers',
'Next event',
]
def test_communities_anonymous(
client, generic_community, deleted_community, subscribed_community,
):
resp = client.get('/c/')
assert resp.status_code == 200
_check_commun... | {
"repo_name": "letsmeet-click/letsmeet.click",
"path": "letsmeet/tests/communities/test_communities.py",
"copies": "1",
"size": "1550",
"license": "mit",
"hash": 2311417272000994000,
"line_mean": 30.6326530612,
"line_max": 85,
"alpha_frac": 0.6806451613,
"autogenerated": false,
"ratio": 3.8557213... |
from django.urls import reverse, resolve
from tethys_sdk.testing import TethysTestCase
class TestTethysServicesUrls(TethysTestCase):
def set_up(self):
pass
def tear_down(self):
pass
def test_service_urls_wps_services(self):
url = reverse('services:wps_service', kwargs={'service'... | {
"repo_name": "tethysplatform/tethys",
"path": "tests/unit_tests/test_tethys_services/test_urls.py",
"copies": "2",
"size": "1591",
"license": "bsd-2-clause",
"hash": 1073903564401045000,
"line_mean": 39.7948717949,
"line_max": 93,
"alpha_frac": 0.6593337524,
"autogenerated": false,
"ratio": 3.86... |
from django.urls import reverse, resolve
from tethys_sdk.testing import TethysTestCase
class TestUrls(TethysTestCase):
def set_up(self):
pass
def tear_down(self):
pass
def test_urlpatterns(self):
url = reverse('gizmos:showcase')
resolver = resolve(url)
self.asser... | {
"repo_name": "tethysplatform/tethys",
"path": "tests/unit_tests/test_tethys_gizmos/test_urls.py",
"copies": "2",
"size": "5938",
"license": "bsd-2-clause",
"hash": -1941574894594886400,
"line_mean": 47.2764227642,
"line_max": 91,
"alpha_frac": 0.6588076794,
"autogenerated": false,
"ratio": 3.542... |
from django.urls import reverse, resolve
from django.test import TestCase
from ..models import User
class TestUserURLs(TestCase):
"""Test URL patterns for users app."""
def setUp(self):
self.user = User.objects.create_user(username='testuser',
email=None... | {
"repo_name": "evanepio/dotmanca",
"path": "dotmanca/users/tests/test_urls.py",
"copies": "1",
"size": "1890",
"license": "mit",
"hash": 874598865238530300,
"line_mean": 33.3636363636,
"line_max": 79,
"alpha_frac": 0.5883597884,
"autogenerated": false,
"ratio": 4.364896073903003,
"config_test":... |
from django.urls import reverse, reverse_lazy
from django.utils.translation import gettext_lazy as _
from arctic.generics import (
CreateView,
DeleteView,
ListView,
UpdateView,
)
from .forms import {{ camel_case_app_name }}Form
from .models import {{ camel_case_app_name }}
class {{ camel_case_app_na... | {
"repo_name": "sanoma/django-arctic",
"path": "arctic/project_template/app/views.py",
"copies": "1",
"size": "1742",
"license": "mit",
"hash": 8117709334042874000,
"line_mean": 27.5573770492,
"line_max": 73,
"alpha_frac": 0.5929965557,
"autogenerated": false,
"ratio": 3.463220675944334,
"config... |
from django.urls import reverse, reverse_lazy
from django.views.generic import DetailView, ListView
from django.views.generic.edit import UpdateView, DeleteView
from django.http import Http404
from django.contrib import auth
from django.shortcuts import get_object_or_404
def can_edit_user(logged_user, target_user):
... | {
"repo_name": "jarnoln/cvdb",
"path": "users/views.py",
"copies": "1",
"size": "2508",
"license": "mit",
"hash": 6127300002517481000,
"line_mean": 31.1538461538,
"line_max": 92,
"alpha_frac": 0.6598883573,
"autogenerated": false,
"ratio": 3.7155555555555555,
"config_test": false,
"has_no_keyw... |
from django.urls import reverse, reverse_lazy
from django.views import generic
from django.http import HttpResponseRedirect
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login ... | {
"repo_name": "asommer70/photolandia",
"path": "photolandia/views.py",
"copies": "1",
"size": "1183",
"license": "mit",
"hash": -7481135608293751000,
"line_mean": 30.972972973,
"line_max": 101,
"alpha_frac": 0.5984784446,
"autogenerated": false,
"ratio": 4.481060606060606,
"config_test": false,... |
from django.urls import reverse, reverse_lazy
from cruditor.collection import CollectionViewMixin
from cruditor.views import CruditorAddView, CruditorChangeView, CruditorListView
from examples.mixins import ExamplesMixin
from examples.store.models import Person
from .forms import PersonForm, RelatedPersonFormset
cl... | {
"repo_name": "moccu/django-cruditor",
"path": "examples/formset/views.py",
"copies": "1",
"size": "1062",
"license": "mit",
"hash": -2837544880625186000,
"line_mean": 29.3428571429,
"line_max": 80,
"alpha_frac": 0.7598870056,
"autogenerated": false,
"ratio": 3.89010989010989,
"config_test": fa... |
from django.urls import reverse, reverse_lazy
from cruditor.collection import CollectionViewMixin
from cruditor.views import (
CruditorAddView, CruditorChangeView, CruditorDeleteView, CruditorListView)
from examples.mixins import ExamplesMixin
from examples.store.models import Person
from .filters import PersonFi... | {
"repo_name": "moccu/django-cruditor",
"path": "examples/collection/views.py",
"copies": "1",
"size": "1626",
"license": "mit",
"hash": 1324475423117229800,
"line_mean": 28.5636363636,
"line_max": 78,
"alpha_frac": 0.7429274293,
"autogenerated": false,
"ratio": 3.9466019417475726,
"config_test"... |
from django.urls import URLResolver, include, path, re_path, register_converter
from django.urls.resolvers import RoutePattern
from rest_framework.settings import api_settings
def _get_format_path_converter(suffix_kwarg, allowed):
if allowed:
if len(allowed) == 1:
allowed_pattern = allowed[0]... | {
"repo_name": "tomchristie/django-rest-framework",
"path": "rest_framework/urlpatterns.py",
"copies": "3",
"size": "4235",
"license": "bsd-2-clause",
"hash": 8804386761470328000,
"line_mean": 36.8125,
"line_max": 94,
"alpha_frac": 0.5950413223,
"autogenerated": false,
"ratio": 4.420668058455115,
... |
from django.utils.cache import add_never_cache_headers
from django.utils.deprecation import MiddlewareMixin
from django.conf import settings
from django.contrib.auth.middleware import RemoteUserMiddleware
class NoReferral(MiddlewareMixin):
def process_response(self, request, response):
response['X-Conten... | {
"repo_name": "hoover/search",
"path": "hoover/search/middleware.py",
"copies": "1",
"size": "1134",
"license": "mit",
"hash": -2178731684238825500,
"line_mean": 28.8421052632,
"line_max": 70,
"alpha_frac": 0.6798941799,
"autogenerated": false,
"ratio": 3.9375,
"config_test": false,
"has_no_k... |
from django.utils.cache import add_never_cache_headers
from rest_framework import status, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from shop.models.cart import CartModel, CartItemModel
from shop.serializers.cart import CartSerializer, CartItemSerializer, WatchSe... | {
"repo_name": "awesto/django-shop",
"path": "shop/views/cart.py",
"copies": "1",
"size": "4265",
"license": "bsd-3-clause",
"hash": 572618929182723260,
"line_mean": 39.2358490566,
"line_max": 117,
"alpha_frac": 0.6548651817,
"autogenerated": false,
"ratio": 4.15692007797271,
"config_test": fals... |
from django.utils.cache import add_never_cache_headers
import json
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse
from django.views.generic.detail import BaseDetailView
from django.contrib.contenttypes.models import ContentType
from schema_registry import schema
class ... | {
"repo_name": "bubenkoff/Arkestra",
"path": "links/views.py",
"copies": "2",
"size": "1174",
"license": "bsd-2-clause",
"hash": -3270983710481721300,
"line_mean": 28.35,
"line_max": 66,
"alpha_frac": 0.6286201022,
"autogenerated": false,
"ratio": 4.640316205533597,
"config_test": false,
"has_... |
from django.utils.cache import _generate_cache_header_key
from corehq.util.quickcache import quickcache, QuickCache
DEFAULT_EXPIRY = 60 * 60 # an hour
CACHE_PREFIX = 'hq.reports' # a namespace where cache keys go
class _ReportQuickCache(QuickCache):
"""
Just like QuickCache, but intercepts the function cal... | {
"repo_name": "benrudolph/commcare-hq",
"path": "corehq/apps/reports/cache.py",
"copies": "2",
"size": "1828",
"license": "bsd-3-clause",
"hash": -2381033371840866300,
"line_mean": 29.4666666667,
"line_max": 79,
"alpha_frac": 0.6411378556,
"autogenerated": false,
"ratio": 4.062222222222222,
"co... |
from django.utils.cache import get_conditional_response
from django.utils.deprecation import MiddlewareMixin
from django.utils.http import http_date, parse_http_date_safe
class ConditionalGetMiddleware(MiddlewareMixin):
"""
Handles conditional GET operations. If the response has an ETag or
Last-Modified h... | {
"repo_name": "jarshwah/django",
"path": "django/middleware/http.py",
"copies": "1",
"size": "1175",
"license": "bsd-3-clause",
"hash": 199065675496865730,
"line_mean": 35.71875,
"line_max": 80,
"alpha_frac": 0.6595744681,
"autogenerated": false,
"ratio": 4.501915708812261,
"config_test": false... |
from django.utils.cache import get_conditional_response
from django.utils.deprecation import MiddlewareMixin
from django.utils.http import http_date, parse_http_date_safe, unquote_etag
class ConditionalGetMiddleware(MiddlewareMixin):
"""
Handles conditional GET operations. If the response has an ETag or
L... | {
"repo_name": "vicky2135/lucious",
"path": "oscar/lib/python2.7/site-packages/django/middleware/http.py",
"copies": "49",
"size": "1203",
"license": "bsd-3-clause",
"hash": 8385236562111278000,
"line_mean": 36.59375,
"line_max": 80,
"alpha_frac": 0.6625103907,
"autogenerated": false,
"ratio": 4.4... |
from django.utils.cache import get_conditional_response
from django.utils.http import http_date, parse_http_date_safe
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has an ETag or
Last-Modified header, and the request has If-None-Match or
If-Modified-Si... | {
"repo_name": "Gagaro/django",
"path": "django/middleware/http.py",
"copies": "216",
"size": "1113",
"license": "bsd-3-clause",
"hash": 4055360980247636500,
"line_mean": 34.9032258065,
"line_max": 80,
"alpha_frac": 0.6460017969,
"autogenerated": false,
"ratio": 4.469879518072289,
"config_test":... |
from django.utils.cache import get_conditional_response
from django.utils.http import http_date, parse_http_date_safe, unquote_etag
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has an ETag or
Last-Modified header, and the request has If-None-Match or
... | {
"repo_name": "samabhi/pstHealth",
"path": "venv/lib/python2.7/site-packages/django/middleware/http.py",
"copies": "57",
"size": "1141",
"license": "mit",
"hash": 5062955573624337000,
"line_mean": 35.8064516129,
"line_max": 80,
"alpha_frac": 0.6494303243,
"autogenerated": false,
"ratio": 4.439688... |
from django.utils.cache import get_conditional_response
from django.utils.http import http_date, parse_http_date_safe, unquote_etag
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has an ETag or
Last-Modified header, and the request has If-None-Match or
... | {
"repo_name": "letouriste001/SmartForest_2.0",
"path": "python3.4Smartforest/lib/python3.4/site-packages/django/middleware/http.py",
"copies": "1",
"size": "1141",
"license": "mit",
"hash": -7767320522951813000,
"line_mean": 35.8064516129,
"line_max": 80,
"alpha_frac": 0.6494303243,
"autogenerated"... |
from django.utils.cache import get_conditional_response
from django.utils.http import http_date, parse_http_date_safe, unquote_etag
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has an ETag or
Last-Modified header, and the request has If-None-Match ... | {
"repo_name": "yephper/django",
"path": "django/middleware/http.py",
"copies": "1",
"size": "1172",
"license": "bsd-3-clause",
"hash": 6260415111662242000,
"line_mean": 35.8064516129,
"line_max": 80,
"alpha_frac": 0.6322525597,
"autogenerated": false,
"ratio": 4.542635658914729,
"config_test": ... |
from django.utils.cache import (
cc_delim_re, get_conditional_response, set_response_etag,
)
from django.utils.deprecation import MiddlewareMixin
from django.utils.http import parse_http_date_safe
class ConditionalGetMiddleware(MiddlewareMixin):
"""
Handle conditional GET operations. If the response has a... | {
"repo_name": "elky/django",
"path": "django/middleware/http.py",
"copies": "39",
"size": "1636",
"license": "bsd-3-clause",
"hash": 1925139212509101600,
"line_mean": 37.9523809524,
"line_max": 84,
"alpha_frac": 0.6515892421,
"autogenerated": false,
"ratio": 4.328042328042328,
"config_test": fa... |
from django.utils.cache import patch_cache_control
from django_statsd.clients import statsd
class ClientCacheResourceMixIn(object):
"""
Mixin class which sets Cache-Control headers on API responses
using a ``cache_control`` dictionary from the resource's Meta
class.
TODO: To be removed when we u... | {
"repo_name": "anistark/mozillians",
"path": "mozillians/api/v1/resources.py",
"copies": "4",
"size": "1975",
"license": "bsd-3-clause",
"hash": 5197348274542204000,
"line_mean": 31.9166666667,
"line_max": 75,
"alpha_frac": 0.6237974684,
"autogenerated": false,
"ratio": 4.097510373443983,
"conf... |
from django.utils.cache import patch_response_headers
from django.contrib.auth.models import User
from django.shortcuts import render
from allauth.socialaccount.models import SocialAccount, SocialLogin, SocialToken
from allauth.socialaccount.helpers import complete_social_login
from allauth.socialaccount.helpers impor... | {
"repo_name": "GinnyN/towerofdimensions-django",
"path": "django-allauth/allauth/socialaccount/providers/facebook/views.py",
"copies": "3",
"size": "3186",
"license": "bsd-3-clause",
"hash": -8491999931069060000,
"line_mean": 37.3855421687,
"line_max": 80,
"alpha_frac": 0.6327683616,
"autogenerated... |
from django.utils.cache import patch_response_headers
from django.shortcuts import render
from allauth.socialaccount.helpers import complete_social_login
from allauth.socialaccount.helpers import render_authentication_error
from allauth.socialaccount.models import SocialAccount
from facebook import GraphAPI, GraphAPIE... | {
"repo_name": "uroslates/django-allauth",
"path": "allauth/socialaccount/providers/facebook/views.py",
"copies": "1",
"size": "2273",
"license": "mit",
"hash": -1009800571355587800,
"line_mean": 39.5892857143,
"line_max": 85,
"alpha_frac": 0.5794104707,
"autogenerated": false,
"ratio": 4.53692614... |
from django.utils.cache import patch_response_headers
from django.shortcuts import render
from allauth.socialaccount import providers
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
... | {
"repo_name": "HackerEarth/django-allauth",
"path": "allauth/socialaccount/providers/stackexchange/views.py",
"copies": "1",
"size": "2158",
"license": "mit",
"hash": 4072572190478312000,
"line_mean": 42.16,
"line_max": 77,
"alpha_frac": 0.5908248378,
"autogenerated": false,
"ratio": 4.3861788617... |
from django.utils.cache import patch_response_headers
from django.shortcuts import render
from allauth.socialaccount.models import SocialAccount, SocialLogin, SocialToken
from allauth.socialaccount.helpers import complete_social_login
from allauth.socialaccount.helpers import render_authentication_error
from allauth.s... | {
"repo_name": "rawjam/django-allauth",
"path": "allauth/socialaccount/providers/facebook/views.py",
"copies": "2",
"size": "3183",
"license": "mit",
"hash": -1218395067306202600,
"line_mean": 36.8928571429,
"line_max": 80,
"alpha_frac": 0.630537229,
"autogenerated": false,
"ratio": 4.117723156532... |
from django.utils.cache import patch_response_headers
from django.shortcuts import render
import requests
from allauth.socialaccount.models import SocialAccount, SocialLogin, SocialToken
from allauth.socialaccount.helpers import complete_social_login
from allauth.socialaccount.helpers import render_authentication_err... | {
"repo_name": "Suite5/DataColibri",
"path": "allauth/socialaccount/providers/facebook/views.py",
"copies": "1",
"size": "3142",
"license": "mit",
"hash": 5919026170377697000,
"line_mean": 38.275,
"line_max": 80,
"alpha_frac": 0.6199872693,
"autogenerated": false,
"ratio": 4.263229308005427,
"co... |
from django.utils.cache import patch_response_headers
from django.shortcuts import render
import requests
from bloodon.accounts.social.models import (SocialLogin,
SocialToken)
from bloodon.accounts.social.helpers import complete_social_login
from bloodon.accounts.social.help... | {
"repo_name": "houssemFat/bloodOn",
"path": "bloodon/accounts/social/providers/facebook/views.py",
"copies": "1",
"size": "2802",
"license": "mit",
"hash": -1459147189752062000,
"line_mean": 36.36,
"line_max": 78,
"alpha_frac": 0.6320485368,
"autogenerated": false,
"ratio": 4.200899550224888,
"... |
from django.utils.cache import patch_vary_headers
from django.utils.deprecation import MiddlewareMixin
from django.utils.regex_helper import _lazy_re_compile
from django.utils.text import compress_sequence, compress_string
re_accepts_gzip = _lazy_re_compile(r'\bgzip\b')
class GZipMiddleware(MiddlewareMixin):
"""... | {
"repo_name": "freakboy3742/django",
"path": "django/middleware/gzip.py",
"copies": "20",
"size": "2142",
"license": "bsd-3-clause",
"hash": -8125359377675342000,
"line_mean": 41,
"line_max": 86,
"alpha_frac": 0.6633986928,
"autogenerated": false,
"ratio": 4.576923076923077,
"config_test": fals... |
from django.utils.cache import patch_vary_headers
from django.utils import translation
class MinimalLocaleMiddleware(object):
"""
This is a minimal version of the LocaleMiddleware from Django.
It only supports setting the current language from sessions.
This allows the main site to be in one language ... | {
"repo_name": "vikingco/django-datatrans",
"path": "datatrans/middleware.py",
"copies": "3",
"size": "1339",
"license": "bsd-3-clause",
"hash": 2959998714924167000,
"line_mean": 36.1944444444,
"line_max": 69,
"alpha_frac": 0.7079910381,
"autogenerated": false,
"ratio": 4.617241379310345,
"confi... |
from django.utils.cache import patch_vary_headers
from amo.urlresolvers import set_url_prefix
from mkt.constants.carriers import CARRIER_MAP
from . import set_carrier
class CarrierURLMiddleware(object):
"""
Supports psuedo-URL prefixes that define a custom carrier store.
For example, if you browse the ... | {
"repo_name": "andymckay/zamboni",
"path": "mkt/carriers/middleware.py",
"copies": "1",
"size": "1541",
"license": "bsd-3-clause",
"hash": 7259994640699470000,
"line_mean": 31.1041666667,
"line_max": 77,
"alpha_frac": 0.6534717716,
"autogenerated": false,
"ratio": 3.921119592875318,
"config_tes... |
from django.utils.cache import patch_vary_headers
from mkt.constants.carriers import CARRIER_MAP
from . import set_carrier
class CarrierURLMiddleware(object):
"""
Supports psuedo-URL prefixes that define a custom carrier store.
For example, if you browse the Marketplace at /telefonica/ then this
mi... | {
"repo_name": "Hitechverma/zamboni",
"path": "mkt/carriers/middleware.py",
"copies": "11",
"size": "1460",
"license": "bsd-3-clause",
"hash": -8173788493485793000,
"line_mean": 30.7391304348,
"line_max": 77,
"alpha_frac": 0.6479452055,
"autogenerated": false,
"ratio": 3.9142091152815013,
"confi... |
from django.utils.crypto import get_random_string
from django.core.mail import send_mail
from django.conf import settings
from django.db import models
from django.dispatch import receiver
from django.template.loader import get_template
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
from mo... | {
"repo_name": "johngian/mozillians",
"path": "mozillians/phonebook/models.py",
"copies": "3",
"size": "3537",
"license": "bsd-3-clause",
"hash": 250024931230633300,
"line_mean": 38.3,
"line_max": 80,
"alpha_frac": 0.647158609,
"autogenerated": false,
"ratio": 3.903973509933775,
"config_test": f... |
from django.utils.crypto import get_random_string
from django.core.mail import send_mail
from django.db import models
from django.dispatch import receiver
from django.template.loader import get_template
from funfactory.urlresolvers import reverse
from funfactory.utils import absolutify
from tower import ugettext as _
... | {
"repo_name": "satdav/mozillians",
"path": "apps/phonebook/models.py",
"copies": "1",
"size": "2669",
"license": "bsd-3-clause",
"hash": -7620280523483304000,
"line_mean": 31.950617284,
"line_max": 78,
"alpha_frac": 0.6519295616,
"autogenerated": false,
"ratio": 4.001499250374812,
"config_test"... |
from django.utils.crypto import get_random_string
from django.db import models
from datetime import datetime
from django.utils import timezone
class Production(models.Model):
name = models.CharField(max_length=100)
alt_name = models.CharField(max_length=100, blank=True)
description = models.TextField(bla... | {
"repo_name": "Karspexet/Karspexet",
"path": "karspexet/show/models.py",
"copies": "1",
"size": "2705",
"license": "mit",
"hash": 1089624801476252000,
"line_mean": 37.0985915493,
"line_max": 104,
"alpha_frac": 0.622181146,
"autogenerated": false,
"ratio": 3.826025459688826,
"config_test": false... |
from django.utils.crypto import get_random_string
from issues.tests.conftest import mf_api_client, random_service, testing_issues # noqa
from issues.tests.schemata import LIST_OF_ISSUES_SCHEMA
from issues.tests.utils import ISSUE_LIST_ENDPOINT, get_data_from_response, verify_issue
from issues_citysdk.models import Is... | {
"repo_name": "6aika/issue-reporting",
"path": "issues_citysdk/tests/test_extended_citysdk_api.py",
"copies": "1",
"size": "3055",
"license": "mit",
"hash": -3593830835752882700,
"line_mean": 33.3258426966,
"line_max": 112,
"alpha_frac": 0.6098199673,
"autogenerated": false,
"ratio": 3.6499402628... |
from django.utils.crypto import get_random_string
from .models import Player, Game
def generate_unique_anonymous_username():
"""
Generate an unique username for a player. Check in database if the username already exists.
TODO: check in db if a user with the generated username already exists
"""
u... | {
"repo_name": "NejcZupec/tictactoe",
"path": "web/utils.py",
"copies": "1",
"size": "1303",
"license": "apache-2.0",
"hash": -9213161258482055000,
"line_mean": 34.2162162162,
"line_max": 96,
"alpha_frac": 0.6646201074,
"autogenerated": false,
"ratio": 3.6094182825484764,
"config_test": false,
... |
from django.utils.datastructures import MultiValueDict as MultiDict
from sheerlike import filters
class TestArgParsing(object):
def setup(self):
self.args = MultiDict([('filter_category', ['cats', 'dogs']),
('filter_planet', ['earth']),
('fil... | {
"repo_name": "rosskarchner/django-sheerlike",
"path": "sheerlike/test_filters.py",
"copies": "1",
"size": "3650",
"license": "cc0-1.0",
"hash": -3186887501844931600,
"line_mean": 46.4025974026,
"line_max": 75,
"alpha_frac": 0.564109589,
"autogenerated": false,
"ratio": 3.456439393939394,
"conf... |
from django.utils.datastructures import MultiValueDictKeyError
from corehq.util.global_request import get_request_domain
from couchforms.const import (
EMPTY_PAYLOAD_ERROR,
MAGIC_PROPERTY,
MULTIPART_EMPTY_PAYLOAD_ERROR,
MULTIPART_FILENAME_ERROR,
)
import logging
from datetime import datetime
from django... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/ex-submodules/couchforms/getters.py",
"copies": "1",
"size": "3415",
"license": "bsd-3-clause",
"hash": -4674338397764448000,
"line_mean": 29.2212389381,
"line_max": 78,
"alpha_frac": 0.6313323572,
"autogenerated": false,
"ratio": 3.8028953... |
from django.utils.datastructures import MultiValueDictKeyError
from couchforms.const import (
EMPTY_PAYLOAD_ERROR,
MAGIC_PROPERTY,
MULTIPART_EMPTY_PAYLOAD_ERROR,
MULTIPART_FILENAME_ERROR,
)
import logging
from datetime import datetime
from django.conf import settings
from dimagi.utils.parsing import str... | {
"repo_name": "benrudolph/commcare-hq",
"path": "corehq/ex-submodules/couchforms/getters.py",
"copies": "1",
"size": "3198",
"license": "bsd-3-clause",
"hash": 5441819932881376000,
"line_mean": 29.75,
"line_max": 78,
"alpha_frac": 0.626641651,
"autogenerated": false,
"ratio": 3.798099762470309,
... |
from django.utils.datastructures import MultiValueDictKeyError
from interface.views.responsewrapper import ResponseWrapper
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
import json
PASSWORD = 'airturtle'
SESSION_KEY = 'loggedIn'
SESSION_VALUE = 'yes'
def is_session_active(... | {
"repo_name": "Yashasvi-Sriram/Escape-Errands",
"path": "interface/views/sessionapis.py",
"copies": "2",
"size": "1260",
"license": "apache-2.0",
"hash": 4320769954750315000,
"line_mean": 32.1578947368,
"line_max": 101,
"alpha_frac": 0.7111111111,
"autogenerated": false,
"ratio": 4.39024390243902... |
from django.utils.datastructures import MultiValueDictKeyError
from rest_framework.parsers import JSONParser
from ..models import Course
from ..models import CourseResult
from ..models import CourseUniversity
from ..models import CourseFaculty
from rest_framework.decorators import api_view, permission_classes
from res... | {
"repo_name": "CSyllabus/webapp",
"path": "backend/apps/csyllabusapi/views/comparator.py",
"copies": "1",
"size": "11586",
"license": "mit",
"hash": -4937387395837326000,
"line_mean": 36.6168831169,
"line_max": 113,
"alpha_frac": 0.6201450026,
"autogenerated": false,
"ratio": 3.813693219223173,
... |
from django.utils.datastructures import MultiValueDictKeyError
from rest_framework.response import Response
from rest_framework.views import APIView
from apis.rescuetime.tasks import import_user_rescuetime_history_via_api
from apis.rescuetime.v1.serializers import RescueTimeAPIRequestSerializer
class UpdateRescueTim... | {
"repo_name": "jeffshek/betterself",
"path": "apis/rescuetime/v1/views.py",
"copies": "1",
"size": "1202",
"license": "mit",
"hash": 2478557867849368000,
"line_mean": 36.5625,
"line_max": 92,
"alpha_frac": 0.6821963394,
"autogenerated": false,
"ratio": 4.08843537414966,
"config_test": false,
... |
from django.utils.datastructures import MultiValueDictKeyError
from rest_framework import mixins, permissions, viewsets
from rest_framework.exceptions import ParseError
from mpconstants.carriers import MOBILE_CODES
from mkt.api.authentication import (RestOAuthAuthentication,
RestS... | {
"repo_name": "elysium001/zamboni",
"path": "mkt/latecustomization/views.py",
"copies": "1",
"size": "4134",
"license": "bsd-3-clause",
"hash": 8012433728372120000,
"line_mean": 43.4516129032,
"line_max": 78,
"alpha_frac": 0.637397194,
"autogenerated": false,
"ratio": 4.537870472008781,
"config... |
from django.utils.datastructures import MultiValueDict
import urlparse
import os, mimetypes
from mimetypes import guess_extension
mimetypes.init(mimetypes.knownfiles+[os.path.abspath("extra_mime.types")])
class HttpMergeParameters(object):
def process_request(self, request):
if request.method.lower() == '... | {
"repo_name": "tochev/obshtestvo.bg",
"path": "restful/middleware.py",
"copies": "1",
"size": "2644",
"license": "unlicense",
"hash": 8547958267128517000,
"line_mean": 33.3376623377,
"line_max": 99,
"alpha_frac": 0.5881240545,
"autogenerated": false,
"ratio": 4.105590062111801,
"config_test": f... |
from django.utils.datastructures import MultiValueDict
import urlparse
class HttpMergeParameters(object):
def process_request(self, request):
if request.method.lower() == 'get':
base = request.POST
override = request.GET
elif request.method.lower() == 'put':
requ... | {
"repo_name": "radoraykov/recycle",
"path": "restful/middleware.py",
"copies": "1",
"size": "2665",
"license": "unlicense",
"hash": -4171474402824020500,
"line_mean": 36.5352112676,
"line_max": 85,
"alpha_frac": 0.5872420263,
"autogenerated": false,
"ratio": 4.1640625,
"config_test": false,
"... |
from django.utils.datastructures import MultiValueDict
class DjangoFormMixin(object):
'''
Django form helper
'''
form_class = None
def get_form_class(self):
return self.form_class
def make_form(self, **kwargs):
#TODO is this correct?
if 'data' not in kwargs:
... | {
"repo_name": "zbyte64/python-restmore",
"path": "restmore/forms.py",
"copies": "1",
"size": "1232",
"license": "mit",
"hash": 5501439465624730000,
"line_mean": 34.2,
"line_max": 106,
"alpha_frac": 0.6396103896,
"autogenerated": false,
"ratio": 4.368794326241135,
"config_test": false,
"has_no... |
from django.utils.datastructures import MultiValueDict
class HttpMergeParameters(object):
def process_request(self, request):
if request.method.lower() == 'GET':
base = request.POST
override = request.GET
else:
base = request.GET
override = request.PO... | {
"repo_name": "radoraykov/rating-gov-representatives",
"path": "apps/website/core/middleware/rest.py",
"copies": "1",
"size": "2339",
"license": "unlicense",
"hash": -8630645249394364000,
"line_mean": 36.7419354839,
"line_max": 85,
"alpha_frac": 0.5912783241,
"autogenerated": false,
"ratio": 4.13... |
from django.utils.datastructures import MultiValueDict
from hyperadmin.resources import BaseResource
from hyperadmin.resources.wizard.endpoints import StepList, StepProvider
from hyperadmin.resources.wizard.forms import StepStatusForm
from django.contrib.formtools.wizard.storage.session import SessionStorage
def m... | {
"repo_name": "zbyte64/django-hyperadmin",
"path": "hyperadmin/resources/wizard/resources.py",
"copies": "2",
"size": "7086",
"license": "bsd-3-clause",
"hash": 3726662010523789300,
"line_mean": 32.9043062201,
"line_max": 101,
"alpha_frac": 0.5969517358,
"autogenerated": false,
"ratio": 4.1978672... |
from django.utils.datastructures import OrderedSet
from django.db.migrations.state import ProjectState
class MigrationGraph(object):
"""
Represents the digraph of all migrations in a project.
Each migration is a node, and each dependency is an edge. There are
no implicit dependencies between numbered... | {
"repo_name": "Beeblio/django",
"path": "django/db/migrations/graph.py",
"copies": "7",
"size": "6309",
"license": "bsd-3-clause",
"hash": 6433867441957906000,
"line_mean": 40.2352941176,
"line_max": 118,
"alpha_frac": 0.618640038,
"autogenerated": false,
"ratio": 4.545389048991354,
"config_tes... |
from django.utils.datastructures import SortedDict
from django.conf import settings
from django.core.urlresolvers import reverse
from django import template
from satchless.product.models import Product
from satchless.category.models import Category
from .. import query
register = template.Library()
@register.filter... | {
"repo_name": "fusionbox/satchless",
"path": "examples/demo/sale/templatetags/sale_tags.py",
"copies": "1",
"size": "1671",
"license": "bsd-3-clause",
"hash": 4814584183110410000,
"line_mean": 39.756097561,
"line_max": 100,
"alpha_frac": 0.6499102334,
"autogenerated": false,
"ratio": 4.2627551020... |
from django.utils.datastructures import SortedDict
from django.db.models import get_model
from fields import StoreField
from exceptions import StoreException
def get_object_from_identifier(identifier, valid=None):
""" Helper function to resolve an item identifier
into a model instance.
Raises Stor... | {
"repo_name": "rubendario25/dojango",
"path": "dojango/data/modelstore/utils.py",
"copies": "13",
"size": "3281",
"license": "bsd-3-clause",
"hash": -8005908222426063000,
"line_mean": 33.5368421053,
"line_max": 96,
"alpha_frac": 0.6257238647,
"autogenerated": false,
"ratio": 4.60814606741573,
"... |
from django.utils.datastructures import SortedDict
from django.db.models import get_model
from .fields import StoreField
from .exceptions import StoreException
def get_object_from_identifier(identifier, valid=None):
""" Helper function to resolve an item identifier
into a model instance.
Raises St... | {
"repo_name": "ofirr/dojango",
"path": "dojango/data/modelstore/utils.py",
"copies": "1",
"size": "3307",
"license": "bsd-3-clause",
"hash": 6503876833547994000,
"line_mean": 33.8105263158,
"line_max": 96,
"alpha_frac": 0.6256425764,
"autogenerated": false,
"ratio": 4.580332409972299,
"config_t... |
from django.utils.datastructures import SortedDict
from django.utils.text import capfirst
from django import forms
from django_town.mongoengine_extension.forms.fields import MongoCharField, MongoEmailField, MongoURLField, ListField, \
ReferenceField, DocumentMultipleChoiceField, MapField
ALL_FIELDS = '__all__'
... | {
"repo_name": "uptown/django-town",
"path": "django_town/mongoengine_extension/forms/field_factory.py",
"copies": "1",
"size": "5455",
"license": "mit",
"hash": -2955857554270732000,
"line_mean": 37.6879432624,
"line_max": 119,
"alpha_frac": 0.6359303391,
"autogenerated": false,
"ratio": 4.271730... |
from django.utils.datastructures import SortedDict
from django.utils.translation import ugettext_lazy as _lazy
# The number of answers per page.
ANSWERS_PER_PAGE = 20
# The number of questions per page.
QUESTIONS_PER_PAGE = 20
# Highest ranking to show for a user
HIGHEST_RANKING = 100
# Special tag names:
ESCALATE_... | {
"repo_name": "mythmon/kitsune",
"path": "kitsune/questions/config.py",
"copies": "1",
"size": "12061",
"license": "bsd-3-clause",
"hash": 4205422778041957000,
"line_mean": 34.4735294118,
"line_max": 86,
"alpha_frac": 0.4284056048,
"autogenerated": false,
"ratio": 4.174800969193493,
"config_tes... |
from django.utils.datastructures import SortedDict
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from openstack_dashboard import api
from openstack_dashboard.dashboards.admin.images.images\
import tables as images_tables
import logging
LOG = loggi... | {
"repo_name": "xuweiliang/Codelibrary",
"path": "openstack_dashboard/dashboards/admin/images/tabs.py",
"copies": "1",
"size": "2720",
"license": "apache-2.0",
"hash": -5467090840438810000,
"line_mean": 31.7710843373,
"line_max": 79,
"alpha_frac": 0.6419117647,
"autogenerated": false,
"ratio": 4.0... |
from django.utils.datastructures import SortedDict
from django.utils.translation import ugettext_lazy as _
from . import applications
# Platforms
class PLATFORM_ANY:
id = 0
name = _(u'Any')
shortname = 'any'
# API name is not translated
api_name = u'ALL'
class PLATFORM_ALL:
id = 1
name ... | {
"repo_name": "andymckay/addons-server",
"path": "src/olympia/constants/platforms.py",
"copies": "2",
"size": "2688",
"license": "bsd-3-clause",
"hash": -2654240227069091300,
"line_mean": 23.6605504587,
"line_max": 78,
"alpha_frac": 0.6246279762,
"autogenerated": false,
"ratio": 3.266099635479951... |
from django.utils.datastructures import SortedDict
from django.utils.translation import ugettext_lazy as _
SORT_OPTIONS = SortedDict((
('priority', _('Priority')),
('date', _('Last Seen')),
('new', _('First Seen')),
('freq', _('Frequency')),
('tottime', _('Total Time Spent')),
('avgtime', _('Av... | {
"repo_name": "alex/sentry",
"path": "sentry/constants.py",
"copies": "1",
"size": "1384",
"license": "bsd-3-clause",
"hash": 1132373037909619600,
"line_mean": 37.4444444444,
"line_max": 99,
"alpha_frac": 0.649566474,
"autogenerated": false,
"ratio": 3.248826291079812,
"config_test": false,
"... |
from django.utils.datastructures import SortedDict
from questionnaire.models import Answer, AnswerGroup
from questionnaire.services.questionnaire_entry_form_service import QuestionnaireEntryFormService
class UserQuestionnaireService(object):
def __init__(self, user, questionnaire):
self.user = user
... | {
"repo_name": "testvidya11/ejrf",
"path": "questionnaire/services/users.py",
"copies": "1",
"size": "2433",
"license": "bsd-3-clause",
"hash": 1215663322064657700,
"line_mean": 40.9482758621,
"line_max": 123,
"alpha_frac": 0.697081792,
"autogenerated": false,
"ratio": 4.151877133105802,
"config... |
from django.utils.datastructures import SortedDict
from sqlagg import (
ColumnNotFoundException,
TableNotFoundException,
)
from sqlalchemy.exc import ProgrammingError
from corehq.apps.reports.sqlreport import SqlData
from corehq.apps.userreports.exceptions import (
UserReportsError, TableNotFoundWarning,
)
... | {
"repo_name": "puttarajubr/commcare-hq",
"path": "corehq/apps/userreports/reports/data_source.py",
"copies": "1",
"size": "4997",
"license": "bsd-3-clause",
"hash": 2077285161705073000,
"line_mean": 36.2910447761,
"line_max": 101,
"alpha_frac": 0.6175705423,
"autogenerated": false,
"ratio": 4.136... |
from django.utils.datastructures import SortedDict
import collections
from django import forms
from django.utils.translation import ugettext as _
from corehq.apps.app_manager.models import get_apps_in_domain
ApplicationDataSource = collections.namedtuple('ApplicationDataSource', ['application', 'source_type', 'source... | {
"repo_name": "benrudolph/commcare-hq",
"path": "corehq/apps/app_manager/fields.py",
"copies": "2",
"size": "4351",
"license": "bsd-3-clause",
"hash": 5516151407150478000,
"line_mean": 38.1981981982,
"line_max": 113,
"alpha_frac": 0.5899793151,
"autogenerated": false,
"ratio": 4.27826941986234,
... |
from django.utils.datastructures import SortedDict
__all__ = ('get_declared_fields', 'declarative_fields')
def get_declared_fields(bases, attrs, cls_filter,
with_base_fields=True,
extra_attr_name='base_fields'):
"""
Create a list of form field instances from the passed in 'attrs', plus any
... | {
"repo_name": "freevoid/django-datafilters",
"path": "datafilters/declarative.py",
"copies": "1",
"size": "2103",
"license": "mit",
"hash": 2468896384149073400,
"line_mean": 39.4423076923,
"line_max": 87,
"alpha_frac": 0.6490727532,
"autogenerated": false,
"ratio": 3.9905123339658446,
"config_t... |
from django.utils.datastructures import SortedDict
class DeclaredField(object):
# Tracks each time a Field instance is created. Used to retain order.
_creation_counter = 0
def __init__(self, *args, **kwargs):
# Increase the creation counter, and save our local copy.
self._creation_counter ... | {
"repo_name": "gdoermann/django-limbo",
"path": "limbo/meta.py",
"copies": "1",
"size": "2614",
"license": "mit",
"hash": 3461926300303592400,
"line_mean": 43.3050847458,
"line_max": 102,
"alpha_frac": 0.6071155318,
"autogenerated": false,
"ratio": 4.142630744849446,
"config_test": false,
"ha... |
from django.utils.datastructures import SortedDict
from django_json_forms import fields, logger
from django_json_forms.utils import resolve_promise
class RemoteForm(object):
def __init__(self, form, *args, **kwargs):
self.form = form
self.all_fields = set(self.form.fields.keys())
self.e... | {
"repo_name": "guilleramos/django-json-forms",
"path": "build/lib.linux-x86_64-2.7/django_json_forms/forms.py",
"copies": "2",
"size": "6301",
"license": "mit",
"hash": -313153672597988160,
"line_mean": 40.4539473684,
"line_max": 140,
"alpha_frac": 0.5683224885,
"autogenerated": false,
"ratio": 4... |
from django.utils.datastructures import SortedDict
from django_remote_forms import fields, logger
from django_remote_forms.utils import resolve_promise
class RemoteForm(object):
def __init__(self, form, *args, **kwargs):
self.form = form
self.all_fields = set(self.form.fields.keys())
se... | {
"repo_name": "extertioner/django-remote-forms",
"path": "django_remote_forms/forms.py",
"copies": "1",
"size": "6442",
"license": "mit",
"hash": 7058433785241224000,
"line_mean": 40.5612903226,
"line_max": 140,
"alpha_frac": 0.5706302391,
"autogenerated": false,
"ratio": 4.218729535036019,
"co... |
from django.utils.datastructures import SortedDict
from hyperadmin.endpoints import RootEndpoint
from hyperadmin.resources.directory import ResourceDirectory
from hyperadmin.resources.auth import AuthResource
from hyperadmin.throttle import Throttle
import collections
class Registry(dict):
def __init__(self, re... | {
"repo_name": "webcube/django-hyperadmin",
"path": "hyperadmin/sites.py",
"copies": "1",
"size": "9049",
"license": "bsd-3-clause",
"hash": 6331565753120631000,
"line_mean": 39.5784753363,
"line_max": 113,
"alpha_frac": 0.6602939551,
"autogenerated": false,
"ratio": 4.214718211457848,
"config_t... |
from django.utils.datastructures import SortedDict
from tower import ugettext_lazy as _lazy
# The number of answers per page.
ANSWERS_PER_PAGE = 20
# The number of questions per page.
QUESTIONS_PER_PAGE = 20
# Highest ranking to show for a user
HIGHEST_RANKING = 100
# Special tag names:
ESCALATE_TAG_NAME = 'escala... | {
"repo_name": "feer56/Kitsune1",
"path": "kitsune/questions/config.py",
"copies": "1",
"size": "10287",
"license": "bsd-3-clause",
"hash": -2568658251411030000,
"line_mean": 34.1092150171,
"line_max": 79,
"alpha_frac": 0.4177116749,
"autogenerated": false,
"ratio": 4.214256452273658,
"config_te... |
from django.utils.datastructures import SortedDict
from tower import ugettext_lazy as _
from . import applications
# Platforms
class PLATFORM_ANY:
id = 0
name = _(u'Any')
shortname = 'any'
# API name is not translated
api_name = u'ALL'
class PLATFORM_ALL:
id = 1
name = _(u'All Platform... | {
"repo_name": "spasovski/zamboni",
"path": "apps/constants/platforms.py",
"copies": "9",
"size": "3039",
"license": "bsd-3-clause",
"hash": -8295031482596636000,
"line_mean": 23.7073170732,
"line_max": 78,
"alpha_frac": 0.6057913787,
"autogenerated": false,
"ratio": 3.2642320085929106,
"config_... |
from django.utils.datastructures import SortedDict
class SimpleIndicatorService(object):
def __init__(self, formula, location_parent):
self.count = formula.get_count_type()
self.survey = formula.indicator.batch.survey
self.location_parent = location_parent
def hierarchical_count(self)... | {
"repo_name": "unicefuganda/mics",
"path": "survey/services/simple_indicator_service.py",
"copies": "2",
"size": "2100",
"license": "bsd-3-clause",
"hash": -2328199455010456000,
"line_mean": 39.3846153846,
"line_max": 89,
"alpha_frac": 0.620952381,
"autogenerated": false,
"ratio": 4.1832669322709... |
from django.utils.datastructures import SortedDict
def build_pretty_data_view(form_instance, model_object, exclude=(), append=()):
'''
Taken from: http://stackoverflow.com/questions/2170228/django-iterate-over-model-instance-field-names-and-values-in-template#comment4280740_3431104
@author: Alan Viars
... | {
"repo_name": "CS2014/USM",
"path": "usm/accounting/utils.py",
"copies": "2",
"size": "1089",
"license": "mit",
"hash": -4417520341264537600,
"line_mean": 33.0625,
"line_max": 151,
"alpha_frac": 0.5436179982,
"autogenerated": false,
"ratio": 4.048327137546468,
"config_test": false,
"has_no_ke... |
from django.utils.datastructures import SortedDict
def get_declared_fields(field_type, base_attr, declared_attr, bases, attrs, with_base_fields=True):
"""
Create a list of field instances from the passed in 'attrs', plus any
similar fields on the base classes (in 'bases'). This is used by both
the Env... | {
"repo_name": "paulcwatts/dominion",
"path": "dominion/utils.py",
"copies": "1",
"size": "1342",
"license": "bsd-3-clause",
"hash": 4282838103979775000,
"line_mean": 43.7333333333,
"line_max": 118,
"alpha_frac": 0.6766020864,
"autogenerated": false,
"ratio": 4.091463414634147,
"config_test": fa... |
from django.utils.dateformat import format
from datetime import datetime, timedelta
import sys
import math
from django.conf import settings
from time import mktime
# FROM_GMT = -5
# TZ_OFFSET = 60 * 60 * FROM_GMT
def timedelta_to_seconds(td):
return td.seconds + td.days * 60 * 60 * 24
def normalize_data(data... | {
"repo_name": "b1tr0t/django-metrics",
"path": "metrics/helpers.py",
"copies": "1",
"size": "9539",
"license": "mit",
"hash": 3077973434148386300,
"line_mean": 38.0983606557,
"line_max": 141,
"alpha_frac": 0.6080301918,
"autogenerated": false,
"ratio": 3.6575920245398774,
"config_test": false,
... |
from django.utils.dateparse import parse_datetime
import dj_database_url
import os
from email.utils import formataddr
HOME_DIR = os.path.expanduser("~")
BASE_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.pardir))
# Make this unique, and don't share it with anybody.
SECRET_KEY = os.environ.g... | {
"repo_name": "jessamynsmith/underquoted",
"path": "underquoted/settings.py",
"copies": "1",
"size": "5147",
"license": "mit",
"hash": -9079019026927822000,
"line_mean": 31.3710691824,
"line_max": 98,
"alpha_frac": 0.6971051098,
"autogenerated": false,
"ratio": 3.5326012354152367,
"config_test"... |
from django.utils.dateparse import parse_datetime
from gservices.services.base import BaseService
from django.conf import settings
class BaseCalendar(BaseService):
_SERVICE = settings.CALENDAR_SERVICE
_create_method = 'insert'
@property
def title(self):
return self._get_property('summary')
... | {
"repo_name": "Gargarol/django-gservices",
"path": "gservices/services/calendar.py",
"copies": "1",
"size": "2361",
"license": "mit",
"hash": -7477884098837476000,
"line_mean": 24.3870967742,
"line_max": 104,
"alpha_frac": 0.5789919526,
"autogenerated": false,
"ratio": 3.753577106518283,
"confi... |
from django.utils.dateparse import parse_datetime, parse_date
import logging
from . import models
logger = logging.getLogger(__name__)
def safeCopy(json, items):
for k in json:
if k in items:
if json[k] is None:
json[k] = ''
return json
def verification(body):
logge... | {
"repo_name": "grvty-labs/django-openpay",
"path": "django_openpay/webhooks.py",
"copies": "1",
"size": "8726",
"license": "mit",
"hash": 6026297877004529000,
"line_mean": 41.9852216749,
"line_max": 76,
"alpha_frac": 0.5971808389,
"autogenerated": false,
"ratio": 4.639021796916534,
"config_test... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.