code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
"""
Cached, database-backed sessions.
"""
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DBStore
from django.core.cache import cache
KEY_PREFIX = "django.contrib.sessions.cached_db"
class SessionStore(DBStore):
"""
Implements cached, database backed sessions... | [
[
8,
0,
0.0333,
0.05,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0167,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1,
0.0167,
0,
0.66,
0.... | [
"\"\"\"\nCached, database-backed sessions.\n\"\"\"",
"from django.conf import settings",
"from django.contrib.sessions.backends.db import SessionStore as DBStore",
"from django.core.cache import cache",
"KEY_PREFIX = \"django.contrib.sessions.cached_db\"",
"class SessionStore(DBStore):\n \"\"\"\n Im... |
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import cache
KEY_PREFIX = "django.contrib.sessions.cache"
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
def __init__(self, session_key=None):
self._cache = cache
s... | [
[
1,
0,
0.0152,
0.0152,
0,
0.66,
0,
907,
0,
2,
0,
0,
907,
0,
0
],
[
1,
0,
0.0303,
0.0152,
0,
0.66,
0.3333,
734,
0,
1,
0,
0,
734,
0,
0
],
[
14,
0,
0.0606,
0.0152,
0,
... | [
"from django.contrib.sessions.backends.base import SessionBase, CreateError",
"from django.core.cache import cache",
"KEY_PREFIX = \"django.contrib.sessions.cache\"",
"class SessionStore(SessionBase):\n \"\"\"\n A cache-based session store.\n \"\"\"\n def __init__(self, session_key=None):\n ... |
from __future__ import with_statement
import datetime
import new
from django.template import Template, Context, defaultfilters
from django.test import TestCase
from django.utils import translation, tzinfo
from django.utils.translation import ugettext as _
from django.utils.html import escape
from django.utils.timezon... | [
[
1,
0,
0.005,
0.005,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0149,
0.005,
0,
0.66,
0.1111,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0198,
0.005,
0,
0.66... | [
"from __future__ import with_statement",
"import datetime",
"import new",
"from django.template import Template, Context, defaultfilters",
"from django.test import TestCase",
"from django.utils import translation, tzinfo",
"from django.utils.translation import ugettext as _",
"from django.utils.html i... |
import re
from datetime import date, datetime, timedelta
from django import template
from django.conf import settings
from django.template import defaultfilters
from django.utils.encoding import force_unicode
from django.utils.formats import number_format
from django.utils.translation import pgettext, ungettext, ugett... | [
[
1,
0,
0.0045,
0.0045,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0089,
0.0045,
0,
0.66,
0.0625,
426,
0,
3,
0,
0,
426,
0,
0
],
[
1,
0,
0.0179,
0.0045,
0,
... | [
"import re",
"from datetime import date, datetime, timedelta",
"from django import template",
"from django.conf import settings",
"from django.template import defaultfilters",
"from django.utils.encoding import force_unicode",
"from django.utils.formats import number_format",
"from django.utils.transl... |
# Empty models.py to allow for specifying databrowse as a test label.
| [] | [] |
from django.contrib import databrowse
from django.db import models
from django.test import TestCase
class SomeModel(models.Model):
some_field = models.CharField(max_length=50)
def __unicode__(self):
return self.some_field
class SomeOtherModel(models.Model):
some_other_field = models.CharField(m... | [
[
1,
0,
0.0172,
0.0172,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.0345,
0.0172,
0,
0.66,
0.1667,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0517,
0.0172,
0,
0.... | [
"from django.contrib import databrowse",
"from django.db import models",
"from django.test import TestCase",
"class SomeModel(models.Model):\n some_field = models.CharField(max_length=50)\n\n def __unicode__(self):\n return self.some_field",
" some_field = models.CharField(max_length=50)",
... |
from django.conf.urls import patterns
from django.contrib.databrowse import views
# Note: The views in this URLconf all require a 'models' argument,
# which is a list of model classes (*not* instances).
urlpatterns = patterns('',
#(r'^$', views.homepage),
#(r'^([^/]+)/([^/]+)/$', views.model_detail),
(r'... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
528,
0,
1,
0,
0,
528,
0,
0
],
[
1,
0,
0.1,
0.05,
0,
0.66,
0.5,
706,
0,
1,
0,
0,
706,
0,
0
],
[
14,
0,
0.675,
0.7,
0,
0.66,
1,
... | [
"from django.conf.urls import patterns",
"from django.contrib.databrowse import views",
"urlpatterns = patterns('',\n #(r'^$', views.homepage),\n #(r'^([^/]+)/([^/]+)/$', views.model_detail),\n\n (r'^([^/]+)/([^/]+)/fields/(\\w+)/$', views.choice_list),\n (r'^([^/]+)/([^/]+)/fields/(\\w+)/(.*)/$', v... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import force_unicode
from dja... | [
[
1,
0,
0.0069,
0.0069,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0139,
0.0069,
0,
0.66,
0.0667,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0208,
0.0069,
0,
0.... | [
"from django import http",
"from django.db import models",
"from django.contrib.databrowse.datastructures import EasyModel",
"from django.contrib.databrowse.sites import DatabrowsePlugin",
"from django.shortcuts import render_to_response",
"from django.utils.text import capfirst",
"from django.utils.enc... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import smart_str, force_unico... | [
[
1,
0,
0.0135,
0.0135,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.027,
0.0135,
0,
0.66,
0.1111,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0405,
0.0135,
0,
0.6... | [
"from django import http",
"from django.db import models",
"from django.contrib.databrowse.datastructures import EasyModel",
"from django.contrib.databrowse.sites import DatabrowsePlugin",
"from django.shortcuts import render_to_response",
"from django.utils.text import capfirst",
"from django.utils.enc... |
from django import http
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
import urlparse
class ObjectDetailPlugin(DatabrowsePlugin):
def model_view(self, request, model_databrowse, url):
... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0.2,
235,
0,
1,
0,
0,
235,
0,
0
],
[
1,
0,
0.2143,
0.0714,
0,
0.6... | [
"from django import http",
"from django.contrib.databrowse.datastructures import EasyModel",
"from django.contrib.databrowse.sites import DatabrowsePlugin",
"from django.shortcuts import render_to_response",
"import urlparse",
"class ObjectDetailPlugin(DatabrowsePlugin):\n def model_view(self, request,... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.shortcuts import render_to_response
from django.utils.safestring import mark_safe
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
class DatabrowsePlugi... | [
[
1,
0,
0.0069,
0.0069,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0138,
0.0069,
0,
0.66,
0.0714,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0207,
0.0069,
0,
0.... | [
"from django import http",
"from django.db import models",
"from django.contrib.databrowse.datastructures import EasyModel",
"from django.shortcuts import render_to_response",
"from django.utils.safestring import mark_safe",
"class AlreadyRegistered(Exception):\n pass",
"class NotRegistered(Exception... |
from django.http import Http404
from django.shortcuts import render_to_response
###########
# CHOICES #
###########
def choice_list(request, app_label, module_name, field_name, models):
m, f = lookup_field(app_label, module_name, field_name, models)
return render_to_response('databrowse/choice_list.html', {'m... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.1053,
0.0526,
0,
0.66,
0.3333,
852,
0,
1,
0,
0,
852,
0,
0
],
[
2,
0,
0.4737,
0.1579,
0,
... | [
"from django.http import Http404",
"from django.shortcuts import render_to_response",
"def choice_list(request, app_label, module_name, field_name, models):\n m, f = lookup_field(app_label, module_name, field_name, models)\n return render_to_response('databrowse/choice_list.html', {'model': m, 'field': f}... |
import warnings
from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site
warnings.warn("The Databrowse contrib app is deprecated",
PendingDeprecationWarning)
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0.5,
231,
0,
4,
0,
0,
231,
0,
0
],
[
8,
0,
0.9167,
0.3333,
0,
0.6... | [
"import warnings",
"from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site",
"warnings.warn(\"The Databrowse contrib app is deprecated\",\n PendingDeprecationWarning)"
] |
"""
These classes are light wrappers around Django's database API that provide
convenience functionality and permalink functions for the databrowse app.
"""
from django.db import models
from django.utils import formats
from django.utils.text import capfirst
from django.utils.encoding import smart_unicode, smart_str, i... | [
[
8,
0,
0.0115,
0.0184,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0276,
0.0046,
0,
0.66,
0.0714,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0323,
0.0046,
0,
0.66,
... | [
"\"\"\"\nThese classes are light wrappers around Django's database API that provide\nconvenience functionality and permalink functions for the databrowse app.\n\"\"\"",
"from django.db import models",
"from django.utils import formats",
"from django.utils.text import capfirst",
"from django.utils.encoding i... |
# -*- coding: utf-8 -*-
import unittest
from django.contrib.webdesign.lorem_ipsum import *
from django.template import loader, Context
class WebdesignTest(unittest.TestCase):
def test_words(self):
self.assertEqual(words(7), u'lorem ipsum dolor sit amet consectetur adipisicing')
def test_paragraphs... | [
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.2381,
0.0476,
0,
0.66,
0.3333,
74,
0,
1,
0,
0,
74,
0,
0
],
[
1,
0,
0.2857,
0.0476,
0,
0.66... | [
"import unittest",
"from django.contrib.webdesign.lorem_ipsum import *",
"from django.template import loader, Context",
"class WebdesignTest(unittest.TestCase):\n\n def test_words(self):\n self.assertEqual(words(7), u'lorem ipsum dolor sit amet consectetur adipisicing')\n\n def test_paragraphs(se... |
"""
Utility functions for generating "lorem ipsum" Latin text.
"""
import random
COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo con... | [
[
8,
0,
0.0198,
0.0297,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0495,
0.0099,
0,
0.66,
0.125,
715,
0,
1,
0,
0,
715,
0,
0
],
[
14,
0,
0.0693,
0.0099,
0,
0.66... | [
"\"\"\"\nUtility functions for generating \"lorem ipsum\" Latin text.\n\"\"\"",
"import random",
"COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut al... |
from django.contrib.webdesign.lorem_ipsum import words, paragraphs
from django import template
register = template.Library()
class LoremNode(template.Node):
def __init__(self, count, method, common):
self.count, self.method, self.common = count, method, common
def render(self, context):
try:
... | [
[
1,
0,
0.0152,
0.0152,
0,
0.66,
0,
74,
0,
2,
0,
0,
74,
0,
0
],
[
1,
0,
0.0303,
0.0152,
0,
0.66,
0.25,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.0606,
0.0152,
0,
0.6... | [
"from django.contrib.webdesign.lorem_ipsum import words, paragraphs",
"from django import template",
"register = template.Library()",
"class LoremNode(template.Node):\n def __init__(self, count, method, common):\n self.count, self.method, self.common = count, method, common\n\n def render(self, c... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode, force_unicode
class ContentTypeManager(models.Manager):
# Cache to avoid re-looking up ContentType objects all over the place.
# This cache is shared by all the get_for_* metho... | [
[
1,
0,
0.0059,
0.0059,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0118,
0.0059,
0,
0.66,
0.25,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0178,
0.0059,
0,
0.66... | [
"from django.db import models",
"from django.utils.translation import ugettext_lazy as _",
"from django.utils.encoding import smart_unicode, force_unicode",
"class ContentTypeManager(models.Manager):\n\n # Cache to avoid re-looking up ContentType objects all over the place.\n # This cache is shared by a... |
from __future__ import with_statement
import urllib
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.views import shortcut
from django.contrib.sites.models import Site
from django.http import HttpRequest, Http404
from django.test import TestCase
... | [
[
1,
0,
0.0054,
0.0054,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0161,
0.0054,
0,
0.66,
0.0833,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0269,
0.0054,
0,
... | [
"from __future__ import with_statement",
"import urllib",
"from django.db import models",
"from django.contrib.contenttypes.models import ContentType",
"from django.contrib.contenttypes.views import shortcut",
"from django.contrib.sites.models import Site",
"from django.http import HttpRequest, Http404"... |
"""
Classes allowing "generic" relations through ContentType and object-id fields.
"""
from collections import defaultdict
from functools import partial
from operator import attrgetter
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import signals
from djan... | [
[
8,
0,
0.004,
0.006,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.01,
0.002,
0,
0.66,
0.0417,
193,
0,
1,
0,
0,
193,
0,
0
],
[
1,
0,
0.012,
0.002,
0,
0.66,
0... | [
"\"\"\"\nClasses allowing \"generic\" relations through ContentType and object-id fields.\n\"\"\"",
"from collections import defaultdict",
"from functools import partial",
"from operator import attrgetter",
"from django.core.exceptions import ObjectDoesNotExist",
"from django.db import connection",
"fro... |
from django import http
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site, get_current_site
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext as _
def shortcut(request, content_type_id, object_id):
"""
Redir... | [
[
1,
0,
0.0125,
0.0125,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.025,
0.0125,
0,
0.66,
0.2,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.0375,
0.0125,
0,
0.66... | [
"from django import http",
"from django.contrib.contenttypes.models import ContentType",
"from django.contrib.sites.models import Site, get_current_site",
"from django.core.exceptions import ObjectDoesNotExist",
"from django.utils.translation import ugettext as _",
"def shortcut(request, content_type_id, ... |
from django.contrib.contenttypes.models import ContentType
from django.db.models import get_apps, get_models, signals
from django.utils.encoding import smart_unicode
def update_contenttypes(app, created_models, verbosity=2, **kwargs):
"""
Creates content types for models in the given app, removing any model
... | [
[
1,
0,
0.0127,
0.0127,
0,
0.66,
0,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.0253,
0.0127,
0,
0.66,
0.1667,
680,
0,
3,
0,
0,
680,
0,
0
],
[
1,
0,
0.038,
0.0127,
0,
0... | [
"from django.contrib.contenttypes.models import ContentType",
"from django.db.models import get_apps, get_models, signals",
"from django.utils.encoding import smart_unicode",
"def update_contenttypes(app, created_models, verbosity=2, **kwargs):\n \"\"\"\n Creates content types for models in the given ap... |
""" models.py (even empty) currently required by the runtests.py to enable unit tests """
| [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\" models.py (even empty) currently required by the runtests.py to enable unit tests \"\"\""
] |
from django import forms
class ManagementForm(forms.Form):
"""
``ManagementForm`` is used to keep track of the current wizard step.
"""
current_step = forms.CharField(widget=forms.HiddenInput)
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
3,
0,
0.7143,
0.7143,
0,
0.66,
1,
144,
0,
0,
0,
0,
953,
0,
1
],
[
8,
1,
0.7143,
0.4286,
1,
0.31,... | [
"from django import forms",
"class ManagementForm(forms.Form):\n \"\"\"\n ``ManagementForm`` is used to keep track of the current wizard step.\n \"\"\"\n current_step = forms.CharField(widget=forms.HiddenInput)",
" \"\"\"\n ``ManagementForm`` is used to keep track of the current wizard step.\n... |
from django.contrib.formtools.wizard import storage
class SessionStorage(storage.BaseStorage):
def __init__(self, *args, **kwargs):
super(SessionStorage, self).__init__(*args, **kwargs)
if self.prefix not in self.request.session:
self.init_data()
def _get_data(self):
self... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
691,
0,
1,
0,
0,
691,
0,
0
],
[
3,
0,
0.6053,
0.8421,
0,
0.66,
1,
254,
0,
3,
0,
0,
466,
0,
4
],
[
2,
1,
0.3947,
0.2105,
1,
0.69,... | [
"from django.contrib.formtools.wizard import storage",
"class SessionStorage(storage.BaseStorage):\n\n def __init__(self, *args, **kwargs):\n super(SessionStorage, self).__init__(*args, **kwargs)\n if self.prefix not in self.request.session:\n self.init_data()\n\n def _get_data(self... |
from django.core.exceptions import SuspiciousOperation
from django.core.signing import BadSignature
from django.utils import simplejson as json
from django.contrib.formtools.wizard import storage
class CookieStorage(storage.BaseStorage):
encoder = json.JSONEncoder(separators=(',', ':'))
def __init__(self, *... | [
[
1,
0,
0.0312,
0.0312,
0,
0.66,
0,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0625,
0.0312,
0,
0.66,
0.25,
460,
0,
1,
0,
0,
460,
0,
0
],
[
1,
0,
0.0938,
0.0312,
0,
0.... | [
"from django.core.exceptions import SuspiciousOperation",
"from django.core.signing import BadSignature",
"from django.utils import simplejson as json",
"from django.contrib.formtools.wizard import storage",
"class CookieStorage(storage.BaseStorage):\n encoder = json.JSONEncoder(separators=(',', ':'))\n\... |
from django.core.exceptions import ImproperlyConfigured
class MissingStorageModule(ImproperlyConfigured):
pass
class MissingStorageClass(ImproperlyConfigured):
pass
class NoFileStorageConfigured(ImproperlyConfigured):
pass
| [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
160,
0,
1,
0,
0,
160,
0,
0
],
[
3,
0,
0.35,
0.2,
0,
0.66,
0.3333,
810,
0,
0,
0,
0,
246,
0,
0
],
[
3,
0,
0.65,
0.2,
0,
0.66,
0.6667... | [
"from django.core.exceptions import ImproperlyConfigured",
"class MissingStorageModule(ImproperlyConfigured):\n pass",
"class MissingStorageClass(ImproperlyConfigured):\n pass",
"class NoFileStorageConfigured(ImproperlyConfigured):\n pass"
] |
from django.core.files.uploadedfile import UploadedFile
from django.utils.datastructures import MultiValueDict
from django.utils.encoding import smart_str
from django.utils.functional import lazy_property
from django.contrib.formtools.wizard.storage.exceptions import NoFileStorageConfigured
class BaseStorage(object)... | [
[
1,
0,
0.0094,
0.0094,
0,
0.66,
0,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0189,
0.0094,
0,
0.66,
0.2,
757,
0,
1,
0,
0,
757,
0,
0
],
[
1,
0,
0.0283,
0.0094,
0,
0.6... | [
"from django.core.files.uploadedfile import UploadedFile",
"from django.utils.datastructures import MultiValueDict",
"from django.utils.encoding import smart_str",
"from django.utils.functional import lazy_property",
"from django.contrib.formtools.wizard.storage.exceptions import NoFileStorageConfigured",
... |
import re
from django import forms
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.forms import formsets, ValidationError
from django.views.generic import TemplateView
from django.utils.datastructures import SortedDict
from django.utils.decorators import classonlymethod
... | [
[
1,
0,
0.0014,
0.0014,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0043,
0.0014,
0,
0.66,
0.0556,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0057,
0.0014,
0,
... | [
"import re",
"from django import forms",
"from django.shortcuts import redirect",
"from django.core.urlresolvers import reverse",
"from django.forms import formsets, ValidationError",
"from django.views.generic import TemplateView",
"from django.utils.datastructures import SortedDict",
"from django.ut... |
from django.contrib.formtools.wizard.legacy import FormWizard
| [
[
1,
0,
1,
1,
0,
0.66,
0,
255,
0,
1,
0,
0,
255,
0,
0
]
] | [
"from django.contrib.formtools.wizard.legacy import FormWizard"
] |
"""
FormWizard class -- implements a multi-page form, validating between each
step and storing the form's state as HTML hidden fields so that no state is
stored on the server side.
"""
from django.forms import HiddenInput
from django.http import Http404
from django.shortcuts import render_to_response
from django.templa... | [
[
8,
0,
0.0111,
0.0185,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0222,
0.0037,
0,
0.66,
0.1,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.0259,
0.0037,
0,
0.66,
... | [
"\"\"\"\nFormWizard class -- implements a multi-page form, validating between each\nstep and storing the form's state as HTML hidden fields so that no state is\nstored on the server side.\n\"\"\"",
"from django.forms import HiddenInput",
"from django.http import Http404",
"from django.shortcuts import render_... |
from django import forms
from django.contrib.formtools.wizard import FormWizard
from django.http import HttpResponse
class Page1(forms.Form):
name = forms.CharField(max_length=100)
thirsty = forms.NullBooleanField()
class Page2(forms.Form):
address1 = forms.CharField(max_length=100)
address2 = forms.C... | [
[
1,
0,
0.0233,
0.0233,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0465,
0.0233,
0,
0.66,
0.0769,
691,
0,
1,
0,
0,
691,
0,
0
],
[
1,
0,
0.0698,
0.0233,
0,
... | [
"from django import forms",
"from django.contrib.formtools.wizard import FormWizard",
"from django.http import HttpResponse",
"class Page1(forms.Form):\n name = forms.CharField(max_length=100)\n thirsty = forms.NullBooleanField()",
" name = forms.CharField(max_length=100)",
" thirsty = forms.N... |
from datetime import datetime
from django.http import HttpRequest
from django.conf import settings
from django.utils.importlib import import_module
from django.contrib.auth.models import User
def get_request():
request = HttpRequest()
engine = import_module(settings.SESSION_ENGINE)
request.session = eng... | [
[
1,
0,
0.013,
0.013,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.039,
0.013,
0,
0.66,
0.1667,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0519,
0.013,
0,
0.66,... | [
"from datetime import datetime",
"from django.http import HttpRequest",
"from django.conf import settings",
"from django.utils.importlib import import_module",
"from django.contrib.auth.models import User",
"def get_request():\n request = HttpRequest()\n engine = import_module(settings.SESSION_ENGIN... |
import os
import tempfile
from django import forms
from django.contrib.auth.models import User
from django.core.files.storage import FileSystemStorage
from django.forms.formsets import formset_factory
from django.forms.models import modelformset_factory
from django.http import HttpResponse
from django.template import ... | [
[
1,
0,
0.0149,
0.0149,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0299,
0.0149,
0,
0.66,
0.0476,
516,
0,
1,
0,
0,
516,
0,
0
],
[
1,
0,
0.0597,
0.0149,
0,
... | [
"import os",
"import tempfile",
"from django import forms",
"from django.contrib.auth.models import User",
"from django.core.files.storage import FileSystemStorage",
"from django.forms.formsets import formset_factory",
"from django.forms.models import modelformset_factory",
"from django.http import Ht... |
from __future__ import with_statement
import os
from django import forms
from django.test import TestCase
from django.test.client import RequestFactory
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.formtools.wizard.views import CookieWizardView
from django.contrib.for... | [
[
1,
0,
0.0026,
0.0026,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0053,
0.0026,
0,
0.66,
0.0714,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0106,
0.0026,
0,
... | [
"from __future__ import with_statement",
"import os",
"from django import forms",
"from django.test import TestCase",
"from django.test.client import RequestFactory",
"from django.conf import settings",
"from django.contrib.auth.models import User",
"from django.contrib.formtools.wizard.views import C... |
from django.conf.urls import patterns, url
from django.contrib.formtools.tests.wizard.wizardtests.forms import (
SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
urlpatterns = patterns('',
url(r'^wiz_session/$', SessionContactWizard.as_view(
[('form1', Page1),
('form2', P... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
528,
0,
2,
0,
0,
528,
0,
0
],
[
1,
0,
0.1136,
0.0909,
0,
0.66,
0.5,
545,
0,
6,
0,
0,
545,
0,
0
],
[
14,
0,
0.6136,
0.8182,
0,
0.... | [
"from django.conf.urls import patterns, url",
"from django.contrib.formtools.tests.wizard.wizardtests.forms import (\n SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)",
"urlpatterns = patterns('',\n url(r'^wiz_session/$', SessionContactWizard.as_view(\n [('form1', Page1),\n ... |
from django import forms, http
from django.conf import settings
from django.test import TestCase
from django.template.response import TemplateResponse
from django.utils.importlib import import_module
from django.contrib.auth.models import User
from django.contrib.formtools.wizard.views import (WizardView,
... | [
[
1,
0,
0.0049,
0.0049,
0,
0.66,
0,
294,
0,
2,
0,
0,
294,
0,
0
],
[
1,
0,
0.0098,
0.0049,
0,
0.66,
0.0556,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0146,
0.0049,
0,
... | [
"from django import forms, http",
"from django.conf import settings",
"from django.test import TestCase",
"from django.template.response import TemplateResponse",
"from django.utils.importlib import import_module",
"from django.contrib.auth.models import User",
"from django.contrib.formtools.wizard.view... |
from django.test import TestCase
from django.core import signing
from django.core.exceptions import SuspiciousOperation
from django.http import HttpResponse
from django.contrib.formtools.wizard.storage.cookie import CookieStorage
from django.contrib.formtools.tests.wizard.storage import get_request, TestStorage
clas... | [
[
1,
0,
0.0227,
0.0227,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0455,
0.0227,
0,
0.66,
0.1667,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.0682,
0.0227,
0,
... | [
"from django.test import TestCase",
"from django.core import signing",
"from django.core.exceptions import SuspiciousOperation",
"from django.http import HttpResponse",
"from django.contrib.formtools.wizard.storage.cookie import CookieStorage",
"from django.contrib.formtools.tests.wizard.storage import ge... |
from django.test import TestCase
from django.contrib.formtools.tests.wizard.storage import TestStorage
from django.contrib.formtools.wizard.storage.session import SessionStorage
class TestSessionStorage(TestStorage, TestCase):
def get_storage(self):
return SessionStorage
| [
[
1,
0,
0.1111,
0.1111,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.3333,
0.1111,
0,
0.66,
0.3333,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.4444,
0.1111,
0,
... | [
"from django.test import TestCase",
"from django.contrib.formtools.tests.wizard.storage import TestStorage",
"from django.contrib.formtools.wizard.storage.session import SessionStorage",
"class TestSessionStorage(TestStorage, TestCase):\n def get_storage(self):\n return SessionStorage",
" def g... |
import os
import tempfile
from django import forms
from django.core.files.storage import FileSystemStorage
from django.forms.formsets import formset_factory
from django.http import HttpResponse
from django.template import Template, Context
from django.contrib.auth.models import User
from django.contrib.formtools.wiz... | [
[
1,
0,
0.0192,
0.0192,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0385,
0.0192,
0,
0.66,
0.0588,
516,
0,
1,
0,
0,
516,
0,
0
],
[
1,
0,
0.0769,
0.0192,
0,
... | [
"import os",
"import tempfile",
"from django import forms",
"from django.core.files.storage import FileSystemStorage",
"from django.forms.formsets import formset_factory",
"from django.http import HttpResponse",
"from django.template import Template, Context",
"from django.contrib.auth.models import U... |
from django.core.urlresolvers import reverse
from django.http import QueryDict
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.formtools.wizard.views import (NamedUrlSessionWizardView,
NamedUrlCookieWizardView)
from dj... | [
[
1,
0,
0.0027,
0.0027,
0,
0.66,
0,
749,
0,
1,
0,
0,
749,
0,
0
],
[
1,
0,
0.0055,
0.0027,
0,
0.66,
0.0769,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0082,
0.0027,
0,
... | [
"from django.core.urlresolvers import reverse",
"from django.http import QueryDict",
"from django.test import TestCase",
"from django.contrib.auth.models import User",
"from django.contrib.formtools.wizard.views import (NamedUrlSessionWizardView,\n NamedUrlC... |
from django.conf.urls import patterns, url
from django.contrib.formtools.tests.wizard.namedwizardtests.forms import (
SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
def get_named_session_wizard():
return SessionContactWizard.as_view(
[('form1', Page1), ('form2', Page2), ('form3'... | [
[
1,
0,
0.0417,
0.0417,
0,
0.66,
0,
528,
0,
2,
0,
0,
528,
0,
0
],
[
1,
0,
0.1042,
0.0833,
0,
0.66,
0.25,
903,
0,
6,
0,
0,
903,
0,
0
],
[
2,
0,
0.3125,
0.25,
0,
0.66... | [
"from django.conf.urls import patterns, url",
"from django.contrib.formtools.tests.wizard.namedwizardtests.forms import (\n SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)",
"def get_named_session_wizard():\n return SessionContactWizard.as_view(\n [('form1', Page1), ('form2',... |
from django.test import TestCase
from django.contrib.formtools.wizard.storage import (get_storage,
MissingStorageModule,
MissingStorageClass)
from django.contrib.formtools.wizard.storage.base import BaseStorage
... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.1818,
0.1364,
0,
0.66,
0.3333,
358,
0,
3,
0,
0,
358,
0,
0
],
[
1,
0,
0.2727,
0.0455,
0,
... | [
"from django.test import TestCase",
"from django.contrib.formtools.wizard.storage import (get_storage,\n MissingStorageModule,\n MissingStorageClass)",
"from django.contrib.formtools.wizard.storage.base impor... |
from django.contrib.formtools.tests.wizard.cookiestorage import TestCookieStorage
from django.contrib.formtools.tests.wizard.forms import FormTests, SessionFormTests, CookieFormTests
from django.contrib.formtools.tests.wizard.loadstorage import TestLoadStorage
from django.contrib.formtools.tests.wizard.namedwizardtests... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
832,
0,
1,
0,
0,
832,
0,
0
],
[
1,
0,
0.1053,
0.0526,
0,
0.66,
0.2,
294,
0,
3,
0,
0,
294,
0,
0
],
[
1,
0,
0.1579,
0.0526,
0,
0.6... | [
"from django.contrib.formtools.tests.wizard.cookiestorage import TestCookieStorage",
"from django.contrib.formtools.tests.wizard.forms import FormTests, SessionFormTests, CookieFormTests",
"from django.contrib.formtools.tests.wizard.loadstorage import TestLoadStorage",
"from django.contrib.formtools.tests.wiz... |
"""
This is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.
"""
from __future__ import absolute_import
from django.conf.urls import patterns, url
from django.contrib.formtools.tests import TestFormPreview, TestWizardClass
from django.contrib.formtools.tests.forms import (ContactWizard, Page1,... | [
[
8,
0,
0.1053,
0.1579,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2632,
0.0526,
0,
0.66,
0.2,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.3684,
0.0526,
0,
0.66,
... | [
"\"\"\"\nThis is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.\n\"\"\"",
"from __future__ import absolute_import",
"from django.conf.urls import patterns, url",
"from django.contrib.formtools.tests import TestFormPreview, TestWizardClass",
"from django.contrib.formtools.tests.forms... |
import os
import re
import warnings
from django import http
from django.conf import settings
from django.contrib.formtools import preview, utils
from django.contrib.formtools.wizard import FormWizard
from django.test import TestCase
from django.test.utils import get_warnings_state, restore_warnings_state
from django.u... | [
[
1,
0,
0.0022,
0.0022,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0043,
0.0022,
0,
0.66,
0.0476,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0065,
0.0022,
0,
... | [
"import os",
"import re",
"import warnings",
"from django import http",
"from django.conf import settings",
"from django.contrib.formtools import preview, utils",
"from django.contrib.formtools.wizard import FormWizard",
"from django.test import TestCase",
"from django.test.utils import get_warnings... |
"""
Formtools Preview application.
"""
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.utils.crypto import constant_time_compare
from django.contrib.formtools.utils import form_hmac
AUTO_ID = 'formtools_%s' # Each form here... | [
[
8,
0,
0.0135,
0.0203,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0338,
0.0068,
0,
0.66,
0.1429,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0405,
0.0068,
0,
0.66... | [
"\"\"\"\nFormtools Preview application.\n\"\"\"",
"from django.http import Http404",
"from django.shortcuts import render_to_response",
"from django.template.context import RequestContext",
"from django.utils.crypto import constant_time_compare",
"from django.contrib.formtools.utils import form_hmac",
"... |
try:
import cPickle as pickle
except ImportError:
import pickle
import hashlib
from django.conf import settings
from django.utils.crypto import salted_hmac
def security_hash(request, form, *args):
"""
Calculates a security hash for the given Form instance.
This creates a list of the form field n... | [
[
7,
0,
0.041,
0.0656,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0328,
0.0164,
1,
0.86,
0,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
1,
0.0656,
0.0164,
1,
0.86,
... | [
"try:\n import cPickle as pickle\nexcept ImportError:\n import pickle",
" import cPickle as pickle",
" import pickle",
"import hashlib",
"from django.conf import settings",
"from django.utils.crypto import salted_hmac",
"def security_hash(request, form, *args):\n \"\"\"\n Calculates a ... |
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.
... | [
[
1,
0,
0.0286,
0.0286,
0,
0.66,
0,
516,
0,
2,
0,
0,
516,
0,
0
],
[
3,
0,
0.5429,
0.9429,
0,
0.66,
1,
362,
0,
1,
0,
0,
186,
0,
10
],
[
8,
1,
0.2,
0.2,
1,
0.99,
... | [
"from django.utils.http import http_date, parse_http_date_safe",
"class ConditionalGetMiddleware(object):\n \"\"\"\n Handles conditional GET operations. If the response has a ETag or\n Last-Modified header, and the request has If-None-Match or\n If-Modified-Since, the response is replaced by an HttpNo... |
"This is the locale selecting middleware that will look at accept headers"
from django.conf import settings
from django.core.urlresolvers import (is_valid_path, get_resolver,
LocaleRegexURLResolver)
from django.http import HttpResponseRedirect
from django.utils.cache import patch_... | [
[
8,
0,
0.0175,
0.0175,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0526,
0.0175,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0789,
0.0351,
0,
0.66... | [
"\"This is the locale selecting middleware that will look at accept headers\"",
"from django.conf import settings",
"from django.core.urlresolvers import (is_valid_path, get_resolver,\n LocaleRegexURLResolver)",
"from django.http import HttpResponseRedirect",
"from djang... |
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accordingly, so that cac... | [
[
1,
0,
0.0217,
0.0217,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0652,
0.0217,
0,
0.66,
0.25,
590,
0,
1,
0,
0,
590,
0,
0
],
[
1,
0,
0.087,
0.0217,
0,
0.6... | [
"import re",
"from django.utils.text import compress_string",
"from django.utils.cache import patch_vary_headers",
"re_accepts_gzip = re.compile(r'\\bgzip\\b')",
"class GZipMiddleware(object):\n \"\"\"\n This middleware compresses content if the browser allows gzip compression.\n It sets the Vary h... |
from django.conf import settings
from django import http
class XViewMiddleware(object):
"""
Adds an X-View header to internal HEAD requests -- used by the documentation system.
"""
def process_view(self, request, view_func, view_args, view_kwargs):
"""
If the request method is HEAD and ... | [
[
1,
0,
0.0435,
0.0435,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.087,
0.0435,
0,
0.66,
0.5,
294,
0,
1,
0,
0,
294,
0,
0
],
[
3,
0,
0.587,
0.8696,
0,
0.66,... | [
"from django.conf import settings",
"from django import http",
"class XViewMiddleware(object):\n \"\"\"\n Adds an X-View header to internal HEAD requests -- used by the documentation system.\n \"\"\"\n def process_view(self, request, view_func, view_args, view_kwargs):\n \"\"\"\n If th... |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import hashlib
import re
import random
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils.cache import patch_vary_h... | [
[
8,
0,
0.0162,
0.0278,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.037,
0.0046,
0,
0.66,
0.05,
154,
0,
1,
0,
0,
154,
0,
0
],
[
1,
0,
0.0417,
0.0046,
0,
0.66,
... | [
"\"\"\"\nCross Site Request Forgery Middleware.\n\nThis module provides a middleware that implements protection\nagainst request forgeries from other sites.\n\"\"\"",
"import hashlib",
"import re",
"import random",
"from django.conf import settings",
"from django.core.urlresolvers import get_callable",
... |
import hashlib
import re
from django.conf import settings
from django import http
from django.core.mail import mail_managers
from django.utils.http import urlquote
from django.core import urlresolvers
from django.utils.log import getLogger
logger = getLogger('django.request')
class CommonMiddleware(object):
"""... | [
[
1,
0,
0.0065,
0.0065,
0,
0.66,
0,
154,
0,
1,
0,
0,
154,
0,
0
],
[
1,
0,
0.0131,
0.0065,
0,
0.66,
0.0909,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0261,
0.0065,
0,
... | [
"import hashlib",
"import re",
"from django.conf import settings",
"from django import http",
"from django.core.mail import mail_managers",
"from django.utils.http import urlquote",
"from django.core import urlresolvers",
"from django.utils.log import getLogger",
"logger = getLogger('django.request'... |
from django.db import transaction
class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_on_response activated - that way a save() doesn't do a direct
commit, the commit is done when a successful response is created. If an
exc... | [
[
1,
0,
0.037,
0.037,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
3,
0,
0.5556,
0.9259,
0,
0.66,
1,
538,
0,
3,
0,
0,
186,
0,
9
],
[
8,
1,
0.2407,
0.2222,
1,
0.23,
... | [
"from django.db import transaction",
"class TransactionMiddleware(object):\n \"\"\"\n Transaction middleware. If this is enabled, each view function will be run\n with commit_on_response activated - that way a save() doesn't do a direct\n commit, the commit is done when a successful response is create... |
"""
Clickjacking Protection Middleware.
This module provides a middleware that implements protection against a
malicious site loading resources from your site in a hidden frame.
"""
from django.conf import settings
class XFrameOptionsMiddleware(object):
"""
Middleware that sets the X-Frame-Options HTTP heade... | [
[
8,
0,
0.0686,
0.1176,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1569,
0.0196,
0,
0.66,
0.5,
128,
0,
1,
0,
0,
128,
0,
0
],
[
3,
0,
0.598,
0.8235,
0,
0.66,
... | [
"\"\"\"\nClickjacking Protection Middleware.\n\nThis module provides a middleware that implements protection against a\nmalicious site loading resources from your site in a hidden frame.\n\"\"\"",
"from django.conf import settings",
"class XFrameOptionsMiddleware(object):\n \"\"\"\n Middleware that sets t... |
"""
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE_CLASSES = [
'django.middleware.cache.UpdateCa... | [
[
8,
0,
0.122,
0.239,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2488,
0.0049,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.2537,
0.0049,
0,
0.66,
... | [
"\"\"\"\nCache middleware. If enabled, each Django-powered page will be cached based on\nURL. The canonical way to enable cache middleware is to set\n``UpdateCacheMiddleware`` as your first piece of middleware, and\n``FetchFromCacheMiddleware`` as the last::\n\n MIDDLEWARE_CLASSES = [\n 'django.middleware... |
from django.template import Library, TemplateSyntaxError
from django.template.defaulttags import kwarg_re, SsiNode, URLNode
register = Library()
@register.tag
def ssi(parser, token):
"""
Outputs the contents of a given file into the page.
Like a simple "include" tag, the ``ssi`` tag includes the contents... | [
[
1,
0,
0.0081,
0.0081,
0,
0.66,
0,
213,
0,
2,
0,
0,
213,
0,
0
],
[
1,
0,
0.0161,
0.0081,
0,
0.66,
0.25,
629,
0,
3,
0,
0,
629,
0,
0
],
[
14,
0,
0.0323,
0.0081,
0,
0... | [
"from django.template import Library, TemplateSyntaxError",
"from django.template.defaulttags import kwarg_re, SsiNode, URLNode",
"register = Library()",
"def ssi(parser, token):\n \"\"\"\n Outputs the contents of a given file into the page.\n\n Like a simple \"include\" tag, the ``ssi`` tag includes... |
from django.template import Node
from django.template import TemplateSyntaxError, Library
from django.utils import formats
from django.utils.encoding import force_unicode
register = Library()
@register.filter(is_safe=False)
def localize(value):
"""
Forces a value to be rendered as a localized value,
regar... | [
[
1,
0,
0.0161,
0.0161,
0,
0.66,
0,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.0323,
0.0161,
0,
0.66,
0.125,
213,
0,
2,
0,
0,
213,
0,
0
],
[
1,
0,
0.0484,
0.0161,
0,
0... | [
"from django.template import Node",
"from django.template import TemplateSyntaxError, Library",
"from django.utils import formats",
"from django.utils.encoding import force_unicode",
"register = Library()",
"def localize(value):\n \"\"\"\n Forces a value to be rendered as a localized value,\n reg... |
from urlparse import urljoin
from django import template
from django.utils.encoding import iri_to_uri
register = template.Library()
class PrefixNode(template.Node):
def __repr__(self):
return "<PrefixNode for %r>" % self.name
def __init__(self, varname=None, name=None):
if name is None:
... | [
[
1,
0,
0.0098,
0.0098,
0,
0.66,
0,
857,
0,
1,
0,
0,
857,
0,
0
],
[
1,
0,
0.0196,
0.0098,
0,
0.66,
0.1429,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0294,
0.0098,
0,
... | [
"from urlparse import urljoin",
"from django import template",
"from django.utils.encoding import iri_to_uri",
"register = template.Library()",
"class PrefixNode(template.Node):\n\n def __repr__(self):\n return \"<PrefixNode for %r>\" % self.name\n\n def __init__(self, varname=None, name=None):... |
from __future__ import with_statement
from datetime import datetime, tzinfo
try:
import pytz
except ImportError:
pytz = None
from django.template import Node
from django.template import TemplateSyntaxError, Library
from django.utils import timezone
register = Library()
# HACK: datetime is an old-style cla... | [
[
1,
0,
0.005,
0.005,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0149,
0.005,
0,
0.66,
0.0625,
426,
0,
2,
0,
0,
426,
0,
0
],
[
7,
0,
0.0322,
0.0198,
0,
0.6... | [
"from __future__ import with_statement",
"from datetime import datetime, tzinfo",
"try:\n import pytz\nexcept ImportError:\n pytz = None",
" import pytz",
" pytz = None",
"from django.template import Node",
"from django.template import TemplateSyntaxError, Library",
"from django.utils impo... |
from __future__ import with_statement
import re
from django.template import (Node, Variable, TemplateSyntaxError,
TokenParser, Library, TOKEN_TEXT, TOKEN_VAR)
from django.template.base import _render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import translation
regist... | [
[
1,
0,
0.0021,
0.0021,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0042,
0.0021,
0,
0.66,
0.04,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0094,
0.0042,
0,
0.... | [
"from __future__ import with_statement",
"import re",
"from django.template import (Node, Variable, TemplateSyntaxError,\n TokenParser, Library, TOKEN_TEXT, TOKEN_VAR)",
"from django.template.base import _render_value_in_context",
"from django.template.defaulttags import token_kwargs",
"from django.uti... |
import hashlib
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.http import urlquote
register = Library()
class CacheNode(Node):
def __init__(self, nodelist, expire_time... | [
[
1,
0,
0.0164,
0.0164,
0,
0.66,
0,
154,
0,
1,
0,
0,
154,
0,
0
],
[
1,
0,
0.0328,
0.0164,
0,
0.66,
0.1429,
213,
0,
5,
0,
0,
213,
0,
0
],
[
1,
0,
0.0492,
0.0164,
0,
... | [
"import hashlib",
"from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist",
"from django.template import resolve_variable",
"from django.core.cache import cache",
"from django.utils.http import urlquote",
"register = Library()",
"class CacheNode(Node):\n def __... |
"""
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
from StringIO import StringIO
import decimal
import yaml
from django.db import models
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import Serializer as PythonSeriali... | [
[
8,
0,
0.0492,
0.082,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1148,
0.0164,
0,
0.66,
0.0909,
609,
0,
1,
0,
0,
609,
0,
0
],
[
1,
0,
0.1311,
0.0164,
0,
0.66,... | [
"\"\"\"\nYAML serializer.\n\nRequires PyYaml (http://pyyaml.org/), but that's checked for in __init__.\n\"\"\"",
"from StringIO import StringIO",
"import decimal",
"import yaml",
"from django.db import models",
"from django.core.serializers.base import DeserializationError",
"from django.core.serializer... |
"""
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from dj... | [
[
8,
0,
0.0256,
0.0385,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0641,
0.0128,
0,
0.66,
0.0833,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0769,
0.0128,
0,
0.66... | [
"\"\"\"\nSerialize data to/from JSON\n\"\"\"",
"import datetime",
"import decimal",
"from StringIO import StringIO",
"from django.core.serializers.base import DeserializationError",
"from django.core.serializers.python import Serializer as PythonSerializer",
"from django.core.serializers.python import D... |
"""
XML serializer.
"""
from django.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.encoding import smart_unicode
from xml.dom import pulldom
class Serializer(base.Serializer):
"""
... | [
[
8,
0,
0.0068,
0.0103,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0171,
0.0034,
0,
0.66,
0.1111,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0205,
0.0034,
0,
0.66... | [
"\"\"\"\nXML serializer.\n\"\"\"",
"from django.conf import settings",
"from django.core.serializers import base",
"from django.db import models, DEFAULT_DB_ALIAS",
"from django.utils.xmlutils import SimplerXMLGenerator",
"from django.utils.encoding import smart_unicode",
"from xml.dom import pulldom",
... |
"""
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from django.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS
from dj... | [
[
8,
0,
0.0216,
0.036,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0504,
0.0072,
0,
0.66,
0.1429,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0576,
0.0072,
0,
0.66,... | [
"\"\"\"\nA Python \"serializer\". Doesn't do much serializing per se -- just converts to\nand from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for\nother serializers.\n\"\"\"",
"from django.conf import settings",
"from django.core.serializers import base",
"from django.db import m... |
"""
Module for abstract serializer/unserializer base classes.
"""
from StringIO import StringIO
from django.db import models
from django.utils.encoding import smart_unicode
class SerializerDoesNotExist(KeyError):
"""The requested serializer was not found."""
pass
class SerializationError(Exception):
"""... | [
[
8,
0,
0.0116,
0.0174,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0291,
0.0058,
0,
0.66,
0.1111,
609,
0,
1,
0,
0,
609,
0,
0
],
[
1,
0,
0.0407,
0.0058,
0,
0.66... | [
"\"\"\"\nModule for abstract serializer/unserializer base classes.\n\"\"\"",
"from StringIO import StringIO",
"from django.db import models",
"from django.utils.encoding import smart_unicode",
"class SerializerDoesNotExist(KeyError):\n \"\"\"The requested serializer was not found.\"\"\"\n pass",
" ... |
"""
Interfaces for serializing Django objects.
Usage::
from django.core import serializers
json = serializers.serialize("json", some_query_set)
objects = list(serializers.deserialize("json", json))
To add your own serializers, use the SERIALIZATION_MODULES setting::
SERIALIZATION_MODULES = {
... | [
[
8,
0,
0.0726,
0.1371,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1532,
0.0081,
0,
0.66,
0.0667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1613,
0.0081,
0,
0.66... | [
"\"\"\"\nInterfaces for serializing Django objects.\n\nUsage::\n\n from django.core import serializers\n json = serializers.serialize(\"json\", some_query_set)\n objects = list(serializers.deserialize(\"json\", json))",
"from django.conf import settings",
"from django.utils import importlib",
"from d... |
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
from django.conf... | [
[
8,
0,
0.045,
0.08,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1,
0.01,
0,
0.66,
0.0714,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.11,
0.01,
0,
0.66,
0.1429... | [
"\"\"\"\nA set of request processors that return dictionaries to be merged into a\ntemplate context. Each function takes the request object as its only parameter\nand returns a dictionary to add to the context.\n\nThese are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by\nRequestContext.\n\"\"\"... |
import mimetypes
import os
import random
import time
from email import charset as Charset, encoders as Encoders
from email.generator import Generator
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.header import Header
from email.utils ... | [
[
1,
0,
0.0028,
0.0028,
0,
0.66,
0,
583,
0,
1,
0,
0,
583,
0,
0
],
[
1,
0,
0.0055,
0.0028,
0,
0.66,
0.04,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0083,
0.0028,
0,
0.... | [
"import mimetypes",
"import os",
"import random",
"import time",
"from email import charset as Charset, encoders as Encoders",
"from email.generator import Generator",
"from email.mime.text import MIMEText",
"from email.mime.multipart import MIMEMultipart",
"from email.mime.base import MIMEBase",
... |
"""
Email message and email sending related helper functions.
"""
import socket
# Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of
# seconds, which slows down the restart of the server.
class CachedDnsName(object):
def __str__(self):
return self.get_fqdn()
def get_fqdn(sel... | [
[
8,
0,
0.1053,
0.1579,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2632,
0.0526,
0,
0.66,
0.3333,
687,
0,
1,
0,
0,
687,
0,
0
],
[
3,
0,
0.7105,
0.4211,
0,
0.66... | [
"\"\"\"\nEmail message and email sending related helper functions.\n\"\"\"",
"import socket",
"class CachedDnsName(object):\n def __str__(self):\n return self.get_fqdn()\n\n def get_fqdn(self):\n if not hasattr(self, '_fqdn'):\n self._fqdn = socket.getfqdn()\n return self._... |
"""
Dummy email backend that does nothing.
"""
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def send_messages(self, email_messages):
return len(email_messages)
| [
[
8,
0,
0.2222,
0.3333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.5556,
0.1111,
0,
0.66,
0.5,
502,
0,
1,
0,
0,
502,
0,
0
],
[
3,
0,
0.8889,
0.3333,
0,
0.66,
... | [
"\"\"\"\nDummy email backend that does nothing.\n\"\"\"",
"from django.core.mail.backends.base import BaseEmailBackend",
"class EmailBackend(BaseEmailBackend):\n def send_messages(self, email_messages):\n return len(email_messages)",
" def send_messages(self, email_messages):\n return len(... |
"""
Email backend that writes messages to console instead of sending them.
"""
import sys
import threading
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
self.stream = kwargs.pop('stream', sys.stdout)
self._loc... | [
[
8,
0,
0.0588,
0.0882,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1176,
0.0294,
0,
0.66,
0.25,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.1471,
0.0294,
0,
0.66,
... | [
"\"\"\"\nEmail backend that writes messages to console instead of sending them.\n\"\"\"",
"import sys",
"import threading",
"from django.core.mail.backends.base import BaseEmailBackend",
"class EmailBackend(BaseEmailBackend):\n def __init__(self, *args, **kwargs):\n self.stream = kwargs.pop('strea... |
"""SMTP email backend class."""
import smtplib
import socket
import threading
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
from django.core.mail.utils import DNS_NAME
from django.core.mail.message import sanitize_address
class EmailBackend(BaseEmailBackend):
"""
... | [
[
8,
0,
0.0087,
0.0087,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0174,
0.0087,
0,
0.66,
0.125,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0261,
0.0087,
0,
0.66,... | [
"\"\"\"SMTP email backend class.\"\"\"",
"import smtplib",
"import socket",
"import threading",
"from django.conf import settings",
"from django.core.mail.backends.base import BaseEmailBackend",
"from django.core.mail.utils import DNS_NAME",
"from django.core.mail.message import sanitize_address",
"... |
"""Base email backend class."""
class BaseEmailBackend(object):
"""
Base class for email backend implementations.
Subclasses must at least overwrite send_messages().
"""
def __init__(self, fail_silently=False, **kwargs):
self.fail_silently = fail_silently
def open(self):
"""Op... | [
[
8,
0,
0.0256,
0.0256,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.5385,
0.9487,
0,
0.66,
1,
507,
0,
4,
0,
0,
186,
0,
0
],
[
8,
1,
0.1538,
0.1282,
1,
0.37,
... | [
"\"\"\"Base email backend class.\"\"\"",
"class BaseEmailBackend(object):\n \"\"\"\n Base class for email backend implementations.\n\n Subclasses must at least overwrite send_messages().\n \"\"\"\n def __init__(self, fail_silently=False, **kwargs):\n self.fail_silently = fail_silently",
" ... |
# Mail backends shipped with Django.
| [] | [] |
"""
Backend for test environment.
"""
from django.core import mail
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
"""A email backend for use during test sessions.
The test connection stores email messages in a dummy outbox,
rather than sending them out o... | [
[
8,
0,
0.0833,
0.125,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2083,
0.0417,
0,
0.66,
0.3333,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.25,
0.0417,
0,
0.66,
... | [
"\"\"\"\nBackend for test environment.\n\"\"\"",
"from django.core import mail",
"from django.core.mail.backends.base import BaseEmailBackend",
"class EmailBackend(BaseEmailBackend):\n \"\"\"A email backend for use during test sessions.\n\n The test connection stores email messages in a dummy outbox,\n ... |
import os
import sys
from warnings import warn
from django import http
from django.core import signals
from django.core.handlers.base import BaseHandler
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures
from django.utils.encoding import force_unicode, iri_to_uri
from django... | [
[
1,
0,
0.0056,
0.0056,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0111,
0.0056,
0,
0.66,
0.0769,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0167,
0.0056,
0,
... | [
"import os",
"import sys",
"from warnings import warn",
"from django import http",
"from django.core import signals",
"from django.core.handlers.base import BaseHandler",
"from django.core.urlresolvers import set_script_prefix",
"from django.utils import datastructures",
"from django.utils.encoding ... |
import hotshot
import os
import time
from django.core.handlers.modpython import ModPythonHandler
PROFILE_DATA_DIR = "/var/log/cmsprofile"
def handler(req):
'''
Handler that uses hotshot to store profile data.
Stores profile data in PROFILE_DATA_DIR. Since hotshot has no way (that I
know of) to appe... | [
[
1,
0,
0.04,
0.04,
0,
0.66,
0,
974,
0,
1,
0,
0,
974,
0,
0
],
[
1,
0,
0.08,
0.04,
0,
0.66,
0.2,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.12,
0.04,
0,
0.66,
0.4,
... | [
"import hotshot",
"import os",
"import time",
"from django.core.handlers.modpython import ModPythonHandler",
"PROFILE_DATA_DIR = \"/var/log/cmsprofile\"",
"def handler(req):\n '''\n Handler that uses hotshot to store profile data.\n\n Stores profile data in PROFILE_DATA_DIR. Since hotshot has no... |
import sys
from threading import Lock
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django import http
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructure... | [
[
1,
0,
0.0039,
0.0039,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0079,
0.0039,
0,
0.66,
0.0714,
83,
0,
1,
0,
0,
83,
0,
0
],
[
7,
0,
0.0177,
0.0157,
0,
0.... | [
"import sys",
"from threading import Lock",
"try:\n from cStringIO import StringIO\nexcept ImportError:\n from StringIO import StringIO",
" from cStringIO import StringIO",
" from StringIO import StringIO",
"from django import http",
"from django.core import signals",
"from django.core.han... |
from django.dispatch import Signal
request_started = Signal()
request_finished = Signal()
got_request_exception = Signal(providing_args=["request"])
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
548,
0,
1,
0,
0,
548,
0,
0
],
[
14,
0,
0.6,
0.2,
0,
0.66,
0.3333,
176,
3,
0,
0,
0,
592,
10,
1
],
[
14,
0,
0.8,
0.2,
0,
0.66,
0.666... | [
"from django.dispatch import Signal",
"request_started = Signal()",
"request_finished = Signal()",
"got_request_exception = Signal(providing_args=[\"request\"])"
] |
from math import ceil
class InvalidPage(Exception):
pass
class PageNotAnInteger(InvalidPage):
pass
class EmptyPage(InvalidPage):
pass
class Paginator(object):
def __init__(self, object_list, per_page, orphans=0, allow_empty_first_page=True):
self.object_list = object_list
self.per_pa... | [
[
1,
0,
0.0063,
0.0063,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
3,
0,
0.0222,
0.0127,
0,
0.66,
0.1667,
933,
0,
0,
0,
0,
645,
0,
0
],
[
3,
0,
0.0411,
0.0127,
0,
... | [
"from math import ceil",
"class InvalidPage(Exception):\n pass",
"class PageNotAnInteger(InvalidPage):\n pass",
"class EmptyPage(InvalidPage):\n pass",
"class Paginator(object):\n def __init__(self, object_list, per_page, orphans=0, allow_empty_first_page=True):\n self.object_list = objec... |
"""
Pages in Django can are served up with custom HTTP headers containing useful
information about those pages -- namely, the content type and object ID.
This module contains utility functions for retrieving and doing interesting
things with these special "X-Headers" (so called because the HTTP spec demands
that custo... | [
[
8,
0,
0.2292,
0.4167,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.75,
0.5417,
0,
0.66,
1,
146,
0,
4,
0,
0,
0,
0,
4
],
[
8,
1,
0.6458,
0.25,
1,
0.42,
0,
... | [
"\"\"\"\nPages in Django can are served up with custom HTTP headers containing useful\ninformation about those pages -- namely, the content type and object ID.\n\nThis module contains utility functions for retrieving and doing interesting\nthings with these special \"X-Headers\" (so called because the HTTP spec dem... |
"""
Global Django exception and warning classes.
"""
class DjangoRuntimeWarning(RuntimeWarning):
pass
class ObjectDoesNotExist(Exception):
"The requested object does not exist"
silent_variable_failure = True
class MultipleObjectsReturned(Exception):
"The query returned multiple objects when only one ... | [
[
8,
0,
0.023,
0.0345,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.0632,
0.023,
0,
0.66,
0.0909,
653,
0,
0,
0,
0,
973,
0,
0
],
[
3,
0,
0.1034,
0.0345,
0,
0.66,
... | [
"\"\"\"\nGlobal Django exception and warning classes.\n\"\"\"",
"class DjangoRuntimeWarning(RuntimeWarning):\n pass",
"class ObjectDoesNotExist(Exception):\n \"The requested object does not exist\"\n silent_variable_failure = True",
" \"The requested object does not exist\"",
" silent_variabl... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_all
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module n... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.1579,
0.0526,
0,
0.66,
0.25,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.2105,
0.0526,
0,
0.... | [
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.core.management.sql import sql_all",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for... |
import os
from django.core.management.base import NoArgsCommand
from optparse import make_option
class Command(NoArgsCommand):
option_list = NoArgsCommand.option_list + (
make_option('--plain', action='store_true', dest='plain',
help='Tells Django to use plain Python, not IPython.'),
)
... | [
[
1,
0,
0.012,
0.012,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0241,
0.012,
0,
0.66,
0.3333,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.0361,
0.012,
0,
0.66... | [
"import os",
"from django.core.management.base import NoArgsCommand",
"from optparse import make_option",
"class Command(NoArgsCommand):\n option_list = NoArgsCommand.option_list + (\n make_option('--plain', action='store_true', dest='plain',\n help='Tells Django to use plain Python, not ... |
import codecs
import os
import sys
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
def has_bom(fn):
f = open(fn, 'r')
sample = f.read(4)
return sample[:3] == '\xef\xbb\xbf' or \
sample.startswith(codecs.BOM_UTF16_LE) or \
sample.sta... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
220,
0,
1,
0,
0,
220,
0,
0
],
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0.1429,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
... | [
"import codecs",
"import os",
"import sys",
"from optparse import make_option",
"from django.core.management.base import BaseCommand, CommandError",
"def has_bom(fn):\n f = open(fn, 'r')\n sample = f.read(4)\n return sample[:3] == '\\xef\\xbb\\xbf' or \\\n sample.startswith(codecs.BOM_... |
from django.core.management.base import NoArgsCommand
def module_to_dict(module, omittable=lambda k: k.startswith('_')):
"Converts a module namespace to a Python dictionary. Used by get_settings_diff."
return dict([(k, repr(v)) for k, v in module.__dict__.items() if not omittable(k)])
class Command(NoArgsComm... | [
[
1,
0,
0.0312,
0.0312,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
2,
0,
0.125,
0.0938,
0,
0.66,
0.5,
736,
0,
2,
1,
0,
0,
0,
5
],
[
8,
1,
0.125,
0.0312,
1,
0.17,
... | [
"from django.core.management.base import NoArgsCommand",
"def module_to_dict(module, omittable=lambda k: k.startswith('_')):\n \"Converts a module namespace to a Python dictionary. Used by get_settings_diff.\"\n return dict([(k, repr(v)) for k, v in module.__dict__.items() if not omittable(k)])",
" \"C... |
import keyword
from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
class Command(NoArgsCommand):
help = "Introspects the database tables in the given database and outputs a Django model module."
option_list =... | [
[
1,
0,
0.0058,
0.0058,
0,
0.66,
0,
454,
0,
1,
0,
0,
454,
0,
0
],
[
1,
0,
0.0116,
0.0058,
0,
0.66,
0.25,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0231,
0.0058,
0,
0.... | [
"import keyword",
"from optparse import make_option",
"from django.core.management.base import NoArgsCommand, CommandError",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(NoArgsCommand):\n help = \"Introspects the database tables in the given database and outputs a Django model mo... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_reset
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s)."
option_... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.15,
0.05,
0,
0.66,
0.25,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.2,
0.05,
0,
0.66,
0.5,
... | [
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.core.management.sql import sql_reset",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given a... |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
class Command(BaseCommand):
help = ("Runs the command-line client for specified database, or the "
"default database if none is provided.")
option_lis... | [
[
1,
0,
0.0357,
0.0357,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.1071,
0.0357,
0,
0.66,
0.3333,
931,
0,
2,
0,
0,
931,
0,
0
],
[
1,
0,
0.1429,
0.0357,
0,
... | [
"from optparse import make_option",
"from django.core.management.base import BaseCommand, CommandError",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(BaseCommand):\n help = (\"Runs the command-line client for specified database, or the \"\n \"default database if none is prov... |
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = "Validates all installed models."
requires_model_validation = False
def handle_noargs(self, **options):
self.validate(display_num_errors=True)
| [
[
1,
0,
0.1111,
0.1111,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
3,
0,
0.6667,
0.7778,
0,
0.66,
1,
73,
0,
1,
0,
0,
795,
0,
1
],
[
14,
1,
0.4444,
0.1111,
1,
0.87,... | [
"from django.core.management.base import NoArgsCommand",
"class Command(NoArgsCommand):\n help = \"Validates all installed models.\"\n\n requires_model_validation = False\n\n def handle_noargs(self, **options):\n self.validate(display_num_errors=True)",
" help = \"Validates all installed mode... |
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Runs this project as a FastCGI application. Requires flup."
args = '[various KEY=val options, use `runfcgi help` for help]'
def handle(self, *args, **options):
from django.conf import settings
from djan... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
3,
0,
0.575,
0.9,
0,
0.66,
1,
73,
0,
2,
0,
0,
564,
0,
2
],
[
14,
1,
0.2,
0.05,
1,
0.31,
0,
8... | [
"from django.core.management.base import BaseCommand",
"class Command(BaseCommand):\n help = \"Runs this project as a FastCGI application. Requires flup.\"\n args = '[various KEY=val options, use `runfcgi help` for help]'\n\n def handle(self, *args, **options):\n from django.conf import settings\n... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_indexes
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the CREATE INDEX SQL statements for the given model module name(s)."
option_list... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.15,
0.05,
0,
0.66,
0.25,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.2,
0.05,
0,
0.66,
0.5,
... | [
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.core.management.sql import sql_indexes",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the CREATE INDEX SQL statements for the given model module n... |
import fnmatch
import glob
import os
import re
import sys
from itertools import dropwhile
from optparse import make_option
from subprocess import PIPE, Popen
import django
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.text import get_text_list
from django.utils.jslex import prep... | [
[
1,
0,
0.0025,
0.0025,
0,
0.66,
0,
626,
0,
1,
0,
0,
626,
0,
0
],
[
1,
0,
0.0049,
0.0025,
0,
0.66,
0.0435,
958,
0,
1,
0,
0,
958,
0,
0
],
[
1,
0,
0.0074,
0.0025,
0,
... | [
"import fnmatch",
"import glob",
"import os",
"import re",
"import sys",
"from itertools import dropwhile",
"from optparse import make_option",
"from subprocess import PIPE, Popen",
"import django",
"from django.core.management.base import CommandError, NoArgsCommand",
"from django.utils.text im... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_create
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the CREATE TABLE SQL statements for the given app name(s)."
option_list = AppComm... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.1579,
0.0526,
0,
0.66,
0.25,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.2105,
0.0526,
0,
0.... | [
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.core.management.sql import sql_create",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the CREATE TABLE SQL statements for the given app name(s).\"\... |
from optparse import make_option
from django.core.management.base import NoArgsCommand
from django.core.management.sql import sql_flush
from django.db import connections, DEFAULT_DB_ALIAS
class Command(NoArgsCommand):
help = "Returns a list of the SQL statements required to return all tables in the database to th... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.1579,
0.0526,
0,
0.66,
0.25,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.2105,
0.0526,
0,
0.... | [
"from optparse import make_option",
"from django.core.management.base import NoArgsCommand",
"from django.core.management.sql import sql_flush",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(NoArgsCommand):\n help = \"Returns a list of the SQL statements required to return all tab... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.db import connections, models, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = 'Prints the SQL statements for resetting sequences for the given app name(s).'
option_list = AppCommand.option_list + (
mak... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.15,
0.05,
0,
0.66,
0.3333,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.2,
0.05,
0,
0.66,
0.6... | [
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.db import connections, models, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = 'Prints the SQL statements for resetting sequences for the given app name(s).'\n\n option_list = AppCommand.option... |
import sys
import os
from optparse import make_option, OptionParser
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test.utils import get_runner
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput',
actio... | [
[
1,
0,
0.0133,
0.0133,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0267,
0.0133,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.04,
0.0133,
0,
0.... | [
"import sys",
"import os",
"from optparse import make_option, OptionParser",
"from django.conf import settings",
"from django.core.management.base import BaseCommand",
"from django.test.utils import get_runner",
"class Command(BaseCommand):\n option_list = BaseCommand.option_list + (\n make_op... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.