text
stringlengths
0
1.05M
meta
dict
from django.utils.functional import cached_property from waldur_core.structure.tests.fixtures import ProjectFixture from . import factories class VMwareFixture(ProjectFixture): def __init__(self): super(VMwareFixture, self).__init__() self.customer_cluster self.customer_network s...
{ "repo_name": "opennode/waldur-mastermind", "path": "src/waldur_vmware/tests/fixtures.py", "copies": "1", "size": "2372", "license": "mit", "hash": -6689644702404499000, "line_mean": 26.9058823529, "line_max": 77, "alpha_frac": 0.6677908938, "autogenerated": false, "ratio": 4.678500986193294, "...
from django.utils.functional import cached_property from waldur_core.structure.tests.fixtures import ProjectFixture from .. import models from . import factories class OpenStackFixture(ProjectFixture): @cached_property def openstack_service_settings(self): return factories.OpenStackServiceSettingsFa...
{ "repo_name": "opennode/nodeconductor-assembly-waldur", "path": "src/waldur_openstack/openstack/tests/fixtures.py", "copies": "1", "size": "1915", "license": "mit", "hash": -6780755918911209000, "line_mean": 28.921875, "line_max": 84, "alpha_frac": 0.67154047, "autogenerated": false, "ratio": 4.4...
from django.utils.functional import cached_property from waldur_core.structure.tests import factories as structure_factories from waldur_core.structure.tests import fixtures as structure_fixtures from ..apps import JiraConfig from . import factories class JiraFixture(structure_fixtures.ProjectFixture): @cached_...
{ "repo_name": "opennode/waldur-mastermind", "path": "src/waldur_jira/tests/fixtures.py", "copies": "1", "size": "1573", "license": "mit", "hash": -7454657343706563000, "line_mean": 29.8431372549, "line_max": 83, "alpha_frac": 0.715193897, "autogenerated": false, "ratio": 4.183510638297872, "con...
from django.utils.functional import cached_property from waldur_core.structure.tests import fixtures as structure_fixtures from waldur_mastermind.marketplace import models as marketplace_models from waldur_mastermind.marketplace.tests import factories as marketplace_factories from waldur_mastermind.marketplace_support...
{ "repo_name": "opennode/nodeconductor-assembly-waldur", "path": "src/waldur_mastermind/support_invoices/tests/fixtures.py", "copies": "1", "size": "4154", "license": "mit", "hash": -8297998161928199000, "line_mean": 32.5, "line_max": 85, "alpha_frac": 0.653827636, "autogenerated": false, "ratio":...
from django.utils.functional import cached_property from waldur_mastermind.booking.utils import TimePeriod, get_offering_bookings from waldur_mastermind.google.backend import GoogleCalendar class SyncBookingsError(Exception): pass class SyncBookings: def __init__(self, offering): self.offering = of...
{ "repo_name": "opennode/waldur-mastermind", "path": "src/waldur_mastermind/booking/calendar.py", "copies": "1", "size": "4800", "license": "mit", "hash": -6103683391523341000, "line_mean": 32.8028169014, "line_max": 99, "alpha_frac": 0.5485416667, "autogenerated": false, "ratio": 4.28954423592493...
from django.utils.functional import cached_property class AggregatedGroup(object): """ Generic object that constructs related objects like a Django model from queryset values() data. """ def __init__(self, model, row_values): self._model = model self._row_values = row_values ...
{ "repo_name": "kako-nawao/django-group-by", "path": "django_group_by/group.py", "copies": "1", "size": "2443", "license": "mit", "hash": 3916584836815673000, "line_mean": 30.7272727273, "line_max": 83, "alpha_frac": 0.4576340565, "autogenerated": false, "ratio": 4.818540433925049, "config_test"...
from django.utils.functional import cached_property class AppRouter(object): """ Allow application level routing to distinct databases. Be careful not to attempt foreign-key relationships across physical boundaries! In your DJANGO_CONFIG_MODULE you should set an iterable mapping of app_label to d...
{ "repo_name": "goodtune/vitriolic", "path": "touchtechnology/common/routers.py", "copies": "1", "size": "1157", "license": "bsd-3-clause", "hash": -7289993269532703000, "line_mean": 27.2195121951, "line_max": 76, "alpha_frac": 0.6309420916, "autogenerated": false, "ratio": 3.922033898305085, "c...
from django.utils.functional import cached_property class CheckboxExcludeDownvotedNotification(object): """ Manages the checkbox for displaying whether the downvoted notifications are excluded from list. Provides an url to include the downvoted notifications into listing. """ @property def ur...
{ "repo_name": "AlexanderKaluzhny/instanotifier", "path": "instanotifier/api/notification/rating.py", "copies": "1", "size": "3164", "license": "mit", "hash": -6298971897571851000, "line_mean": 33.3913043478, "line_max": 103, "alpha_frac": 0.6403286979, "autogenerated": false, "ratio": 4.229946524...
from django.utils.functional import curry from django.conf.urls.defaults import patterns, url from django.http import HttpResponseRedirect from django.contrib import admin from django.contrib.admin.util import unquote from django.db.models.fields import IntegerField, FieldDoesNotExist from django.core.exceptions import...
{ "repo_name": "itavor/itavor_lib", "path": "itavor_lib/sortable.py", "copies": "1", "size": "4489", "license": "bsd-3-clause", "hash": -2410485398815327000, "line_mean": 37.6982758621, "line_max": 159, "alpha_frac": 0.5918912898, "autogenerated": false, "ratio": 3.8042372881355933, "config_test...
from django.utils.functional import curry from django.contrib.auth import authenticate, login from django.contrib.auth.models import User from django_stripe.shortcuts import stripe from django_stripe.settings import STRIPE_CUSTOMER_DESCRIPTION from registration.backends.simple import SimpleBackend from .forms import...
{ "repo_name": "amccloud/django-stripe", "path": "django_stripe/contrib/registration/backends.py", "copies": "1", "size": "1450", "license": "bsd-3-clause", "hash": 1617738340046420000, "line_mean": 29.8510638298, "line_max": 69, "alpha_frac": 0.6475862069, "autogenerated": false, "ratio": 4.36746...
from django.utils.functional import curry from tenant.signals import tenant_provider import threading import urlparse import logging logger = logging.getLogger(__name__) def get_current_tenant(sender=None, **hints): if sender is None: sender = threading.current_thread() tenant = None ...
{ "repo_name": "allanlei/django-multitenant", "path": "tenant/utils.py", "copies": "1", "size": "3761", "license": "bsd-3-clause", "hash": 1675737525247649000, "line_mean": 32.5803571429, "line_max": 98, "alpha_frac": 0.6312151024, "autogenerated": false, "ratio": 3.7311507936507935, "config_tes...
from django.utils.functional import curry, SimpleLazyObject from django_oauth_twitter import (ACCESS_KEY, REQUEST_KEY, SUCCESS_URL_KEY, USERINFO_KEY) from django_oauth_twitter.utils import get_user_info from oauth.oauth import OAuthToken import simplejson import twitter class Sessi...
{ "repo_name": "callowayproject/django-tweeter", "path": "django_oauth_twitter/middleware.py", "copies": "1", "size": "2813", "license": "mit", "hash": 4607401454696433700, "line_mean": 37.0135135135, "line_max": 77, "alpha_frac": 0.6629932456, "autogenerated": false, "ratio": 3.9900709219858155, ...
from django.utils.functional import empty, SimpleLazyObject from .helpers import User, check_allow_for_uri, check_allow_for_user def apply_impersonate(request): request.user.is_impersonate = False request.impersonator = None if request.user.is_authenticated() and \ '_impersonate' in request.sessio...
{ "repo_name": "BetterWorks/django-impersonate", "path": "impersonate/middleware.py", "copies": "1", "size": "1970", "license": "bsd-3-clause", "hash": 8413569941090675000, "line_mean": 32.3898305085, "line_max": 78, "alpha_frac": 0.6355329949, "autogenerated": false, "ratio": 4.095634095634096, ...
from django.utils.functional import lazy from django.utils.safestring import mark_safe from django.utils.encoding import is_protected_type from django.utils.safestring import SafeUnicode from django.conf import settings from wraptools import wraps import django import copy import sys # Default values DEFAULT_I18N_CLA...
{ "repo_name": "machinalis/django-i18n-helper", "path": "i18n_helper/__init__.py", "copies": "1", "size": "4671", "license": "bsd-3-clause", "hash": -5166466524908722000, "line_mean": 40.7053571429, "line_max": 79, "alpha_frac": 0.6707343181, "autogenerated": false, "ratio": 3.9923076923076923, ...
from django.utils.functional import lazy from feedly.storage.redis.structures.hash import BaseRedisHashCache from feedly.storage.redis.structures.list import BaseRedisListCache import logging from feedly.utils import epoch_to_datetime, chunks logger = logging.getLogger(__name__) class RedisSortedSetCache(BaseRedisLis...
{ "repo_name": "Architizer/Feedly", "path": "feedly/storage/redis/structures/sorted_set.py", "copies": "1", "size": "5026", "license": "bsd-3-clause", "hash": -2103147875486208500, "line_mean": 32.0657894737, "line_max": 112, "alpha_frac": 0.5775964982, "autogenerated": false, "ratio": 4.089503661...
from django.utils.functional import lazy from mock import patch from django_browserid import helpers from django_browserid.tests import JSON_STRING, TestCase def _lazy_request_args(): return {'siteName': 'asdf'} lazy_request_args = lazy(_lazy_request_args, dict) class BrowserIDInfoTests(TestCase): def set...
{ "repo_name": "mozilla/django-browserid", "path": "django_browserid/tests/test_helpers.py", "copies": "1", "size": "6796", "license": "mpl-2.0", "hash": -5044933567918480000, "line_mean": 36.9664804469, "line_max": 96, "alpha_frac": 0.578281342, "autogenerated": false, "ratio": 3.9580663948747814...
from django.utils.functional import memoize from django.contrib.contenttypes.models import ContentType _get_content_type_for_model_cache = {} def get_content_type_for_model(model): return ContentType.objects.get_for_model(model) get_content_type_for_model = memoize(get_content_type_for_model, _get_content_t...
{ "repo_name": "arkoz/django-generic-bookmarks", "path": "bookmarks/utils.py", "copies": "1", "size": "1216", "license": "mit", "hash": 747357358304779000, "line_mean": 33.7428571429, "line_max": 69, "alpha_frac": 0.6151315789, "autogenerated": false, "ratio": 3.1916010498687664, "config_test": ...
from django.utils.functional import memoize import codecs import os cached_nl = {} nl_base = os.path.dirname(__file__) def get_wordlist(lang, listname): try: wordfile = codecs.open("%s/%s/%s.txt" % (nl_base, lang, listname)) words = [line.strip() for line in wordfile.readlines() if line.strip()] ...
{ "repo_name": "pbarton666/buzz_bot", "path": "djangoproj/djangoapp/csc/nl/__init__.py", "copies": "1", "size": "3413", "license": "mit", "hash": -5533914338790055000, "line_mean": 35.3085106383, "line_max": 79, "alpha_frac": 0.6574860826, "autogenerated": false, "ratio": 3.954808806488992, "con...
from django.utils.functional import memoize from staticassets import settings from staticassets.filters import BaseFilter, CommandMixin, get_filter _preprocessors = {} _postprocessors = {} _bundleprocessors = {} class BaseProcessor(BaseFilter): method = 'process' class CommandProcessor(BaseFilter, CommandMix...
{ "repo_name": "davidelias/django-staticassets", "path": "staticassets/processors/base.py", "copies": "1", "size": "1336", "license": "mit", "hash": -8246428109843517000, "line_mean": 27.4255319149, "line_max": 103, "alpha_frac": 0.7380239521, "autogenerated": false, "ratio": 4.012012012012012, ...
from django.utils.functional import Promise try: from django.utils.encoding import force_text except ImportError: from django.utils.encoding import force_unicode as force_text from django.core.serializers.json import DjangoJSONEncoder from django.utils import simplejson as json from django import http from hyp...
{ "repo_name": "webcube/django-hyperadmin", "path": "hyperadmin/mediatypes/collectionjson.py", "copies": "1", "size": "9479", "license": "bsd-3-clause", "hash": -2205462387690319000, "line_mean": 37.2217741935, "line_max": 148, "alpha_frac": 0.5909906108, "autogenerated": false, "ratio": 4.2185135...
from django.utils.functional import SimpleLazyObject, lazy from c3nav.control.models import UserPermissions, UserSpaceAccess class UserPermissionsMiddleware: """ This middleware adds request.user_permissions to get the UserPermissions for the current request/user. """ def __init__(self, get_response)...
{ "repo_name": "c3nav/c3nav", "path": "src/c3nav/control/middleware.py", "copies": "1", "size": "1228", "license": "apache-2.0", "hash": 5319532414664831000, "line_mean": 35.1176470588, "line_max": 106, "alpha_frac": 0.674267101, "autogenerated": false, "ratio": 4.263888888888889, "config_test":...
from django.utils.functional import SimpleLazyObject from django.contrib.auth.middleware import load_backend from django.conf import settings SESSION_KEY = '_auth_user_id' BACKEND_SESSION_KEY = '_auth_user_backend' def get_user(request): if not hasattr(request, '_cached_user'): request._cached_user = lo...
{ "repo_name": "jAlpedrinha/DeclRY", "path": "declry/middleware.py", "copies": "1", "size": "1457", "license": "bsd-3-clause", "hash": 706131466927908600, "line_mean": 36.358974359, "line_max": 230, "alpha_frac": 0.7096774194, "autogenerated": false, "ratio": 4.174785100286533, "config_test": fa...
from django.utils.functional import SimpleLazyObject from django.contrib.auth.models import AnonymousUser from rest_framework.request import Request from rest_framework_jwt.authentication import JSONWebTokenAuthentication def get_user_jwt(request): """ Replacement for django session auth get_user & auth.get_...
{ "repo_name": "andela-sjames/Django-ReactJS-Library-App", "path": "reactlibapp/libraryapi/jwt_authentication.py", "copies": "1", "size": "1631", "license": "mit", "hash": -3632269569017350000, "line_mean": 36.9302325581, "line_max": 78, "alpha_frac": 0.7044757817, "autogenerated": false, "ratio":...
from django.utils.functional import SimpleLazyObject from django.utils.safestring import mark_safe from django.utils.translation import get_language from .models import Metadata from .settings import CONFIG class MetadataContextObject(object): def __init__(self, url_path, site): metadata = self._get_met...
{ "repo_name": "trilan/lemon-metadata", "path": "metadata/context_processors.py", "copies": "1", "size": "1488", "license": "isc", "hash": 7760332012947097000, "line_mean": 28.76, "line_max": 69, "alpha_frac": 0.6048387097, "autogenerated": false, "ratio": 4.441791044776119, "config_test": false...
from django.utils.functional import SimpleLazyObject from tinycart.models import Cart class CartMiddleware(object): def process_request(self, request): request.cart = SimpleLazyObject( lambda: Cart.objects.get_for_request(request) ) class HTTPMethodOverrideMiddleware(object): a...
{ "repo_name": "trilan/django-tinycart", "path": "tinycart/middleware.py", "copies": "2", "size": "1091", "license": "bsd-3-clause", "hash": 4378849093969902600, "line_mean": 32.0606060606, "line_max": 72, "alpha_frac": 0.6342804766, "autogenerated": false, "ratio": 4.101503759398496, "config_te...
from django.utils.functional import SimpleLazyObject def dict_keys_to_str(dictionary, recursive=False): res = dict([(str(k), (not isinstance(v, dict) and v) or (recursive and dict_keys_to_str(v)) or v) for k,v in dictionary.items()]) if '_id' in res: res["id"] = res.pop("_id") return res class Mo...
{ "repo_name": "aparo/django-elasticsearch", "path": "django_elasticsearch/utils.py", "copies": "1", "size": "1125", "license": "bsd-3-clause", "hash": -4494767006856345000, "line_mean": 36.5, "line_max": 133, "alpha_frac": 0.624, "autogenerated": false, "ratio": 3.9473684210526314, "config_test...
from django.utils.functional import SimpleLazyObject from auth_token import utils # pylint: disable=E0401 from auth_token.config import settings as auth_token_settings # pylint: disable=E0401 from auth_token.middleware import TokenAuthenticationMiddleware, get_user # pylint: disable=E0401 from auth_token.models imp...
{ "repo_name": "druids/django-chamber", "path": "chamber/multidomains/auth/middleware.py", "copies": "1", "size": "1600", "license": "bsd-3-clause", "hash": -6178805132575239000, "line_mean": 43.4444444444, "line_max": 102, "alpha_frac": 0.743125, "autogenerated": false, "ratio": 3.809523809523809...
from django.utils.functional import SimpleLazyObject from .models import VendUser def get_session_venduser(request): # Can't refer to venduser if not authenticated if not request.user.is_authenticated: return None # If venduser is in session, use it pk = request.session.get('venduser_id') ...
{ "repo_name": "remarkablerocket/django-vend", "path": "django_vend/auth/middleware.py", "copies": "1", "size": "1374", "license": "bsd-3-clause", "hash": -6465025602018032000, "line_mean": 29.5333333333, "line_max": 79, "alpha_frac": 0.6841339156, "autogenerated": false, "ratio": 3.62532981530343...
from django.utils.functional import SimpleLazyObject from wagtail.core.models import Site from .registry import registry class SettingsProxy(dict): """ Get a SettingModuleProxy for an app using proxy['app_label'] """ def __init__(self, site): self.site = site def __missing__(self, app_l...
{ "repo_name": "timorieber/wagtail", "path": "wagtail/contrib/settings/context_processors.py", "copies": "1", "size": "1748", "license": "bsd-3-clause", "hash": 6575744528058399000, "line_mean": 26.3125, "line_max": 74, "alpha_frac": 0.6064073227, "autogenerated": false, "ratio": 4.074592074592075...
from django.utils.functional import wraps from django.shortcuts import get_object_or_404, render_to_response from django.template.loader import get_template from django.template.context import RequestContext from django.http import HttpResponseRedirect from django.core.serializers.json import DjangoJSONEncoder from i...
{ "repo_name": "Laimiux/mydeatree", "path": "ideas/ideas_helpers.py", "copies": "1", "size": "2218", "license": "bsd-3-clause", "hash": -8616310458576397000, "line_mean": 31.6176470588, "line_max": 80, "alpha_frac": 0.607754734, "autogenerated": false, "ratio": 4.471774193548387, "config_test": ...
from django.utils.html import conditional_escape as esc from django.utils.safestring import mark_safe from itertools import groupby from calendar import HTMLCalendar, monthrange from datetime import date class Calendar(HTMLCalendar): """ Renders HTML code for the calendar, needed in core/views.py. Make su...
{ "repo_name": "tfiers/arenberg-online", "path": "core/htmlcalendar.py", "copies": "1", "size": "4548", "license": "mit", "hash": 4983527680351805000, "line_mean": 50.1123595506, "line_max": 183, "alpha_frac": 0.5250659631, "autogenerated": false, "ratio": 3.972052401746725, "config_test": false...
from django.utils.html import conditional_escape from django.utils.encoding import smart_unicode, StrAndUnicode, force_unicode from django.utils.safestring import mark_safe def flatatt(attrs): """ Convert a dictionary of attributes to a single string. The returned string will contain a leading space follow...
{ "repo_name": "jamslevy/gsoc", "path": "app/django/forms/util.py", "copies": "12", "size": "2577", "license": "apache-2.0", "hash": -692088918177282600, "line_mean": 36.8970588235, "line_max": 126, "alpha_frac": 0.6111757858, "autogenerated": false, "ratio": 3.8234421364985165, "config_test": f...
from django.utils.html import conditional_escape from django.utils.encoding import smart_unicode, StrAndUnicode, force_unicode from django.utils.safestring import mark_safe def flatatt(attrs): """ Convert a dictionary of attributes to a single string. The returned string will contain a leading space...
{ "repo_name": "greggian/TapdIn", "path": "django/forms/util.py", "copies": "1", "size": "2665", "license": "apache-2.0", "hash": 1966481993333784000, "line_mean": 37.1911764706, "line_max": 126, "alpha_frac": 0.5973733583, "autogenerated": false, "ratio": 3.9191176470588234, "config_test": fals...
from django.utils.html import escape, conditional_escape from django.utils.encoding import force_unicode from django.utils.safestring import mark_safe from django.forms.widgets import ClearableFileInput, CheckboxInput class AdvancedFileInput(ClearableFileInput): def __init__(self, *args, **kwargs): self....
{ "repo_name": "hkarl/svpb", "path": "boote/custom_widgets.py", "copies": "1", "size": "2142", "license": "apache-2.0", "hash": 463742094770368800, "line_mean": 45.5869565217, "line_max": 112, "alpha_frac": 0.5985060691, "autogenerated": false, "ratio": 4.072243346007604, "config_test": false, ...
from django.utils.html import escape, conditional_escape from django.utils.safestring import mark_safe from django.forms.widgets import ClearableFileInput, CheckboxInput class ClearableImageInput(ClearableFileInput): template_with_initial = u'<div class="image-field"><div class="image-currently">%(initial_text)s:<...
{ "repo_name": "JordanReiter/sorl-thumbnail", "path": "sorl/thumbnail/widgets.py", "copies": "1", "size": "2647", "license": "bsd-3-clause", "hash": 1930711265203257000, "line_mean": 48.0185185185, "line_max": 232, "alpha_frac": 0.5508122403, "autogenerated": false, "ratio": 4.494057724957555, "...
from django.utils.html import escape, linebreaks, urlize from django.utils.functional import curry from django.utils.translation import pgettext_lazy as _ from django.conf import settings # build DEFAULT_MARKUP_TYPES DEFAULT_MARKUP_TYPES = [ ('html', lambda markup: markup, _('django-markupfield', 'HTML')), ...
{ "repo_name": "leonardo-modules/leonardo-epiceditor", "path": "leonardo_epiceditor/utils.py", "copies": "1", "size": "3018", "license": "bsd-3-clause", "hash": 6138594091647967000, "line_mean": 33.2954545455, "line_max": 80, "alpha_frac": 0.6159708416, "autogenerated": false, "ratio": 4.565809379...
from django.utils.html import escape from django.utils.encoding import smart_unicode def flatatt(attrs): """ Convert a dictionary of attributes to a single string. The returned string will contain a leading space followed by key="value", XML-style pairs. It is assumed that the keys do not need to be X...
{ "repo_name": "jonaustin/advisoryscan", "path": "django/django/newforms/util.py", "copies": "1", "size": "2242", "license": "mit", "hash": 8672757340992327000, "line_mean": 37, "line_max": 111, "alpha_frac": 0.6110615522, "autogenerated": false, "ratio": 3.7680672268907562, "config_test": false...
from django.utils.html import escape from django.utils.encoding import smart_unicode, StrAndUnicode, force_unicode from django.utils.functional import Promise from django.utils.safestring import mark_safe def flatatt(attrs): """ Convert a dictionary of attributes to a single string. The returned string wil...
{ "repo_name": "rawwell/django", "path": "django/newforms/util.py", "copies": "5", "size": "2597", "license": "bsd-3-clause", "hash": -3427994867828118500, "line_mean": 36.6376811594, "line_max": 126, "alpha_frac": 0.6126299576, "autogenerated": false, "ratio": 3.8191176470588237, "config_test":...
from django.utils.html import escape from django.utils.safestring import mark_safe from wmr.thriftapi.ttypes import * class WMRError(object): class AdditionalInfo(object): def __init__(self, info): self.info = info def as_table(self): output = '' for ke...
{ "repo_name": "benjamin-guillet/wmr-frontend", "path": "wmr/errors.py", "copies": "2", "size": "5046", "license": "apache-2.0", "hash": 4490736389900866000, "line_mean": 35.3021582734, "line_max": 109, "alpha_frac": 0.5198176774, "autogenerated": false, "ratio": 4.616651418115279, "config_test"...
from django.utils.html import escape from django.utils.translation import gettext_lazy as _ from wagtail.utils.apps import get_app_submodules from .shortcuts import get_rendition_or_not_found class Format: def __init__(self, name, label, classnames, filter_spec): self.name = name self.label = la...
{ "repo_name": "FlipperPA/wagtail", "path": "wagtail/images/formats.py", "copies": "4", "size": "2812", "license": "bsd-3-clause", "hash": -2312905320930232300, "line_mean": 28.914893617, "line_max": 101, "alpha_frac": 0.652916074, "autogenerated": false, "ratio": 3.675816993464052, "config_test...
from django.utils.html import escape from django.utils.translation import ugettext_lazy as _ from embed_video.backends import detect_backend from wagtail.utils.apps import get_app_submodules class EmbedVideoFormat(object): def __init__(self, name, label, classnames, filter_spec): self.name = name ...
{ "repo_name": "SalahAdDin/wagtail-embedvideos", "path": "wagtail_embed_videos/formats.py", "copies": "1", "size": "3086", "license": "bsd-3-clause", "hash": 5431875468437261000, "line_mean": 30.1717171717, "line_max": 111, "alpha_frac": 0.6445236552, "autogenerated": false, "ratio": 3.71807228915...
from django.utils.html import escape from django.utils.translation import ugettext_lazy as _ from wagtail.utils.apps import get_app_submodules from .shortcuts import get_rendition_or_not_found class Format: def __init__(self, name, label, classnames, filter_spec): self.name = name self.label = l...
{ "repo_name": "mixxorz/wagtail", "path": "wagtail/images/formats.py", "copies": "14", "size": "2813", "license": "bsd-3-clause", "hash": 4056405796783496700, "line_mean": 28.9255319149, "line_max": 101, "alpha_frac": 0.6530394597, "autogenerated": false, "ratio": 3.6771241830065358, "config_tes...
from django.utils.html import escape from django.utils.translation import ugettext_lazy as _ import jingo import jinja2 from . import forms @jingo.register.function def SimpleSearchForm(request, search_cat): data = request.GET if search_cat and 'cat' not in request.GET: data = dict(request.GET, cat=...
{ "repo_name": "andymckay/olympia", "path": "src/olympia/search/helpers.py", "copies": "2", "size": "1914", "license": "bsd-3-clause", "hash": 2422834132415663600, "line_mean": 32, "line_max": 78, "alpha_frac": 0.6081504702, "autogenerated": false, "ratio": 3.5977443609022557, "config_test": fal...
from django.utils.html import escape from wagtail.images.formats import register_image_format, \ unregister_image_format, Format from wagtail.images.models import SourceImageIOError class FullWidthImgFormat(Format): def image_to_editor_html(self, image, alt_text, extra_attributes=None): if extra_attr...
{ "repo_name": "PARINetwork/pari", "path": "article/image_formats.py", "copies": "1", "size": "2575", "license": "bsd-3-clause", "hash": -8182171218699063000, "line_mean": 44.9821428571, "line_max": 114, "alpha_frac": 0.6186407767, "autogenerated": false, "ratio": 4.0234375, "config_test": false...
from django.utils.html import escape from wagtail.utils.apps import get_app_submodules from .shortcuts import get_rendition_or_not_found class Format(object): def __init__(self, name, label, classnames, filter_spec): self.name = name self.label = label self.classnames = classnames ...
{ "repo_name": "davecranwell/wagtail", "path": "wagtail/wagtailimages/formats.py", "copies": "4", "size": "2791", "license": "bsd-3-clause", "hash": 832825672981904100, "line_mean": 29.6703296703, "line_max": 98, "alpha_frac": 0.6485130777, "autogenerated": false, "ratio": 3.5966494845360826, "c...
from django.utils.html import escape from wagtail.utils.apps import get_app_submodules from wagtail.wagtailimages.models import SourceImageIOError class Format(object): def __init__(self, name, label, classnames, filter_spec): self.name = name self.label = label self.classnames = classnam...
{ "repo_name": "Klaudit/wagtail", "path": "wagtail/wagtailimages/formats.py", "copies": "31", "size": "3289", "license": "bsd-3-clause", "hash": -1462225425606321000, "line_mean": 32.2222222222, "line_max": 113, "alpha_frac": 0.6485253877, "autogenerated": false, "ratio": 3.7332576617480138, "co...
from django.utils.html import escape from wagtail.utils.apps import get_app_submodules class Format(object): def __init__(self, name, label, classnames, filter_spec): self.name = name self.label = label self.classnames = classnames self.filter_spec = filter_spec def editor_at...
{ "repo_name": "thenewguy/wagtail", "path": "wagtail/wagtailimages/formats.py", "copies": "4", "size": "2727", "license": "bsd-3-clause", "hash": -2003630172163256600, "line_mean": 29.3, "line_max": 98, "alpha_frac": 0.6450311698, "autogenerated": false, "ratio": 3.6119205298013246, "config_test...
from django.utils.html import escape import jingo import jinja2 from tower import ugettext_lazy as _ from . import forms @jingo.register.function def SimpleSearchForm(request, search_cat): data = request.GET if search_cat and 'cat' not in request.GET: data = dict(request.GET, cat=search_cat) ret...
{ "repo_name": "clouserw/olympia", "path": "apps/search/helpers.py", "copies": "7", "size": "1894", "license": "bsd-3-clause", "hash": 7987221957325625000, "line_mean": 32.2280701754, "line_max": 78, "alpha_frac": 0.6045406547, "autogenerated": false, "ratio": 3.6007604562737643, "config_test": ...
from django.utils.html import escape from sscr import texts import os with open('template/template.html', 'rb') as f: TemplateData = f.read() with open('template/s2d.js', 'rb') as f: s2dData = f.read() class PageGenerator: def __init__(self, title=''): self.title = title ...
{ "repo_name": "loblao/sscr", "path": "sscr/html.py", "copies": "1", "size": "4463", "license": "mit", "hash": -5192810437248515000, "line_mean": 29.6524822695, "line_max": 102, "alpha_frac": 0.4382702218, "autogenerated": false, "ratio": 3.8145299145299147, "config_test": false, "has_no_keywo...
from django.utils.html import escape, strip_tags from django.core.urlresolvers import reverse from django.contrib import admin from django.utils.translation import ugettext as _ from django.http import HttpResponse, HttpResponseRedirect from django.utils.encoding import force_unicode from dbe.todo.models import * cla...
{ "repo_name": "pythonbyexample/PBE", "path": "dbe/todo2/admin.py", "copies": "1", "size": "2273", "license": "bsd-3-clause", "hash": 1965224909740971500, "line_mean": 40.3272727273, "line_max": 98, "alpha_frac": 0.6295644523, "autogenerated": false, "ratio": 4.264540337711069, "config_test": fa...
from django.utils.html import format_html, format_html_join, escape from django.utils.safestring import mark_safe from django.forms.utils import flatatt from . import wrappers from .utils import pad, get_choices, get_placeholder_text def render_charfield(field, attrs): """ Render the generic CharField. """ retur...
{ "repo_name": "thetarkus/django-semanticui-forms", "path": "semanticuiforms/fields.py", "copies": "1", "size": "5327", "license": "mit", "hash": -236780723303980260, "line_mean": 25.7738693467, "line_max": 89, "alpha_frac": 0.7015205557, "autogenerated": false, "ratio": 3.234365513054038, "conf...
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 allow_without_attributes, attribute_rule def whitelister_element_rules(): return { 'pre': allow_without_attributes, 'code': a...
{ "repo_name": "DebVortex/max-brauer.de", "path": "maxbrauer/apps/blogutils/wagtail_hooks.py", "copies": "1", "size": "1221", "license": "bsd-3-clause", "hash": 6693314107470046000, "line_mean": 27.3953488372, "line_max": 82, "alpha_frac": 0.6322686323, "autogenerated": false, "ratio": 3.46875, ...
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 allow_without_attributes, attribute_rule @hooks.register('construct_whitelister_element_rules') def whitelister_element_rules(): return { ...
{ "repo_name": "Tivix/wagtail-blog-app", "path": "wagtail_blog/wagtail_hooks.py", "copies": "2", "size": "1747", "license": "mit", "hash": 7850600241945359000, "line_mean": 27.1774193548, "line_max": 82, "alpha_frac": 0.6141957642, "autogenerated": false, "ratio": 3.6778947368421053, "config_tes...
from django.utils.html import format_html_join, format_html from django.conf import settings from wagtail.wagtailcore import hooks from wagtail.wagtailcore.whitelist import allow_without_attributes from wagtailmodeladmin.options import ModelAdminGroup, ModelAdmin, wagtailmodeladmin_register from .models import Googl...
{ "repo_name": "spketoundi/CamODI", "path": "waespk/core/wagtail_hooks.py", "copies": "1", "size": "2051", "license": "mit", "hash": 8286547508437214000, "line_mean": 28.3, "line_max": 103, "alpha_frac": 0.7030716724, "autogenerated": false, "ratio": 3.763302752293578, "config_test": false, "h...
from django.utils.html import format_html_join, format_html from django.conf import settings from wagtail.wagtailcore import hooks def check_footnote_sup_class(x): if x.get('class', []) == ['footnote--number']: return x else: return None @hooks.register('construct_whitelister_element_rules'...
{ "repo_name": "torchbox/longform", "path": "longform/wagtail_hooks.py", "copies": "1", "size": "1079", "license": "mit", "hash": 4108010189019484700, "line_mean": 23.5227272727, "line_max": 66, "alpha_frac": 0.5875810936, "autogenerated": false, "ratio": 3.64527027027027, "config_test": false, ...
from django.utils.html import format_html, mark_safe from django.views import generic from content_editor.contents import contents_for_item from .models import AbstractRichText, Article, Download, Page, PageText, RichText def render_items(items): for item in items: if isinstance(item, AbstractRichText):...
{ "repo_name": "matthiask/feincms2-content", "path": "tests/testapp/views.py", "copies": "2", "size": "1399", "license": "bsd-3-clause", "hash": -7272606810482097000, "line_mean": 30.0888888889, "line_max": 84, "alpha_frac": 0.611150822, "autogenerated": false, "ratio": 4.1513353115727005, "conf...
from django.utils.html import format_html from django.contrib.staticfiles.templatetags.staticfiles import static from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register, ModelAdminGroup from wagtail.core import hooks from .models import Banner, FooterLinkSection, Indicator class IndicatorAdmin...
{ "repo_name": "City-of-Helsinki/digihel", "path": "digi/wagtail_hooks.py", "copies": "1", "size": "1227", "license": "mit", "hash": 29629004917053012, "line_mean": 24.0408163265, "line_max": 95, "alpha_frac": 0.6992665037, "autogenerated": false, "ratio": 3.6088235294117648, "config_test": fals...
from django.utils.html import format_html from django.http import HttpResponseRedirect from django.contrib import messages from django.utils.translation import ugettext as _ from django.urls import reverse from django.shortcuts import render from django.utils.safestring import mark_safe from extensions.views import (T...
{ "repo_name": "CloudBoltSoftware/cloudbolt-forge", "path": "ui_extensions/solar_winds/views.py", "copies": "1", "size": "11960", "license": "apache-2.0", "hash": -1557744055651315500, "line_mean": 34.9159159159, "line_max": 137, "alpha_frac": 0.6368729097, "autogenerated": false, "ratio": 3.77763...
from django.utils.html import format_html from django.utils.translation import gettext_lazy as _ from cms.plugin_pool import plugin_pool from cmsplugin_cascade import app_settings from cmsplugin_cascade.plugin_base import CascadePluginBase, TransparentContainer class CustomSnippetPlugin(TransparentContainer, Cascade...
{ "repo_name": "jrief/djangocms-cascade", "path": "cmsplugin_cascade/generic/custom_snippet.py", "copies": "1", "size": "1311", "license": "mit", "hash": 7371440690309240000, "line_mean": 42.7, "line_max": 136, "alpha_frac": 0.7536231884, "autogenerated": false, "ratio": 4.109717868338558, "conf...
from django.utils.html import format_html from django.utils.translation import gettext from rest_framework import serializers from olympia.addons.models import Addon from olympia.addons.serializers import AddonSerializer, VersionSerializer from olympia.api.fields import ( FallbackField, GetTextTranslationSeri...
{ "repo_name": "diox/olympia", "path": "src/olympia/discovery/serializers.py", "copies": "4", "size": "4196", "license": "bsd-3-clause", "hash": -1454542734195620400, "line_mean": 31.0305343511, "line_max": 79, "alpha_frac": 0.6191611058, "autogenerated": false, "ratio": 4.44021164021164, "confi...
from django.utils.html import format_html from django.utils.translation import ugettext_lazy as _ from generic_admin import mixins, filters class CustomPageTemplateAdmin(mixins.PermissionsControl): list_display = ['id', 'name'] fieldsets = ( ('Базовые характеристики', { 'classes': ('sec...
{ "repo_name": "fidals/refarm-site", "path": "generic_admin/models.py", "copies": "1", "size": "4216", "license": "mit", "hash": 3913546182307475000, "line_mean": 28.3597122302, "line_max": 96, "alpha_frac": 0.5037980887, "autogenerated": false, "ratio": 3.7717190388170057, "config_test": false,...
from django.utils.html import format_html from django.utils.translation import ugettext from rest_framework import serializers from olympia.addons.models import Addon from olympia.addons.serializers import AddonSerializer, VersionSerializer from olympia.api.utils import is_gate_active from olympia.discovery.models im...
{ "repo_name": "eviljeff/olympia", "path": "src/olympia/discovery/serializers.py", "copies": "1", "size": "3595", "license": "bsd-3-clause", "hash": -4327939699113838000, "line_mean": 36.0618556701, "line_max": 79, "alpha_frac": 0.6472878999, "autogenerated": false, "ratio": 4.315726290516206, "...
from django.utils.html import format_html from markdown import markdown from sorl.thumbnail import get_thumbnail IMAGE_STYLES = { 'thumb': { 'width': 80, 'height': 80, 'crop': 'center', 'upscale': False, 'quality': 95, 'progressive': False, 'srcset': [1, 1.5...
{ "repo_name": "DylanMcCall/stuartmccall.ca", "path": "common/utils.py", "copies": "1", "size": "2329", "license": "mit", "hash": -4169621056180316000, "line_mean": 25.1685393258, "line_max": 82, "alpha_frac": 0.5410047231, "autogenerated": false, "ratio": 3.7027027027027026, "config_test": fals...
from django.utils.html import linebreaks from django.utils import timezone, dateformat from drf_hal_json.serializers import HalModelSerializer from rest_framework import serializers from event_store.models import Event class OsdiEventSerializer(HalModelSerializer): class Meta: model = Event field...
{ "repo_name": "MoveOnOrg/eventroller", "path": "event_exim/serializers.py", "copies": "1", "size": "2875", "license": "mit", "hash": -3181127509183789000, "line_mean": 35.858974359, "line_max": 94, "alpha_frac": 0.6100869565, "autogenerated": false, "ratio": 4.0607344632768365, "config_test": f...
from django.utils.html import linebreaks import settings if settings.use_strftime: import gregtime class Quote: def renderTeaser(self): output = '' if self.img_url: output = '<img src="%s" title="%s" alt="%s"%s%s />' % (self.img_url, self.name, self.name, ' width="%s"' % (self.img...
{ "repo_name": "pmylund/haveabit", "path": "bit.py", "copies": "2", "size": "2279", "license": "mit", "hash": -5133296554492201000, "line_mean": 44.58, "line_max": 276, "alpha_frac": 0.5568231681, "autogenerated": false, "ratio": 3.4270676691729323, "config_test": false, "has_no_keywords": fal...
from django.utils.html import linebreaks, urlize from django.utils.functional import curry from django.conf import settings # build DEFAULT_MARKUP_TYPES DEFAULT_MARKUP_TYPES = [ ('html', lambda markup: markup), ('plain', lambda markup: urlize(linebreaks(markup))), ] try: import pygments PYGMENTS_INSTA...
{ "repo_name": "Osmose/trephub", "path": "vendor-local/lib/python/markupfield/markup.py", "copies": "1", "size": "2712", "license": "bsd-3-clause", "hash": 8404753081679681000, "line_mean": 30.9058823529, "line_max": 96, "alpha_frac": 0.6522861357, "autogenerated": false, "ratio": 4.29793977812995...
from django.utils.html import strip_tags from django.utils.encoding import force_unicode from urlparse import urlsplit from BeautifulSoup import BeautifulSoup def parse_html_links(text, domain): def is_external(href): if not href.startswith('http://') and not href.startswith('https://'): retur...
{ "repo_name": "strogo/turbion", "path": "turbion/bits/pingback/utils.py", "copies": "1", "size": "1928", "license": "bsd-3-clause", "hash": -2057427860449688300, "line_mean": 30.606557377, "line_max": 78, "alpha_frac": 0.6161825726, "autogenerated": false, "ratio": 3.975257731958763, "config_te...
from django.utils.html import strip_tags from django.utils.text import Truncator from django.utils.translation import ugettext_lazy as _ from fluent_contents.extensions import PluginHtmlField from fluent_contents.models import ContentItem from fluent_contents.plugins.text import appsettings from django_wysiwyg.utils im...
{ "repo_name": "pombredanne/django-fluent-contents", "path": "fluent_contents/plugins/text/models.py", "copies": "1", "size": "1041", "license": "apache-2.0", "hash": -6181128378353440000, "line_mean": 31.53125, "line_max": 58, "alpha_frac": 0.6849183477, "autogenerated": false, "ratio": 3.7178571...
from django.utils.html import strip_tags from django.utils.text import Truncator def truncate_string( text, strip_html=True, chars=255, truncate="…", at_word_boundary=False ): """Truncate a string to a certain length, removing line breaks and mutliple spaces, optionally removing HTML, and appending a 'tru...
{ "repo_name": "philgyford/django-spectator", "path": "spectator/core/utils.py", "copies": "1", "size": "2593", "license": "mit", "hash": 6228840948103347000, "line_mean": 34.4931506849, "line_max": 79, "alpha_frac": 0.6391354689, "autogenerated": false, "ratio": 4.099683544303797, "config_test"...
from django.utils.html import strip_tags from django.utils.translation import ugettext_lazy as _, ungettext from django.utils.timezone import now from django.contrib import messages from django.views import generic from django.conf import settings from oscar.core.loading import get_model from oscar.core.utils import r...
{ "repo_name": "amirrpp/django-oscar", "path": "src/oscar/apps/customer/notifications/views.py", "copies": "23", "size": "3553", "license": "bsd-3-clause", "hash": 3198642792568050000, "line_mean": 32.5188679245, "line_max": 74, "alpha_frac": 0.664790318, "autogenerated": false, "ratio": 4.2097156...
from django.utils.html import strip_tags from googleapiclient import discovery from googleapiclient.http import HttpRequest import urllib.request import urllib.parse import json from django.conf import settings from httplib2 import Http from typing import List from .models import Book class GoogleBooksAPI(object): ...
{ "repo_name": "Nuurek/HomeLibrary", "path": "books/google_books_api.py", "copies": "1", "size": "2660", "license": "mit", "hash": -3493296119122088000, "line_mean": 32.25, "line_max": 118, "alpha_frac": 0.5766917293, "autogenerated": false, "ratio": 4.104938271604938, "config_test": false, "h...
from django.utils.html import strip_tags import settings as sendgrid_settings import logging logger = logging.getLogger('gidsy.apps.sendgrid') if sendgrid_settings.THREADED_MESSAGES_USE_SENDGRID: from sendgrid_parse_api.signals import email_received else: email_received = None def signal_received_email(sender...
{ "repo_name": "philippWassibauer/django-threaded-messages", "path": "threaded_messages/listeners.py", "copies": "1", "size": "1122", "license": "mit", "hash": -8810057831187655000, "line_mean": 34.0625, "line_max": 93, "alpha_frac": 0.6229946524, "autogenerated": false, "ratio": 3.74, "config_t...
from django.utils.html import strip_tags from .models import IdentitySettings from .utils import get_image_url, get_site class Metadata(object): ''' Extract metadata from a Page object ''' def __init__(self, context=None, **kwargs): self.context = context = context or {} self.kwargs =...
{ "repo_name": "apihackers/wapps", "path": "wapps/metadata.py", "copies": "1", "size": "2685", "license": "mit", "hash": -5184494660815711000, "line_mean": 32.9873417722, "line_max": 82, "alpha_frac": 0.6011173184, "autogenerated": false, "ratio": 3.931185944363104, "config_test": false, "has_...
from django.utils.html import strip_tags class Highlighter(object): css_class = 'highlighted' html_tag = 'span' max_length = 200 text_block = '' def __init__(self, query, **kwargs): self.query = query if 'max_length' in kwargs: self.max_length = int(kwargs...
{ "repo_name": "ericholscher/django-haystack", "path": "haystack/utils/highlighting.py", "copies": "8", "size": "5954", "license": "bsd-3-clause", "hash": 3226728204796936700, "line_mean": 35.9813664596, "line_max": 105, "alpha_frac": 0.5290560967, "autogenerated": false, "ratio": 4.35233918128655...
from django.utils.http import http_date, parse_http_date_safe class ConditionalGetMiddleware(object): """ Handles conditional GET operations. If the response has a ETag or Last-Modified header, and the request has If-None-Match or If-Modified-Since, the response is replaced by an HttpNotModified. ...
{ "repo_name": "yeraydiazdiaz/nonrel-blog", "path": "django/middleware/http.py", "copies": "105", "size": "1643", "license": "bsd-3-clause", "hash": -883454901955170600, "line_mean": 45.9428571429, "line_max": 84, "alpha_frac": 0.621424224, "autogenerated": false, "ratio": 4.416666666666667, "co...
from django.utils.http import http_date, parse_http_date_safe class ConditionalGetMiddleware(object): """ Handles conditional GET operations. If the response has a ETag or Last-Modified header, and the request has If-None-Match or If-Modified-Since, the response is replaced by an HttpNotModified. ...
{ "repo_name": "Bashar/django", "path": "django/middleware/http.py", "copies": "23", "size": "1671", "license": "bsd-3-clause", "hash": 5578719755135547000, "line_mean": 45.4166666667, "line_max": 84, "alpha_frac": 0.6247755835, "autogenerated": false, "ratio": 4.43236074270557, "config_test": f...
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-Since, the response is replaced by an HttpNotModified. ...
{ "repo_name": "maxsocl/django", "path": "django/middleware/http.py", "copies": "247", "size": "2129", "license": "bsd-3-clause", "hash": 8675428939138056000, "line_mean": 50.9268292683, "line_max": 84, "alpha_frac": 0.6406763739, "autogenerated": false, "ratio": 4.199211045364891, "config_test"...
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-Since, the response is replaced by an HttpNotModifi...
{ "repo_name": "diego-d5000/MisValesMd", "path": "env/lib/python2.7/site-packages/django/middleware/http.py", "copies": "1", "size": "2170", "license": "mit", "hash": 5694074694844421000, "line_mean": 50.9268292683, "line_max": 84, "alpha_frac": 0.6285714286, "autogenerated": false, "ratio": 4.280...
from django.utils.http import int_to_base36 from django_town.rest.resources import Resource from django_town.social.models.geo import AddressComponent, AddressComponentType class RegionResource(Resource): def create(self, data=None, files=None, acceptable=None, required=None, exclude=None, request=None, ...
{ "repo_name": "uptown/django-town", "path": "django_town/social/resources/region.py", "copies": "1", "size": "2642", "license": "mit", "hash": 7372595520318341000, "line_mean": 45.3684210526, "line_max": 126, "alpha_frac": 0.5821347464, "autogenerated": false, "ratio": 4.403333333333333, "confi...
from django.utils.http import is_safe_url from django.http import HttpResponseRedirect from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth import REDIRECT_FIELD_NAME, login as auth_login, logout from django.utils.decorators import method_decorator from django.views.decorators.cache im...
{ "repo_name": "isfon/DjangoSales", "path": "DjangoSales/apps/users/views.py", "copies": "1", "size": "2491", "license": "mit", "hash": 8201477194819515000, "line_mean": 38.8524590164, "line_max": 97, "alpha_frac": 0.6883534137, "autogenerated": false, "ratio": 3.9967897271268056, "config_test":...
from django.utils.http import urlencode from django.contrib.admin.views.main import ChangeList as BaseChangelist from formadmin.hacks import fake_queryset # The system will display a "Show all" link on the change list only if the # total result count is less than or equal to this setting. MAX_SHOW_ALL_ALLOWED = 200 ...
{ "repo_name": "d0ugal-archive/django-formadmin", "path": "formadmin/views.py", "copies": "1", "size": "2018", "license": "mit", "hash": 5209183762551362000, "line_mean": 26.2702702703, "line_max": 74, "alpha_frac": 0.5807730426, "autogenerated": false, "ratio": 3.6164874551971327, "config_test"...
from django.utils.http import urlencode from django.shortcuts import render_to_response from django.template import RequestContext from django.core.urlresolvers import reverse from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.http import HttpResponseRedirect from djang...
{ "repo_name": "wd5/jangr", "path": "allauth/openid/views.py", "copies": "4", "size": "4047", "license": "bsd-3-clause", "hash": 347430852408002370, "line_mean": 36.128440367, "line_max": 82, "alpha_frac": 0.6422041018, "autogenerated": false, "ratio": 4.370410367170626, "config_test": false, ...
from django.utils.http import urlencode from django.shortcuts import render_to_response from django.template import RequestContext from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.views.decorators.csrf import csrf_exempt from openid.consumer.discover import Discover...
{ "repo_name": "uroslates/django-allauth", "path": "allauth/socialaccount/providers/openid/views.py", "copies": "1", "size": "4140", "license": "mit", "hash": -5518196578110035000, "line_mean": 35.6371681416, "line_max": 82, "alpha_frac": 0.6292270531, "autogenerated": false, "ratio": 4.4089456869...
from django.utils.http import urlencode from django.urls import reverse, NoReverseMatch def make_filter_url(url_name, data=None, get_active_filters=None): if data is None: data = {} data = dict(data) url_kwargs = {} if get_active_filters is None: active_filters = {} else: ...
{ "repo_name": "stefanw/froide", "path": "froide/helper/search/facets.py", "copies": "1", "size": "2297", "license": "mit", "hash": -6896895526329654000, "line_mean": 27.3580246914, "line_max": 79, "alpha_frac": 0.5363517632, "autogenerated": false, "ratio": 3.728896103896104, "config_test": fal...
from django.utils.http import urlencode from hashlib import md5 def get_gravatar(email, size=80, default='identicon'): """ Get's a Gravatar for a email address. :param email: used to get gravatar url :param size: The size in pixels of one side of the Gravatar's square image. Optional, if not supplied will de...
{ "repo_name": "Towhidn/django-boilerplate", "path": "account/utils.py", "copies": "1", "size": "1358", "license": "mit", "hash": -107874589949569810, "line_mean": 29.1777777778, "line_max": 89, "alpha_frac": 0.6995581738, "autogenerated": false, "ratio": 3.3781094527363185, "config_test": false...
from django.utils.http import urlencode #django <2 compat try: from django.urls import reverse except ImportError: from django.core.urlresolvers import reverse from .exceptions import InvalidActionError from .exceptions import InvalidControllerError class ApplicationHelper(object): """ApplicationHelpers ...
{ "repo_name": "zeraien/django-url-framework", "path": "django_url_framework/helper.py", "copies": "1", "size": "2767", "license": "mit", "hash": -923655609485720600, "line_mean": 44.3606557377, "line_max": 132, "alpha_frac": 0.639681966, "autogenerated": false, "ratio": 4.7624784853700515, "con...
from django.utils.http import urlencode from allauth.compat import parse_qsl, reverse from allauth.socialaccount.providers.base import Provider class OAuth2Provider(Provider): def get_login_url(self, request, **kwargs): url = reverse(self.id + "_login") if kwargs: url = url + '?' + u...
{ "repo_name": "spool/django-allauth", "path": "allauth/socialaccount/providers/oauth2/provider.py", "copies": "6", "size": "1024", "license": "mit", "hash": 3340201920920348000, "line_mean": 31, "line_max": 69, "alpha_frac": 0.623046875, "autogenerated": false, "ratio": 3.9233716475095783, "con...
from django.utils.http import urlencode from allauth.compat import parse_qsl, reverse from allauth.socialaccount.providers.base import Provider class OAuthProvider(Provider): def get_login_url(self, request, **kwargs): url = reverse(self.id + "_login") if kwargs: url = url + '?' + ur...
{ "repo_name": "okwow123/djangol2", "path": "example/env/lib/python2.7/site-packages/allauth/socialaccount/providers/oauth/provider.py", "copies": "6", "size": "1174", "license": "mit", "hash": -4535384010840236500, "line_mean": 30.7297297297, "line_max": 66, "alpha_frac": 0.6235093697, "autogenerat...
from django.utils.http import urlencode from allauth.compat import reverse from allauth.socialaccount.providers.base import Provider, ProviderAccount class DraugiemAccount(ProviderAccount): def get_avatar_url(self): ret = None pic_small_url = self.account.extra_data.get('img') pic_icon_u...
{ "repo_name": "DarkArtek/FFXIVITAFC", "path": "allauth/socialaccount/providers/draugiem/provider.py", "copies": "6", "size": "1787", "license": "unlicense", "hash": 986613223538432400, "line_mean": 27.8225806452, "line_max": 74, "alpha_frac": 0.6038052602, "autogenerated": false, "ratio": 3.55268...
from django.utils.http import urlencode from allauth.socialaccount import providers from allauth.socialaccount.providers.base import Provider, ProviderAccount from allauth.compat import reverse class DraugiemAccount(ProviderAccount): def get_avatar_url(self): ret = None pic_small_url = self.acc...
{ "repo_name": "wli/django-allauth", "path": "allauth/socialaccount/providers/draugiem/provider.py", "copies": "1", "size": "1813", "license": "mit", "hash": -4268805222358260000, "line_mean": 27.328125, "line_max": 74, "alpha_frac": 0.6083838941, "autogenerated": false, "ratio": 3.597222222222222...
from django.utils.http import urlquote from django.conf import settings from django.http import HttpResponsePermanentRedirect from django.shortcuts import get_object_or_404 from django.views.generic import ListView, DetailView from django.utils.translation import ugettext_lazy as _ from oscar.core.loading import get_c...
{ "repo_name": "marcoantoniooliveira/labweb", "path": "oscar/apps/catalogue/views.py", "copies": "1", "size": "6634", "license": "bsd-3-clause", "hash": 4262991636840704000, "line_mean": 36.9085714286, "line_max": 77, "alpha_frac": 0.6389810069, "autogenerated": false, "ratio": 4.236270753512133, ...
from django.utils.http import urlquote from django import forms from django.core.mail import EmailMultiAlternatives from django.template.loader import render_to_string from django.contrib.sites.models import Site from django.template.defaultfilters import slugify from django.utils.text import get_valid_filename from dj...
{ "repo_name": "arteria/cmsplugin-contact-plus", "path": "cmsplugin_contact_plus/forms.py", "copies": "1", "size": "12083", "license": "bsd-3-clause", "hash": -6633784156495247000, "line_mean": 57.0913461538, "line_max": 111, "alpha_frac": 0.5246213689, "autogenerated": false, "ratio": 5.109090909...
from django.utils.http import urlsafe_base64_encode from django.core.files.uploadedfile import SimpleUploadedFile from django.test import RequestFactory import basket from mock import Mock, patch, MagicMock from pyquery import PyQuery as pq from olympia.amo.tests import TestCase, addon_factory, create_switch from ol...
{ "repo_name": "atiqueahmedziad/addons-server", "path": "src/olympia/users/tests/test_forms.py", "copies": "1", "size": "17979", "license": "bsd-3-clause", "hash": -7648811643669606000, "line_mean": 38.6013215859, "line_max": 79, "alpha_frac": 0.5968073864, "autogenerated": false, "ratio": 3.85815...
from django.utils.http import urlsafe_base64_encode from django.core.files.uploadedfile import SimpleUploadedFile from mock import Mock, patch, MagicMock from pyquery import PyQuery as pq from olympia.amo.tests import TestCase, addon_factory, create_switch from olympia.amo.tests.test_helpers import get_uploaded_file ...
{ "repo_name": "harry-7/addons-server", "path": "src/olympia/users/tests/test_forms.py", "copies": "1", "size": "14573", "license": "bsd-3-clause", "hash": 3546896157664090000, "line_mean": 38.2803234501, "line_max": 79, "alpha_frac": 0.5957592809, "autogenerated": false, "ratio": 3.79801928590044...
from django.utils.http import urlsafe_base64_encode from mock import Mock, patch from pyquery import PyQuery as pq from olympia.amo.tests import TestCase from olympia.amo.urlresolvers import reverse from olympia.amo.tests.test_helpers import get_uploaded_file from olympia.users.models import UserProfile from olympia....
{ "repo_name": "harikishen/addons-server", "path": "src/olympia/users/tests/test_forms.py", "copies": "1", "size": "7146", "license": "bsd-3-clause", "hash": 2807042484262207000, "line_mean": 38.0491803279, "line_max": 78, "alpha_frac": 0.616988525, "autogenerated": false, "ratio": 3.6, "config_...
from django.utils import copycompat as copy from django.conf import settings from django.db import router from django.db.models.query import QuerySet, EmptyQuerySet, insert_query, RawQuerySet from django.db.models import signals from django.db.models.fields import FieldDoesNotExist def ensure_default_manager(sender, ...
{ "repo_name": "softak/webfaction_demo", "path": "vendor-local/lib/python/django/db/models/manager.py", "copies": "1", "size": "7994", "license": "bsd-3-clause", "hash": -5175919924650118000, "line_mean": 35.502283105, "line_max": 125, "alpha_frac": 0.6195896923, "autogenerated": false, "ratio": 3...
from django.utils import copycompat as copy from django.conf import settings from django.db import router from django.db.models.query import QuerySet, EmptyQuerySet, insert_query, RawQuerySet from django.db.models import signals from django.db.models.fields import FieldDoesNotExist def ensure_default_manager(...
{ "repo_name": "shenlong3030/asv-django-guestbook", "path": "django/db/models/manager.py", "copies": "12", "size": "8088", "license": "bsd-3-clause", "hash": 3752140753973017000, "line_mean": 35.4444444444, "line_max": 125, "alpha_frac": 0.6027448071, "autogenerated": false, "ratio": 4.07045797684...
from django.utils import dateparse from .communication import SNSICat import json import logging logger = logging.getLogger('catalog.icat') class Catalog(object): ''' Custom functionality to ICAT! ''' def __init__(self): ''' ''' self.icat = SNSICat() @staticmethod ...
{ "repo_name": "marshallmcdonnell/journals", "path": "etc/catalog/icat/facade.py", "copies": "1", "size": "10751", "license": "mit", "hash": -2855750810632935000, "line_mean": 40.034351145, "line_max": 140, "alpha_frac": 0.464235885, "autogenerated": false, "ratio": 3.7975980219003884, "config_t...
from django.utils import encoding from django.db.models import fields class TruncateBeginning(unicode): "Mark string for truncation at beginning" def truncate(strval, max_length, at_beginning=None): strval = encoding.force_unicode(strval) if len(strval) <= max_length: return strval if at_beg...
{ "repo_name": "altaurog/django-shoogie", "path": "shoogie/utils.py", "copies": "1", "size": "1161", "license": "mit", "hash": -7186226818132636000, "line_mean": 28.025, "line_max": 70, "alpha_frac": 0.5848406546, "autogenerated": false, "ratio": 3.8190789473684212, "config_test": false, "has_...
from django.utils import encoding from django.utils.translation import ugettext_lazy as _ from rest_framework import status from rest_framework.exceptions import APIException from rest_framework.views import exception_handler as drf_exception_handler from rest_framework_json_api.utils import format_value def excepti...
{ "repo_name": "aquavitae/django-rest-framework-json-api", "path": "rest_framework_json_api/exceptions.py", "copies": "1", "size": "1709", "license": "bsd-2-clause", "hash": 7430963554902040000, "line_mean": 33.8775510204, "line_max": 76, "alpha_frac": 0.5740198947, "autogenerated": false, "ratio"...