text stringlengths 0 1.05M | meta dict |
|---|---|
from django.utils.encoding import python_2_unicode_compatible
from allauth.account.models import EmailAddress
from allauth.socialaccount import app_settings
from ..adapter import get_adapter
class AuthProcess(object):
LOGIN = 'login'
CONNECT = 'connect'
REDIRECT = 'redirect'
class AuthAction(object):
... | {
"repo_name": "okwow123/djangol2",
"path": "allauth/socialaccount/providers/base.py",
"copies": "3",
"size": "6556",
"license": "mit",
"hash": 2137268215525706500,
"line_mean": 30.6714975845,
"line_max": 77,
"alpha_frac": 0.5982306284,
"autogenerated": false,
"ratio": 4.4447457627118645,
"confi... |
from django.utils.encoding import python_2_unicode_compatible
from allauth.socialaccount import app_settings
from allauth.account.models import EmailAddress
from ..adapter import get_adapter
class AuthProcess(object):
LOGIN = 'login'
CONNECT = 'connect'
REDIRECT = 'redirect'
class AuthAction(object):
... | {
"repo_name": "nimbis/django-allauth",
"path": "allauth/socialaccount/providers/base.py",
"copies": "3",
"size": "6509",
"license": "mit",
"hash": 6865587223555935000,
"line_mean": 31.0640394089,
"line_max": 77,
"alpha_frac": 0.5971731449,
"autogenerated": false,
"ratio": 4.443003412969284,
"co... |
from django.utils.encoding import python_2_unicode_compatible
from allauth.socialaccount import app_settings
from allauth.account.models import EmailAddress
from ..models import SocialApp, SocialAccount, SocialLogin
from ..adapter import get_adapter
class AuthProcess(object):
LOGIN = 'login'
CONNECT = 'conn... | {
"repo_name": "repetilo-andrey/django-allauth",
"path": "allauth/socialaccount/providers/base.py",
"copies": "4",
"size": "4710",
"license": "mit",
"hash": -5299369965651306000,
"line_mean": 31.2602739726,
"line_max": 77,
"alpha_frac": 0.5921443737,
"autogenerated": false,
"ratio": 4.472934472934... |
from django.utils.encoding import python_2_unicode_compatible
from allauth.socialaccount import app_settings
from allauth.account.models import EmailAddress
from ..models import SocialLogin, get_social_account_model, get_social_app_model
from ..adapter import get_adapter
class AuthProcess(object):
LOGIN = 'logi... | {
"repo_name": "yarbelk/django-allauth",
"path": "allauth/socialaccount/providers/base.py",
"copies": "2",
"size": "6045",
"license": "mit",
"hash": 5111107096099795000,
"line_mean": 32.2142857143,
"line_max": 83,
"alpha_frac": 0.5991728701,
"autogenerated": false,
"ratio": 4.422092172640819,
"c... |
from django.utils.encoding import python_2_unicode_compatible
from allauth.socialaccount import app_settings
from ..models import SocialApp, SocialAccount, SocialLogin
from ..adapter import get_adapter
class AuthProcess(object):
LOGIN = 'login'
CONNECT = 'connect'
class AuthAction(object):
AUTHENTICAT... | {
"repo_name": "grue/django-allauth",
"path": "allauth/socialaccount/providers/base.py",
"copies": "7",
"size": "3930",
"license": "mit",
"hash": -6732446296190680000,
"line_mean": 29.4651162791,
"line_max": 77,
"alpha_frac": 0.6015267176,
"autogenerated": false,
"ratio": 4.361820199778024,
"con... |
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from .settings import (
GALLERY_STYLES, FAQ_STYLES, DIVIDER_SIZES,
CONTAINER_KINDS, LIST_STYLES
)
from cms.models import CMSPlugin
from cms.models.fields import PageField
from djangocms_text_ckeditor.fields import HTML... | {
"repo_name": "logithr/djangocms-widgetbox",
"path": "widgetbox/models.py",
"copies": "1",
"size": "7545",
"license": "mit",
"hash": -1301944911035953400,
"line_mean": 26.4363636364,
"line_max": 90,
"alpha_frac": 0.6461232604,
"autogenerated": false,
"ratio": 3.548918156161806,
"config_test": f... |
from django.utils.encoding import python_2_unicode_compatible
from ..models import models
from ..utils import gisfield_may_be_null
@python_2_unicode_compatible
class NamedModel(models.Model):
name = models.CharField(max_length=30)
objects = models.GeoManager()
class Meta:
abstract = True
... | {
"repo_name": "HonzaKral/django",
"path": "tests/gis_tests/geoapp/models.py",
"copies": "67",
"size": "2308",
"license": "bsd-3-clause",
"hash": 3302440425557153000,
"line_mean": 21.4077669903,
"line_max": 91,
"alpha_frac": 0.6728769497,
"autogenerated": false,
"ratio": 3.740680713128039,
"conf... |
from django.utils.encoding import python_2_unicode_compatible
from ..models import models
class SimpleModel(models.Model):
objects = models.GeoManager()
class Meta:
abstract = True
required_db_features = ['gis_enabled']
@python_2_unicode_compatible
class Location(SimpleModel):
point =... | {
"repo_name": "sergei-maertens/django",
"path": "tests/gis_tests/relatedapp/models.py",
"copies": "34",
"size": "1824",
"license": "bsd-3-clause",
"hash": -2401115012536993000,
"line_mean": 23.9863013699,
"line_max": 88,
"alpha_frac": 0.7088815789,
"autogenerated": false,
"ratio": 3.6848484848484... |
from django.utils.encoding import python_2_unicode_compatible
from ..models import models
@python_2_unicode_compatible
class NamedModel(models.Model):
name = models.CharField(max_length=25)
class Meta:
abstract = True
required_db_features = ['gis_enabled']
def __str__(self):
ret... | {
"repo_name": "blindroot/django",
"path": "tests/gis_tests/layermap/models.py",
"copies": "34",
"size": "2488",
"license": "bsd-3-clause",
"hash": -1534515250186854100,
"line_mean": 23.1553398058,
"line_max": 95,
"alpha_frac": 0.6245980707,
"autogenerated": false,
"ratio": 3.792682926829268,
"c... |
from django.utils.encoding import python_2_unicode_compatible
from ..models import models
@python_2_unicode_compatible
class NamedModel(models.Model):
name = models.CharField(max_length=30)
objects = models.GeoManager()
class Meta:
abstract = True
required_db_features = ['gis_enabled']
... | {
"repo_name": "gitaarik/django",
"path": "tests/gis_tests/geo3d/models.py",
"copies": "18",
"size": "1259",
"license": "bsd-3-clause",
"hash": -4917356340936795000,
"line_mean": 18.671875,
"line_max": 61,
"alpha_frac": 0.7116759333,
"autogenerated": false,
"ratio": 3.421195652173913,
"config_te... |
from django.utils.encoding import python_2_unicode_compatible
from .registry import registry
@python_2_unicode_compatible
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": "Tivix/wagtail",
"path": "wagtail/contrib/settings/context_processors.py",
"copies": "7",
"size": "1557",
"license": "bsd-3-clause",
"hash": 1915251278045676300,
"line_mean": 26.8035714286,
"line_max": 78,
"alpha_frac": 0.6242774566,
"autogenerated": false,
"ratio": 3.99230769230769... |
from django.utils.encoding import python_2_unicode_compatible
from ..models import models
from ..utils import gisfield_may_be_null
@python_2_unicode_compatible
class NamedModel(models.Model):
name = models.CharField(max_length=30)
objects = models.GeoManager()
class Meta:
abstract ... | {
"repo_name": "yephper/django",
"path": "tests/gis_tests/distapp/models.py",
"copies": "1",
"size": "1516",
"license": "bsd-3-clause",
"hash": 4706473293457902000,
"line_mean": 25.5636363636,
"line_max": 71,
"alpha_frac": 0.6978891821,
"autogenerated": false,
"ratio": 3.761786600496278,
"config... |
from django.utils.encoding import smart_str
from datetime import datetime
import settings
from django.db import models
from django.contrib.auth import logout as auth_logout
from django.shortcuts import redirect
import views_base as viewb
import django.contrib.auth.views
from django.core.urlresolvers import reverse
from... | {
"repo_name": "samuelcolvin/HotDjango",
"path": "views.py",
"copies": "1",
"size": "12470",
"license": "mit",
"hash": -6201455640877283000,
"line_mean": 35.147826087,
"line_max": 141,
"alpha_frac": 0.6753809142,
"autogenerated": false,
"ratio": 3.1418493323255228,
"config_test": false,
"has_n... |
from django.utils.encoding import smart_str
from django.conf import settings
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
from mediagenerator.utils import find_file, read_text_file, get_media_dirs
from subprocess import Popen, PIPE
import os
import sys
import re
import posixpath
... | {
"repo_name": "stucchio/Django-Media-Generator",
"path": "mediagenerator/filters/less.py",
"copies": "8",
"size": "7138",
"license": "bsd-3-clause",
"hash": -5823512591152555000,
"line_mean": 35.4183673469,
"line_max": 89,
"alpha_frac": 0.5539366769,
"autogenerated": false,
"ratio": 4.20376914016... |
from django.utils.encoding import smart_str
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
class PostActionMixin(object):
"""
Simple mixin to forward POST request that contain a key 'action'
onto a method of form "do... | {
"repo_name": "michaelBenin/django-oscar",
"path": "oscar/views/generic.py",
"copies": "1",
"size": "3260",
"license": "bsd-3-clause",
"hash": -9010180645357488000,
"line_mean": 36.4712643678,
"line_max": 83,
"alpha_frac": 0.627607362,
"autogenerated": false,
"ratio": 4.174135723431498,
"config... |
from django.utils.encoding import smart_str
from django.core.cache import cache
from django.db.models.base import ModelBase
from django.db import transaction
def _cache_key(cls, id):
if type(cls) == ModelBase:
prefix = cls.__name__
else:
prefix = cls.__class__.__name__
return '%s%s' % (prefix, id)
def _... | {
"repo_name": "jumoconnect/openjumo",
"path": "jumodjango/data/methods.py",
"copies": "1",
"size": "1144",
"license": "mit",
"hash": 5481978343619201000,
"line_mean": 23.3404255319,
"line_max": 78,
"alpha_frac": 0.6171328671,
"autogenerated": false,
"ratio": 3.067024128686327,
"config_test": fa... |
from django.utils.encoding import smart_str
from django.utils.simplejson import dumps
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
from mediagenerator.utils import get_media_url_mapping
_CODE = """
_$MEDIA_URLS = %s;
media_urls = function(key) {
var urls = _$MEDIA_URLS[key];
... | {
"repo_name": "stucchio/Django-Media-Generator",
"path": "mediagenerator/filters/media_url.py",
"copies": "10",
"size": "1369",
"license": "bsd-3-clause",
"hash": -4843638403972205000,
"line_mean": 28.1276595745,
"line_max": 132,
"alpha_frac": 0.638422206,
"autogenerated": false,
"ratio": 3.57441... |
from django.utils.encoding import smart_str
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.conf import settings
from django.contrib.auth.models import (
AbstractBaseUser,
_user_has_perm, _user_get_all_permissions, _user_has_module_perms,
)
from django.db im... | {
"repo_name": "unixhot/opencmdb",
"path": "django_mongoengine/mongo_auth/models.py",
"copies": "1",
"size": "15383",
"license": "apache-2.0",
"hash": -6358570612961403000,
"line_mean": 37.6507537688,
"line_max": 127,
"alpha_frac": 0.6450627316,
"autogenerated": false,
"ratio": 4.359025219608954,
... |
from django.utils.encoding import smart_str
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.contrib.auth.models import _user_has_perm, _user_get_all_permissions, _user_has_module_perms
from django.db import models
from django.contrib.contenttypes.models import Conte... | {
"repo_name": "iandd0824/ri-app",
"path": "web/django_mongoengine/mongo_auth/models.py",
"copies": "1",
"size": "14304",
"license": "apache-2.0",
"hash": -3716469269867691000,
"line_mean": 37.9754768392,
"line_max": 127,
"alpha_frac": 0.6449244966,
"autogenerated": false,
"ratio": 4.3743119266055... |
from django.utils.encoding import smart_str
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
from mediagenerator.utils import find_file
from subprocess import Popen, PIPE
import os
import sys
class CoffeeScript(Filter):
takes_input = False
def __init__(self, **kwargs):
... | {
"repo_name": "umitproject/tease-o-matic",
"path": "mediagenerator/filters/coffeescript.py",
"copies": "1",
"size": "2381",
"license": "bsd-3-clause",
"hash": 4138827437411475500,
"line_mean": 35.0757575758,
"line_max": 80,
"alpha_frac": 0.5825283494,
"autogenerated": false,
"ratio": 4.2067137809... |
from django.utils.encoding import smart_str
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
from mediagenerator.utils import find_file, read_text_file
from subprocess import Popen, PIPE
import os
import sys
class CoffeeScript(Filter):
takes_input = False
def __init__(self, *... | {
"repo_name": "linked/django-mediagenerator",
"path": "mediagenerator/filters/coffeescript.py",
"copies": "9",
"size": "2387",
"license": "bsd-3-clause",
"hash": 657158491831901700,
"line_mean": 36.296875,
"line_max": 80,
"alpha_frac": 0.5902806871,
"autogenerated": false,
"ratio": 4.173076923076... |
from django.utils.encoding import smart_str
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
from mediagenerator.utils import get_media_dirs, read_text_file
from pyjs.translator import import_compiler, Translator, LIBRARY_PATH
from textwrap import dedent
import os
import sys
try:
... | {
"repo_name": "adieu/django-mediagenerator",
"path": "mediagenerator/filters/pyjs_filter.py",
"copies": "10",
"size": "10308",
"license": "bsd-3-clause",
"hash": -1167326646429206500,
"line_mean": 34.9163763066,
"line_max": 97,
"alpha_frac": 0.5552968568,
"autogenerated": false,
"ratio": 3.982998... |
from django.utils.encoding import smart_str
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
class Concat(Filter):
"""
Simply concatenates multiple files into a single file.
This is also the default root filter.
"""
def __init__(self, **kwargs):
self.confi... | {
"repo_name": "umitproject/tease-o-matic",
"path": "mediagenerator/filters/concat.py",
"copies": "10",
"size": "1290",
"license": "bsd-3-clause",
"hash": -8685467476604378000,
"line_mean": 39.3125,
"line_max": 81,
"alpha_frac": 0.6465116279,
"autogenerated": false,
"ratio": 3.7829912023460412,
... |
from django.utils.encoding import smart_str
from json import dumps
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
from mediagenerator.utils import get_media_url_mapping
_CODE = """
_$MEDIA_URLS = %s;
media_urls = function(key) {
var urls = _$MEDIA_URLS[key];
if (!urls)
thro... | {
"repo_name": "Crop-R/django-mediagenerator",
"path": "mediagenerator/filters/media_url.py",
"copies": "2",
"size": "1350",
"license": "bsd-3-clause",
"hash": 8776408000931544000,
"line_mean": 27.7234042553,
"line_max": 132,
"alpha_frac": 0.6348148148,
"autogenerated": false,
"ratio": 3.571428571... |
from django.utils.encoding import smart_str
import pytz
from corehq.const import USER_DATETIME_FORMAT
from corehq.toggles import USE_NEW_TIMEZONE_BEHAVIOR
from corehq.util.dates import safe_strftime
from corehq.util.soft_assert import soft_assert
from corehq.util.view_utils import get_request
def get_timezone_data_mi... | {
"repo_name": "benrudolph/commcare-hq",
"path": "corehq/util/timezones/conversions.py",
"copies": "1",
"size": "5177",
"license": "bsd-3-clause",
"hash": 8935255997943321000,
"line_mean": 30.9567901235,
"line_max": 77,
"alpha_frac": 0.6696928723,
"autogenerated": false,
"ratio": 3.762354651162790... |
from django.utils.encoding import smart_str
import pytz
from corehq.apps.tzmigration.api import phone_timezones_have_been_processed
from corehq.const import USER_DATETIME_FORMAT, SERVER_DATETIME_FORMAT
from corehq.util.soft_assert import soft_assert
from dimagi.utils.dates import safe_strftime
class _HQTime(object)... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/util/timezones/conversions.py",
"copies": "1",
"size": "4554",
"license": "bsd-3-clause",
"hash": -1062759341134152100,
"line_mean": 29.5637583893,
"line_max": 76,
"alpha_frac": 0.6725955204,
"autogenerated": false,
"ratio": 3.6844660194174... |
from django.utils.encoding import smart_str
import pytz
from corehq.apps.tzmigration import phone_timezones_have_been_processed
from corehq.const import USER_DATETIME_FORMAT
from corehq.util.soft_assert import soft_assert
from dimagi.utils.dates import safe_strftime
class _HQTime(object):
_datetime = None
... | {
"repo_name": "puttarajubr/commcare-hq",
"path": "corehq/util/timezones/conversions.py",
"copies": "1",
"size": "4436",
"license": "bsd-3-clause",
"hash": 4788191016684107000,
"line_mean": 29.8055555556,
"line_max": 76,
"alpha_frac": 0.6720018034,
"autogenerated": false,
"ratio": 3.65704863973619... |
from django.utils.encoding import smart_str
from kitsune.products.models import Product
from taggit.models import Tag
from kitsune.questions.models import Question
tags_to_migrate = {
# source tag -> product
'desktop': ['firefox'],
'mobile': ['mobile']
}
def assert_equals(a, b):
assert a == b, '%s !... | {
"repo_name": "philipp-sumo/kitsune",
"path": "migrations/194-questions-product-migration.py",
"copies": "6",
"size": "1350",
"license": "bsd-3-clause",
"hash": -27794226957125056,
"line_mean": 30.3953488372,
"line_max": 75,
"alpha_frac": 0.5762962963,
"autogenerated": false,
"ratio": 3.824362606... |
from django.utils.encoding import smart_str
from kitsune.products.models import Product
from taggit.models import Tag
from kitsune.wiki.models import Document
tags_to_migrate = {
# source tag -> product
'firefox': ['firefox'],
'sync': ['firefox', 'mobile'],
'persona': ['firefox'],
'desktop': ['fir... | {
"repo_name": "safwanrahman/linuxdesh",
"path": "migrations/160-products-migration.py",
"copies": "6",
"size": "1314",
"license": "bsd-3-clause",
"hash": 2823742309252627000,
"line_mean": 27.5652173913,
"line_max": 70,
"alpha_frac": 0.5905631659,
"autogenerated": false,
"ratio": 3.670391061452514... |
from django.utils.encoding import smart_str
from taggit.models import Tag
from kitsune.wiki.models import Document
from migrations.models import Topic
tags_to_migrate = {
# '<source tag>': '<destination tag>',
'sync': 'sync',
'general': 'general',
'recovery-key': 'recovery-key',
'privacy-security'... | {
"repo_name": "dbbhattacharya/kitsune",
"path": "migrations/159-topics-migration.py",
"copies": "6",
"size": "2556",
"license": "bsd-3-clause",
"hash": -1856653424740532200,
"line_mean": 30.5555555556,
"line_max": 77,
"alpha_frac": 0.6025039124,
"autogenerated": false,
"ratio": 3.5898876404494384... |
from django.utils.encoding import smart_str
from waffle.utils import get_setting
class WaffleMiddleware(object):
def process_response(self, request, response):
secure = get_setting('SECURE')
max_age = get_setting('MAX_AGE')
if hasattr(request, 'waffles'):
for k in request.waf... | {
"repo_name": "webus/django-waffle",
"path": "waffle/middleware.py",
"copies": "13",
"size": "1044",
"license": "bsd-3-clause",
"hash": -1756265659747798300,
"line_mean": 36.2857142857,
"line_max": 73,
"alpha_frac": 0.5402298851,
"autogenerated": false,
"ratio": 4.192771084337349,
"config_test"... |
from django.utils.encoding import smart_str
class Menu:
namespace = None
def __init__(self, renderer):
self.renderer = renderer
if not self.namespace:
self.namespace = self.__class__.__name__
def get_nodes(self, request):
"""
should return a list of Navigatio... | {
"repo_name": "divio/django-cms",
"path": "menus/base.py",
"copies": "2",
"size": "1928",
"license": "bsd-3-clause",
"hash": 3958574797272531000,
"line_mean": 25.7777777778,
"line_max": 83,
"alpha_frac": 0.5975103734,
"autogenerated": false,
"ratio": 4.067510548523207,
"config_test": false,
"... |
from django.utils.encoding import smart_str
try:
from django.utils.encoding import force_text as force_unicode
except ImportError:
from django.utils.encoding import force_unicode
try:
from django.utils.encoding import smart_text as smart_unicode
except ImportError:
try:
from django.utils.encodin... | {
"repo_name": "jschrewe/django-mongoadmin",
"path": "mongoadmin/util.py",
"copies": "2",
"size": "3673",
"license": "bsd-3-clause",
"hash": -5889377331130493000,
"line_mean": 34.3173076923,
"line_max": 89,
"alpha_frac": 0.6294582085,
"autogenerated": false,
"ratio": 4.3160987074030555,
"config_... |
from django.utils.encoding import smart_str
from django.utils.simplejson import dumps
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
from mediagenerator.utils import get_media_url_mapping
_CODE = """
_$MEDIA_URLS = %s;
media_urls = function(key) {
var urls = _$MEDIA_URL... | {
"repo_name": "cuongthai/cuongthai-s-blog",
"path": "mediagenerator/filters/media_url.py",
"copies": "2",
"size": "1416",
"license": "bsd-3-clause",
"hash": 7628906350566821000,
"line_mean": 28.1276595745,
"line_max": 132,
"alpha_frac": 0.6172316384,
"autogenerated": false,
"ratio": 3.62148337595... |
from django.utils.encoding import smart_str
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
from mediagenerator.utils import find_file, read_text_file
from subprocess import Popen, PIPE
import os
import sys
class CoffeeScript(Filter):
takes_input = False
def __ini... | {
"repo_name": "cuongthai/cuongthai-s-blog",
"path": "mediagenerator/filters/coffeescript.py",
"copies": "2",
"size": "2451",
"license": "bsd-3-clause",
"hash": -8435464582472424000,
"line_mean": 36.296875,
"line_max": 80,
"alpha_frac": 0.5748674011,
"autogenerated": false,
"ratio": 4.233160621761... |
from django.utils.encoding import smart_str
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
from mediagenerator.utils import get_media_dirs, read_text_file
from pyjs.translator import import_compiler, Translator, LIBRARY_PATH
from textwrap import dedent
import os
import sys
... | {
"repo_name": "cuongthai/cuongthai-s-blog",
"path": "mediagenerator/filters/pyjs_filter.py",
"copies": "1",
"size": "10595",
"license": "bsd-3-clause",
"hash": -5065886897985237000,
"line_mean": 34.9163763066,
"line_max": 97,
"alpha_frac": 0.5402548372,
"autogenerated": false,
"ratio": 4.02087286... |
from django.utils.encoding import smart_str
from hashlib import sha1
from mediagenerator.generators.bundles.base import Filter
class Concat(Filter):
"""
Simply concatenates multiple files into a single file.
This is also the default root filter.
"""
def __init__(self, **kwargs):
... | {
"repo_name": "cuongthai/cuongthai-s-blog",
"path": "mediagenerator/filters/concat.py",
"copies": "2",
"size": "1322",
"license": "bsd-3-clause",
"hash": 3263216465904317400,
"line_mean": 39.3125,
"line_max": 81,
"alpha_frac": 0.6308623298,
"autogenerated": false,
"ratio": 3.8430232558139537,
"... |
from django.utils.encoding import smart_str, smart_unicode
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': ... | {
"repo_name": "tjsavage/rototutor_djangononrel",
"path": "django/contrib/localflavor/it/util.py",
"copies": "436",
"size": "1807",
"license": "bsd-3-clause",
"hash": 1650862721387640600,
"line_mean": 40.0681818182,
"line_max": 79,
"alpha_frac": 0.4543442169,
"autogenerated": false,
"ratio": 2.559... |
from django.utils.encoding import smart_str, smart_unicode
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5,... | {
"repo_name": "bernardokyotoku/skillplant",
"path": "django/contrib/localflavor/it/util.py",
"copies": "13",
"size": "1851",
"license": "bsd-3-clause",
"hash": 5463275498919887000,
"line_mean": 40.0681818182,
"line_max": 79,
"alpha_frac": 0.4435440303,
"autogenerated": false,
"ratio": 2.621813031... |
from django.utils.encoding import smart_text
from django.db.models.fields import BLANK_CHOICE_DASH
class BoundRelatedObject(object):
def __init__(self, related_object, field_mapping, original):
self.relation = related_object
self.field_mappings = field_mapping[related_object.name]
def template... | {
"repo_name": "ProfessionalIT/maxigenios-website",
"path": "sdk/google_appengine/lib/django-1.5/django/db/models/related.py",
"copies": "110",
"size": "3148",
"license": "mit",
"hash": 8680918860104898000,
"line_mean": 44.6231884058,
"line_max": 103,
"alpha_frac": 0.6508894536,
"autogenerated": fal... |
from django.utils.encoding import smart_text
from django import template
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from ..models import Comment
from ..forms import CommentForm
register = template.Library()
# to a large extent, this is taken from the django comments a... | {
"repo_name": "ugoertz/django-familio",
"path": "comments/templatetags/comments_tags.py",
"copies": "1",
"size": "7012",
"license": "bsd-3-clause",
"hash": -1941693820448077600,
"line_mean": 33.3725490196,
"line_max": 79,
"alpha_frac": 0.5879920137,
"autogenerated": false,
"ratio": 4.249696969696... |
from django.utils.encoding import smart_text
from django.utils.translation import ugettext as _
import commonware
import jwt
from rest_framework import exceptions
from rest_framework.authentication import get_authorization_header
from rest_framework_jwt.authentication import (
JSONWebTokenAuthentication as Upstrea... | {
"repo_name": "mstriemer/olympia",
"path": "src/olympia/api/authentication.py",
"copies": "3",
"size": "5853",
"license": "bsd-3-clause",
"hash": 7026308255781708000,
"line_mean": 38.02,
"line_max": 78,
"alpha_frac": 0.6441141295,
"autogenerated": false,
"ratio": 4.619573796369377,
"config_test... |
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy as _
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B... | {
"repo_name": "pixelgremlins/ztruck",
"path": "dj/lib/python2.7/site-packages/localflavor/it/util.py",
"copies": "6",
"size": "2565",
"license": "apache-2.0",
"hash": -3031607368387371000,
"line_mean": 34.625,
"line_max": 79,
"alpha_frac": 0.5157894737,
"autogenerated": false,
"ratio": 2.80327868... |
from django.utils.encoding import smart_text
from ...models import *
from .utils import new, CommonTestCase
class IndividuTestCase(CommonTestCase):
model = Oeuvre
def setUp(self):
self.moliere = new(Individu, nom='Poquelin', prenoms='Jean-Baptiste',
pseudonyme='Molière', de... | {
"repo_name": "dezede/dezede",
"path": "libretto/tests/models/individu.py",
"copies": "1",
"size": "2862",
"license": "bsd-3-clause",
"hash": 8142986011615502000,
"line_mean": 47.2542372881,
"line_max": 78,
"alpha_frac": 0.4966631542,
"autogenerated": false,
"ratio": 3.770860927152318,
"config_... |
from django.utils.encoding import smart_text
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7,
... | {
"repo_name": "Proggie02/TestRepo",
"path": "django/contrib/localflavor/it/util.py",
"copies": "101",
"size": "1791",
"license": "bsd-3-clause",
"hash": 1107658957766885500,
"line_mean": 39.7045454545,
"line_max": 79,
"alpha_frac": 0.4511446119,
"autogenerated": false,
"ratio": 2.551282051282051,... |
from django.utils.encoding import smart_text
import mock
import six
from pyquery import PyQuery as pq
from olympia import amo
from olympia.amo.tests import (
TestCase, addon_factory, collection_factory, user_factory)
from olympia.amo.urlresolvers import reverse
from olympia.legacy_discovery import views
from oly... | {
"repo_name": "aviarypl/mozilla-l10n-addons-server",
"path": "src/olympia/legacy_discovery/tests/test_views.py",
"copies": "1",
"size": "7401",
"license": "bsd-3-clause",
"hash": 8914931035430487000,
"line_mean": 38.3670212766,
"line_max": 79,
"alpha_frac": 0.6142413187,
"autogenerated": false,
"... |
from django.utils.encoding import smart_text
IN_STOCK = 'http://schema.org/InStock'
OUT_OF_STOCK = 'http://schema.org/OutOfStock'
def get_brand_from_attributes(attributes):
if attributes is None:
return
brand = ''
for key in attributes:
if key.name == 'brand':
brand = attribut... | {
"repo_name": "UITools/saleor",
"path": "saleor/seo/schema/product.py",
"copies": "1",
"size": "1816",
"license": "bsd-3-clause",
"hash": -436350955132521540,
"line_mean": 30.8596491228,
"line_max": 107,
"alpha_frac": 0.59030837,
"autogenerated": false,
"ratio": 3.8803418803418803,
"config_test... |
from django.utils.encoding import smart_text
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7,
... | {
"repo_name": "yakky/django-localflavor",
"path": "localflavor/it/util.py",
"copies": "1",
"size": "1792",
"license": "bsd-3-clause",
"hash": 356844953309587600,
"line_mean": 37.9565217391,
"line_max": 79,
"alpha_frac": 0.4508928571,
"autogenerated": false,
"ratio": 2.5527065527065527,
"config_... |
from django.utils.encoding import smart_text, smart_str
from django.forms.forms import pretty_name
from django.db.models.fields import FieldDoesNotExist
from django.utils import formats
from mongoengine import fields
from django_mongoengine.utils import force_text
class RelationWrapper(object):
"""
Wraps a ... | {
"repo_name": "unixhot/opencmdb",
"path": "django_mongoengine/mongo_admin/util.py",
"copies": "2",
"size": "2973",
"license": "apache-2.0",
"hash": -3995102098214074000,
"line_mean": 33.9764705882,
"line_max": 89,
"alpha_frac": 0.6135216953,
"autogenerated": false,
"ratio": 4.175561797752809,
"... |
from django.utils.encoding import smart_unicode, force_unicode
from django.utils.translation import ugettext_lazy as _
from django.utils.text import capfirst
from django.utils import formats
from django.core import validators
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db.models.f... | {
"repo_name": "zbyte64/django-dockit",
"path": "dockit/schema/fields.py",
"copies": "1",
"size": "36078",
"license": "bsd-3-clause",
"hash": 2230605598466064100,
"line_mean": 33.1324503311,
"line_max": 167,
"alpha_frac": 0.5876157215,
"autogenerated": false,
"ratio": 4.274138135292027,
"config_... |
from django.utils.encoding import smart_unicode
from django.contrib.contenttypes.models import ContentType
from django_expando.models import Expando
def expando_filter(model_qs, **kwargs):
""" Filters the query set of the model having expando fields based on the
value of the expando field. See tests in dj... | {
"repo_name": "tuttle/django-expando",
"path": "django_expando/__init__.py",
"copies": "1",
"size": "1246",
"license": "mit",
"hash": -8166921699244797000,
"line_mean": 35.6470588235,
"line_max": 81,
"alpha_frac": 0.6316211878,
"autogenerated": false,
"ratio": 3.798780487804878,
"config_test": ... |
from django.utils.encoding import smart_unicode
from django.db.models.fields import BLANK_CHOICE_DASH
class BoundRelatedObject(object):
def __init__(self, related_object, field_mapping, original):
self.relation = related_object
self.field_mappings = field_mapping[related_object.name]
def templ... | {
"repo_name": "overtherain/scriptfile",
"path": "software/googleAppEngine/lib/django_1_4/django/db/models/related.py",
"copies": "102",
"size": "3162",
"license": "mit",
"hash": -7658857647990779000,
"line_mean": 44.8260869565,
"line_max": 103,
"alpha_frac": 0.6499051233,
"autogenerated": false,
... |
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
from socialregistration.clients import Client
from django.utils.crypto import constant_time_compare, get_random_string
from django.conf import settings
import httplib2
import socket
import logging
import oauth2 as ... | {
"repo_name": "minlex/django-socialregistration",
"path": "socialregistration/clients/oauth.py",
"copies": "1",
"size": "11974",
"license": "mit",
"hash": -3912169849909942000,
"line_mean": 31.6267029973,
"line_max": 110,
"alpha_frac": 0.6050609654,
"autogenerated": false,
"ratio": 4.274901820778... |
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
from socialregistration.clients import Client
import httplib2
import oauth2 as oauth
import urllib
import urlparse
import requests
class OAuthError(Exception):
"""
Exception thrown when we run into OAuth{1,... | {
"repo_name": "Soovox/django-socialregistration",
"path": "socialregistration/clients/oauth.py",
"copies": "1",
"size": "11397",
"license": "mit",
"hash": -8326262002635992000,
"line_mean": 33.328313253,
"line_max": 118,
"alpha_frac": 0.5776958849,
"autogenerated": false,
"ratio": 4.4958579881656... |
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
from socialregistration.clients import Client
from django.conf import settings
import httplib2
import socket
import logging
import oauth2 as oauth
import urllib
import urlparse
logger = logging.getLogger(__name__)... | {
"repo_name": "bopo/django-socialregistration",
"path": "socialregistration/clients/oauth.py",
"copies": "6",
"size": "11813",
"license": "mit",
"hash": -5577283483976430000,
"line_mean": 32.4645892351,
"line_max": 110,
"alpha_frac": 0.5818166427,
"autogenerated": false,
"ratio": 4.43430930930930... |
from django.utils.encoding import smart_unicode
from django.utils.xmlutils import SimplerXMLGenerator
from rest_framework.compat import StringIO
import re
import xml.etree.ElementTree as ET
# From xml2dict
class XML2Dict(object):
def __init__(self):
pass
def _parse_node(self, node):
node_tre... | {
"repo_name": "madflow/seahub",
"path": "thirdpart/rest_framework/utils/__init__.py",
"copies": "6",
"size": "2929",
"license": "apache-2.0",
"hash": -5656534211013127000,
"line_mean": 28.29,
"line_max": 86,
"alpha_frac": 0.554796859,
"autogenerated": false,
"ratio": 3.869220607661823,
"config_... |
from django.utils.encoding import smart_unicode
from htmlentitydefs import name2codepoint
import re
import unicodedata
# From http://www.djangosnippets.org/snippets/369/
def slugify(s, entities=True, decimal=True, hexadecimal=True,
instance=None, slug_field='slug', filter_dict=None):
s = smart_unicode(s)
#... | {
"repo_name": "pocketone/django-shoppy",
"path": "shoppy/util/unique.py",
"copies": "1",
"size": "1508",
"license": "bsd-3-clause",
"hash": 2223295074240189400,
"line_mean": 28.5882352941,
"line_max": 104,
"alpha_frac": 0.5603448276,
"autogenerated": false,
"ratio": 3.7512437810945274,
"config_... |
from django.utils.encoding import smart_unicode
from restlib2.http import codes
from restlib2.params import Parametizer, StrParam, BoolParam
from modeltree.tree import MODELTREE_DEFAULT_ALIAS, trees
from avocado.events import usage
from avocado.query import pipeline
from .base import FieldBase, is_field_orphaned
clas... | {
"repo_name": "chop-dbhi/serrano",
"path": "serrano/resources/field/dist.py",
"copies": "1",
"size": "1919",
"license": "bsd-2-clause",
"hash": 8114082540638482000,
"line_mean": 30.4590163934,
"line_max": 79,
"alpha_frac": 0.6388744138,
"autogenerated": false,
"ratio": 4.341628959276018,
"confi... |
from django.utils.encoding import smart_unicode
import os
try:
from PIL import Image
from PIL import ImageChops
from PIL import ImageOps
from PIL import ImageFilter
from PIL import ImageDraw
except ImportError:
import Image
import ImageChops
import ImageOps
import ImageFilter
im... | {
"repo_name": "team23/django_imagequery",
"path": "imagequery/operations.py",
"copies": "1",
"size": "11780",
"license": "bsd-3-clause",
"hash": 8067884990019141000,
"line_mean": 26.7176470588,
"line_max": 99,
"alpha_frac": 0.5560271647,
"autogenerated": false,
"ratio": 3.572945101607522,
"conf... |
from django.utils.encoding import smart_unicode
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7,
... | {
"repo_name": "azurestandard/django",
"path": "django/contrib/localflavor/it/util.py",
"copies": "9",
"size": "1800",
"license": "bsd-3-clause",
"hash": -7605557846776109000,
"line_mean": 39.9090909091,
"line_max": 79,
"alpha_frac": 0.4538888889,
"autogenerated": false,
"ratio": 2.564102564102564... |
from django.utils.encoding import smart_unicode
from easy_thumbnails.files import get_thumbnailer
from widgetry.views import search, SearchItemWrapper
from links import schema, LinkWrapper
from .models import (
BibliographicRecord, publication_kinds, Researcher, Student, Supervisor
)
from .admin import Rese... | {
"repo_name": "evildmp/arkestra-publications",
"path": "publications/link_schemas.py",
"copies": "1",
"size": "5256",
"license": "bsd-2-clause",
"hash": 2357716577733926000,
"line_mean": 25.9538461538,
"line_max": 75,
"alpha_frac": 0.5840943683,
"autogenerated": false,
"ratio": 4.033768227168074,... |
from django.utils.encoding import smart_unicode
from .models import Publishable
try:
from django.contrib.admin.filters import FieldListFilter, RelatedFieldListFilter
except ImportError:
# only using this code if on before Django 1.4
from django.contrib.admin.filterspecs import FilterSpec, RelatedFilterSp... | {
"repo_name": "johnsensible/django-publish",
"path": "publish/filters.py",
"copies": "1",
"size": "1685",
"license": "bsd-3-clause",
"hash": 3656464320572197400,
"line_mean": 41.125,
"line_max": 119,
"alpha_frac": 0.6955489614,
"autogenerated": false,
"ratio": 3.9277389277389276,
"config_test":... |
from django.utils.encoding import smart_unicode
from django.db.models.fields import BLANK_CHOICE_DASH
class BoundRelatedObject(object):
def __init__(self, related_object, field_mapping, original):
self.relation = related_object
self.field_mappings = field_mapping[related_object.name]
d... | {
"repo_name": "bernardokyotoku/skillplant",
"path": "django/db/models/related.py",
"copies": "3",
"size": "3226",
"license": "bsd-3-clause",
"hash": -1123754392633923700,
"line_mean": 44.7536231884,
"line_max": 103,
"alpha_frac": 0.6354618723,
"autogenerated": false,
"ratio": 4.017434620174346,
... |
from django.utils.encoding import smart_unicode
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
class Chart(object):
# Tracks each time a Chart instance is created. Used to retain order.
creation_counter = 0
name = None
def __init__(se... | {
"repo_name": "evanbrumley/django-report-tools",
"path": "report_tools/charts.py",
"copies": "1",
"size": "2793",
"license": "bsd-2-clause",
"hash": 7987536349492788000,
"line_mean": 25.3823529412,
"line_max": 89,
"alpha_frac": 0.5789473684,
"autogenerated": false,
"ratio": 4.398425196850393,
"... |
from django.utils.encoding import smart_unicode
from fields import currency_field_name
def _expand_money_params(kwargs):
from moneyed import Money
from django.db.models.sql.constants import LOOKUP_SEP, QUERY_TERMS
to_append = {}
for name, value in kwargs.items():
if isinstance(value, ... | {
"repo_name": "pjdelport/django-money",
"path": "djmoney/models/managers.py",
"copies": "1",
"size": "2293",
"license": "bsd-3-clause",
"hash": -1300861095626957800,
"line_mean": 33.828125,
"line_max": 112,
"alpha_frac": 0.6380287833,
"autogenerated": false,
"ratio": 3.815307820299501,
"config_... |
from django.utils.encoding import smart_unicode, smart_str
from django.forms.forms import pretty_name
from django.db.models.fields import FieldDoesNotExist
from django.utils import formats
from mongoengine import fields
from django_mongoengine.utils import force_text
from django_mongoengine.forms.document_options imp... | {
"repo_name": "vetional/django-mongoengine",
"path": "django_mongoengine/mongo_admin/util.py",
"copies": "2",
"size": "3213",
"license": "bsd-3-clause",
"hash": -6773154737732567000,
"line_mean": 35.5113636364,
"line_max": 89,
"alpha_frac": 0.6308745721,
"autogenerated": false,
"ratio": 4.1727272... |
from django.utils.encoding import StrAndUnicode
DEFAULT_TYPE = 'information'
class NotificationMiddleware:
def process_request(self, request):
request.__class__.notifications = Notifications(request.session)
return None
class Notifications:
def __init__(self, session):
self.session = ... | {
"repo_name": "jpartogi/django-commons",
"path": "commons/notifications.py",
"copies": "1",
"size": "3113",
"license": "bsd-3-clause",
"hash": -1364520543580643300,
"line_mean": 33.2197802198,
"line_max": 84,
"alpha_frac": 0.654673948,
"autogenerated": false,
"ratio": 4.65321375186846,
"config_... |
from django.utils.feedgenerator import Atom1Feed
from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
from blog.models import Category
from blog.models import Entry
current_site = Site.objects.get_current()
class EntriesFeed(Feed):
author_name = "Karambir Singh Nain"
... | {
"repo_name": "akarambir/shadow",
"path": "blog/feeds.py",
"copies": "1",
"size": "1637",
"license": "mit",
"hash": -8019323458227080000,
"line_mean": 28.2321428571,
"line_max": 68,
"alpha_frac": 0.6316432498,
"autogenerated": false,
"ratio": 3.605726872246696,
"config_test": false,
"has_no_k... |
from django.utils.feedgenerator import Atom1Feed
from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
from .models import Category
from .models import Entry
current_site = Site.objects.get_current()
class EntriesFeed(Feed):
author_name = "James Bennett"
copyright ... | {
"repo_name": "ubernostrum/blog",
"path": "blog/feeds.py",
"copies": "1",
"size": "2151",
"license": "bsd-3-clause",
"hash": -960621932974198100,
"line_mean": 26.9350649351,
"line_max": 78,
"alpha_frac": 0.619711762,
"autogenerated": false,
"ratio": 3.6706484641638224,
"config_test": false,
"... |
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed, \
RssUserland091Feed
from django.contrib.syndication.feeds import Feed, FeedDoesNotExist,\
ObjectDoesNotExist
from models import Article
class LatestArticles(Feed):
title = ""
author_link = ''
copyright = ''
author_name = ''
... | {
"repo_name": "LimpidTech/django-edict",
"path": "edict/feeds.py",
"copies": "1",
"size": "1331",
"license": "mit",
"hash": -2817698441396660700,
"line_mean": 24.5961538462,
"line_max": 82,
"alpha_frac": 0.667918858,
"autogenerated": false,
"ratio": 3.6168478260869565,
"config_test": true,
"h... |
from django.utils.formats import date_format
from django.http import HttpResponse
from django.conf import settings
from .stream_archives import StreamableZip, StreamableTar
class ArchiveException(Exception):
"Archive exceptions"
def create_archive_from_assignmentgroups(assignmentgroups, file_name, archive_typ... | {
"repo_name": "devilry/devilry-django",
"path": "devilry/utils/delivery_collection.py",
"copies": "1",
"size": "8118",
"license": "bsd-3-clause",
"hash": -713988389399416200,
"line_mean": 40,
"line_max": 88,
"alpha_frac": 0.5989159892,
"autogenerated": false,
"ratio": 4.279388508170796,
"config... |
from django.utils.formats import date_format
from django.http import HttpResponse
from django.conf import settings
from stream_archives import StreamableZip, StreamableTar
class ArchiveException(Exception):
"Archive exceptions"
def create_archive_from_assignmentgroups(assignmentgroups, file_name, archive_type... | {
"repo_name": "vegarang/devilry-django",
"path": "devilry/utils/delivery_collection.py",
"copies": "1",
"size": "8117",
"license": "bsd-3-clause",
"hash": 2837784264226368500,
"line_mean": 39.9949494949,
"line_max": 88,
"alpha_frac": 0.5987433781,
"autogenerated": false,
"ratio": 4.28111814345991... |
from django.utils.functional import cached_property, lazy
from wagtail.core.blocks import ChooserBlock
from wagtail.core.utils import resolve_model_string
from . import registry
from .widgets import AdminModelChooser
class ModelChooserBlock(ChooserBlock):
def __init__(self, target_model, filter_name=None, **kwar... | {
"repo_name": "takeflight/wagtailmodelchooser",
"path": "wagtailmodelchooser/blocks.py",
"copies": "1",
"size": "1453",
"license": "bsd-2-clause",
"hash": 7373312633713007000,
"line_mean": 31.2888888889,
"line_max": 74,
"alpha_frac": 0.6517549897,
"autogenerated": false,
"ratio": 4.24853801169590... |
from django.utils.functional import cached_property
from django.db import IntegrityError, transaction, models
from django.db.models.loading import get_model
from django_town.rest.serializers import default_model_serializer
from django_town.rest.exceptions import RestNotFound, RestBadRequest, RestAlreadyExists
from dja... | {
"repo_name": "uptown/django-town",
"path": "django_town/rest/resources/model_resource.py",
"copies": "1",
"size": "6976",
"license": "mit",
"hash": -8886894094023752000,
"line_mean": 36.7135135135,
"line_max": 117,
"alpha_frac": 0.5768348624,
"autogenerated": false,
"ratio": 4.468930172966047,
... |
from django.utils.functional import cached_property
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor, \
create_reverse_many_to_one_manager
def create_reverse_cdms_many_to_one_manager(superclass, rel):
subclass = create_re... | {
"repo_name": "UKTradeInvestment/crm-poc",
"path": "crm-poc/apps/migrator/fields.py",
"copies": "1",
"size": "2317",
"license": "bsd-3-clause",
"hash": -8372121172145308000,
"line_mean": 32.1,
"line_max": 102,
"alpha_frac": 0.6193353474,
"autogenerated": false,
"ratio": 4.212727272727273,
"conf... |
from django.utils.functional import cached_property
from django.db.models import Count
class ListingPageViewMixin(object):
@cached_property
def similar_params(self):
params = {}
params['category'] = self.get_parent().slug
params['city'] = self.city.slug
params['bedrooms'] = sel... | {
"repo_name": "caioariede/openimob",
"path": "listing/mixins.py",
"copies": "1",
"size": "3050",
"license": "bsd-3-clause",
"hash": -5648846421807269000,
"line_mean": 28.3269230769,
"line_max": 70,
"alpha_frac": 0.5547540984,
"autogenerated": false,
"ratio": 3.8903061224489797,
"config_test": f... |
from django.utils.functional import cached_property
from django.http import Http404
from chamber.shortcuts import get_object_or_404
from is_core.patterns import reverse_pattern
from .exceptions import GenericViewException
class ListParentMixin:
def list_bread_crumbs_menu_item(self):
from is_core.menu ... | {
"repo_name": "matllubos/django-is-core",
"path": "is_core/generic_views/mixins.py",
"copies": "1",
"size": "5963",
"license": "bsd-3-clause",
"hash": -3159000590683179000,
"line_mean": 35.5828220859,
"line_max": 117,
"alpha_frac": 0.6250209626,
"autogenerated": false,
"ratio": 3.6785934608266504... |
from django.utils.functional import cached_property
from django.shortcuts import get_object_or_404, get_list_or_404
from .. import forms
from ..stats import RosterStats
from .base import SimplePickerViewBase, PickerViewBase, SimpleFormMixin
from ..models import Preference, PickerGrouping, GameSetPicks
class Home(Sim... | {
"repo_name": "dakrauth/picker",
"path": "picker/views/picks.py",
"copies": "1",
"size": "5867",
"license": "mit",
"hash": 6324913746225505000,
"line_mean": 28.4824120603,
"line_max": 91,
"alpha_frac": 0.6127492756,
"autogenerated": false,
"ratio": 3.678369905956113,
"config_test": false,
"ha... |
from django.utils.functional import cached_property
from django.utils.html import escape
from wagtail.core.models import Page
from wagtail.core.rich_text import features as feature_registry
from wagtail.core.rich_text.rewriters import EmbedRewriter, LinkRewriter, MultiRuleRewriter
from wagtail.core.whitelist import Wh... | {
"repo_name": "wagtail/wagtail",
"path": "wagtail/admin/rich_text/converters/editor_html.py",
"copies": "7",
"size": "6380",
"license": "bsd-3-clause",
"hash": 3345996623950275600,
"line_mean": 34.6424581006,
"line_max": 95,
"alpha_frac": 0.6246081505,
"autogenerated": false,
"ratio": 4.156351791... |
from django.utils.functional import cached_property
from django.views.generic.base import ContextMixin, TemplateView
from django_docutils.lib.publisher import (
publish_doctree,
publish_html_from_doctree,
publish_toc_from_doctree,
)
from .text import smart_title
class TitleMixin(ContextMixin):
title... | {
"repo_name": "tony/django-docutils",
"path": "django_docutils/lib/views.py",
"copies": "1",
"size": "2871",
"license": "mit",
"hash": -329385386983211200,
"line_mean": 25.3394495413,
"line_max": 83,
"alpha_frac": 0.6259143156,
"autogenerated": false,
"ratio": 3.916780354706685,
"config_test": ... |
from django.utils.functional import cached_property
from django.views.generic import TemplateView
from bedrock.utils import expand_locale_groups
from lib.l10n_utils import LangFilesMixin, get_locale
class VariationMixin:
template_name_variations = None
template_context_variations = None
variation_locales... | {
"repo_name": "craigcook/bedrock",
"path": "bedrock/utils/views.py",
"copies": "9",
"size": "1690",
"license": "mpl-2.0",
"hash": 13134809441218244,
"line_mean": 34.2083333333,
"line_max": 74,
"alpha_frac": 0.650295858,
"autogenerated": false,
"ratio": 4.101941747572815,
"config_test": false,
... |
from django.utils.functional import cached_property
from mptt.utils import get_cached_trees
class ProjectWrapper(object):
def __init__(self, project, snapshot=None):
self._project = project
self._snapshot = snapshot
def __str__(self):
return str(self._project.title)
@property
... | {
"repo_name": "rdmorganiser/rdmo",
"path": "rdmo/views/utils.py",
"copies": "1",
"size": "1481",
"license": "apache-2.0",
"hash": 8177892325348858000,
"line_mean": 25.4464285714,
"line_max": 111,
"alpha_frac": 0.6401080351,
"autogenerated": false,
"ratio": 4.255747126436781,
"config_test": fals... |
from django.utils.functional import cached_property
from shapely import prepared
from shapely.geometry import box
from c3nav.mapdata.models import Level
from c3nav.mapdata.render.engines.base import FillAttribs, StrokeAttribs
from c3nav.mapdata.render.geometry import hybrid_union
from c3nav.mapdata.render.renderdata i... | {
"repo_name": "c3nav/c3nav",
"path": "src/c3nav/mapdata/render/renderer.py",
"copies": "1",
"size": "8598",
"license": "apache-2.0",
"hash": -2464792236170147300,
"line_mean": 51.7239263804,
"line_max": 119,
"alpha_frac": 0.5617872935,
"autogenerated": false,
"ratio": 4.23767258382643,
"config_... |
from django.utils.functional import cached_property
from wagtail.core.blocks import ChooserBlock
from wagtail.core.utils import resolve_model_string
class NewsChooserBlock(ChooserBlock):
"""
A StreamField block for editors to pick a news item.
Takes the news item class as its only argument.
For exampl... | {
"repo_name": "takeflight/wagtailnews",
"path": "wagtailnews/blocks.py",
"copies": "1",
"size": "1186",
"license": "bsd-2-clause",
"hash": -5206769319860922000,
"line_mean": 29.4102564103,
"line_max": 72,
"alpha_frac": 0.6433389545,
"autogenerated": false,
"ratio": 4.376383763837638,
"config_te... |
from django.utils.functional import cached_property
from functools import lru_cache
def _get_translation_field_names():
"""
Returns Translation base model field names (excepted "id" field).
"""
from .models import Translation
fields = [f.name for f in Translation._meta.get_fields()]
fields.r... | {
"repo_name": "ulule/django-linguist",
"path": "linguist/cache.py",
"copies": "1",
"size": "2226",
"license": "mit",
"hash": -5446062953784888000,
"line_mean": 25.8192771084,
"line_max": 90,
"alpha_frac": 0.5745732255,
"autogenerated": false,
"ratio": 4.192090395480226,
"config_test": false,
... |
from django.utils.functional import cached_property
from . import factories
from .. import models
class UserFixture(object):
@cached_property
def staff(self):
return factories.UserFactory(is_staff=True)
@cached_property
def user(self):
return factories.UserFactory()
@cached_pro... | {
"repo_name": "opennode/nodeconductor",
"path": "waldur_core/structure/tests/fixtures.py",
"copies": "1",
"size": "2465",
"license": "mit",
"hash": -6134978587335983000,
"line_mean": 26.3888888889,
"line_max": 99,
"alpha_frac": 0.7070993915,
"autogenerated": false,
"ratio": 4.3861209964412815,
... |
from django.utils.functional import cached_property
from .. import models
from . import factories
class UserFixture:
@cached_property
def staff(self):
return factories.UserFactory(is_staff=True)
@cached_property
def user(self):
return factories.UserFactory()
@cached_property
... | {
"repo_name": "opennode/nodeconductor-assembly-waldur",
"path": "src/waldur_core/structure/tests/fixtures.py",
"copies": "1",
"size": "2550",
"license": "mit",
"hash": -3591162783973738000,
"line_mean": 25.5625,
"line_max": 71,
"alpha_frac": 0.6764705882,
"autogenerated": false,
"ratio": 4.489436... |
from django.utils.functional import cached_property
from . import (
get_default_pdf_model_cleaner_class,
get_default_pdf_renderer_class,
)
class AbstractModelToPDFHandler(object):
pdf_model_cleaner_class = get_default_pdf_model_cleaner_class()
pdf_renderer_class = get_default_pdf_renderer_class()
... | {
"repo_name": "tm-kn/django-pdf-model",
"path": "django_pdf/handlers.py",
"copies": "1",
"size": "2633",
"license": "bsd-2-clause",
"hash": -5377858606840658000,
"line_mean": 25.8673469388,
"line_max": 79,
"alpha_frac": 0.6259020129,
"autogenerated": false,
"ratio": 3.923994038748137,
"config_t... |
from django.utils.functional import cached_property
from mymoney.apps.banktransactions.models import BankTransaction
from .forms import RatioForm
class SessionViewMixin(object):
"""
Mixin to store session data for a given key.
"""
_session_key = None
@property
def session_data(self):
... | {
"repo_name": "ychab/mymoney",
"path": "mymoney/apps/banktransactionanalytics/mixins.py",
"copies": "1",
"size": "2062",
"license": "bsd-3-clause",
"hash": -1391966365160219600,
"line_mean": 25.1012658228,
"line_max": 69,
"alpha_frac": 0.6343355965,
"autogenerated": false,
"ratio": 4.02734375,
... |
from django.utils.functional import cached_property
from redis.exceptions import ConnectionError, ResponseError
from experiments.redis_client import get_redis_client
COUNTER_CACHE_KEY = 'experiments:participants:%s'
COUNTER_FREQ_CACHE_KEY = 'experiments:freq:%s'
class Counters(object):
@cached_property
d... | {
"repo_name": "mixcloud/django-experiments",
"path": "experiments/counters.py",
"copies": "1",
"size": "4669",
"license": "mit",
"hash": -4661352378198181000,
"line_mean": 37.9083333333,
"line_max": 116,
"alpha_frac": 0.5952023988,
"autogenerated": false,
"ratio": 4.260036496350365,
"config_tes... |
from django.utils.functional import cached_property
from .settings import api_token_auth_settings
class UserAuthorization(object):
def __init__(self, user, api_token_payload, settings=None):
"""
Initialize authorization info from user and API Token payload.
"""
self.user = user
... | {
"repo_name": "City-of-Helsinki/django-helusers",
"path": "helusers/authz.py",
"copies": "1",
"size": "1663",
"license": "bsd-2-clause",
"hash": -2166002872184041000,
"line_mean": 30.3773584906,
"line_max": 74,
"alpha_frac": 0.6127480457,
"autogenerated": false,
"ratio": 4.046228710462287,
"con... |
from django.utils.functional import cached_property
from share.provider import ProviderAppConfig
from .harvester import PMCHarvester
class AppConfig(ProviderAppConfig):
name = 'providers.gov.pubmedcentral.pmc'
version = '0.0.1'
title = 'pmc-metadata'
long_title = 'PubMed Central: PMC Metadata'
ho... | {
"repo_name": "zamattiac/SHARE",
"path": "providers/gov/pubmedcentral/pmc/apps.py",
"copies": "1",
"size": "1052",
"license": "apache-2.0",
"hash": 1258767314343081700,
"line_mean": 35.275862069,
"line_max": 73,
"alpha_frac": 0.6520912548,
"autogenerated": false,
"ratio": 2.914127423822715,
"co... |
from django.utils.functional import cached_property
from .tagged import Tagged, TaggedLocale
class TagTool(Tagged):
"""This wraps ``Tag`` model kwargs providing an API for
efficient retrieval of related information, eg tagged ``Resources``,
``Locales`` and ``Projects``, and methods for managing linked
... | {
"repo_name": "mathjazz/pontoon",
"path": "pontoon/tags/utils/tag.py",
"copies": "2",
"size": "3177",
"license": "bsd-3-clause",
"hash": -5663220964213944000,
"line_mean": 35.5172413793,
"line_max": 85,
"alpha_frac": 0.6298394712,
"autogenerated": false,
"ratio": 4.304878048780488,
"config_test... |
from django.utils.functional import cached_property
from waldur_core.structure import models as structure_models
from waldur_core.structure.tests import factories as structure_factories
from waldur_core.structure.tests.fixtures import ProjectFixture
from waldur_openstack.openstack import apps as openstack_apps
from wa... | {
"repo_name": "opennode/nodeconductor-assembly-waldur",
"path": "src/waldur_mastermind/packages/tests/fixtures.py",
"copies": "1",
"size": "2655",
"license": "mit",
"hash": 3771402898477460000,
"line_mean": 38.0441176471,
"line_max": 85,
"alpha_frac": 0.686252354,
"autogenerated": false,
"ratio":... |
from django.utils.functional import cached_property
from waldur_core.structure import models as structure_models
from waldur_core.structure.tests import factories as structure_factories
from waldur_mastermind.marketplace.tests import factories as marketplace_factories
from waldur_mastermind.marketplace.tests import fi... | {
"repo_name": "opennode/waldur-mastermind",
"path": "src/waldur_mastermind/booking/tests/fixtures.py",
"copies": "1",
"size": "1118",
"license": "mit",
"hash": 1719518950294815500,
"line_mean": 33.9375,
"line_max": 82,
"alpha_frac": 0.7200357782,
"autogenerated": false,
"ratio": 4.203007518796992... |
from django.utils.functional import cached_property
from waldur_core.structure import models
from . import factories
class UserFixture:
@cached_property
def staff(self):
return factories.UserFactory(is_staff=True)
@cached_property
def user(self):
return factories.UserFactory()
... | {
"repo_name": "opennode/waldur-mastermind",
"path": "src/waldur_core/structure/tests/fixtures.py",
"copies": "1",
"size": "2266",
"license": "mit",
"hash": 3521472413459236400,
"line_mean": 25.6588235294,
"line_max": 72,
"alpha_frac": 0.685348632,
"autogenerated": false,
"ratio": 4.46942800788954... |
from django.utils.functional import cached_property
from waldur_core.structure.tests.fixtures import ProjectFixture
from waldur_openstack.openstack.tests import fixtures as openstack_fixtures
from waldur_openstack.openstack_tenant import models
from waldur_openstack.openstack_tenant.tests import factories
class Open... | {
"repo_name": "opennode/waldur-mastermind",
"path": "src/waldur_openstack/openstack_tenant/tests/fixtures.py",
"copies": "1",
"size": "4257",
"license": "mit",
"hash": -5483825545466580000,
"line_mean": 33.6097560976,
"line_max": 101,
"alpha_frac": 0.6622034296,
"autogenerated": false,
"ratio": 4... |
from django.utils.functional import cached_property
from waldur_core.structure.tests.fixtures import ProjectFixture
from waldur_openstack.openstack.tests import fixtures as openstack_fixtures
from . import factories
from .. import models
class OpenStackTenantFixture(ProjectFixture):
@cached_property
def op... | {
"repo_name": "opennode/nodeconductor-openstack",
"path": "src/waldur_openstack/openstack_tenant/tests/fixtures.py",
"copies": "1",
"size": "3673",
"license": "mit",
"hash": -3334225450326212000,
"line_mean": 32.0900900901,
"line_max": 109,
"alpha_frac": 0.6583174517,
"autogenerated": false,
"rat... |
from django.utils.functional import cached_property
from waldur_core.structure.tests.fixtures import ProjectFixture
from . import factories
from .. import models
class OpenStackFixture(ProjectFixture):
@cached_property
def openstack_service_settings(self):
return factories.OpenStackServiceSettingsFa... | {
"repo_name": "opennode/nodeconductor-openstack",
"path": "src/waldur_openstack/openstack/tests/fixtures.py",
"copies": "1",
"size": "1825",
"license": "mit",
"hash": -8824645363380016000,
"line_mean": 32.7962962963,
"line_max": 80,
"alpha_frac": 0.6504109589,
"autogenerated": false,
"ratio": 4.7... |
from django.utils.functional import cached_property
from waldur_core.structure.tests.fixtures import ProjectFixture
from . import factories
class AzureFixture(ProjectFixture):
@cached_property
def settings(self):
return factories.AzureServiceSettingsFactory(customer=self.customer)
@cached_prope... | {
"repo_name": "opennode/waldur-mastermind",
"path": "src/waldur_azure/tests/fixtures.py",
"copies": "1",
"size": "2454",
"license": "mit",
"hash": 1664611408788773000,
"line_mean": 27.8705882353,
"line_max": 85,
"alpha_frac": 0.6369193154,
"autogenerated": false,
"ratio": 4.6041275797373356,
"c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.