code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import cache
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
def __init__(self, session_key=None):
self._cache = cache
super(SessionStore, self).__init__(sess... | [
[
1,
0,
0.0179,
0.0179,
0,
0.66,
0,
907,
0,
2,
0,
0,
907,
0,
0
],
[
1,
0,
0.0357,
0.0179,
0,
0.66,
0.5,
734,
0,
1,
0,
0,
734,
0,
0
],
[
3,
0,
0.5268,
0.9286,
0,
0.6... | [
"from django.contrib.sessions.backends.base import SessionBase, CreateError",
"from django.core.cache import cache",
"class SessionStore(SessionBase):\n \"\"\"\n A cache-based session store.\n \"\"\"\n def __init__(self, session_key=None):\n self._cache = cache\n super(SessionStore, se... |
from django.utils.translation import ungettext, ugettext as _
from django.utils.encoding import force_unicode
from django import template
from django.template import defaultfilters
from datetime import date
import re
register = template.Library()
def ordinal(value):
"""
Converts an integer to its o... | [
[
1,
0,
0.0101,
0.0101,
0,
0.66,
0,
389,
0,
2,
0,
0,
389,
0,
0
],
[
1,
0,
0.0202,
0.0101,
0,
0.66,
0.05,
96,
0,
1,
0,
0,
96,
0,
0
],
[
1,
0,
0.0303,
0.0101,
0,
0.66... | [
"from django.utils.translation import ungettext, ugettext as _",
"from django.utils.encoding import force_unicode",
"from django import template",
"from django.template import defaultfilters",
"from datetime import date",
"import re",
"register = template.Library()",
"def ordinal(value):\n \"\"\"\n... |
from django.conf.urls.defaults import *
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)... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
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.defaults import *",
"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+)/(.*)/$',... |
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
f... | [
[
1,
0,
0.0116,
0.0116,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0233,
0.0116,
0,
0.66,
0.1,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0349,
0.0116,
0,
0.66,... | [
"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... | [
[
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 Dat... | [
[
1,
0,
0.0067,
0.0067,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0134,
0.0067,
0,
0.66,
0.0714,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0201,
0.0067,
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.h... | [
[
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}... |
from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site
| [
[
1,
0,
1,
1,
0,
0.66,
0,
231,
0,
4,
0,
0,
231,
0,
0
]
] | [
"from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site"
] |
"""
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, smar... | [
[
8,
0,
0.0116,
0.0186,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0279,
0.0047,
0,
0.66,
0.0714,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0326,
0.0047,
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 te... | [
[
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 commo... | [
[
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):
... | [
[
1,
0,
0.0149,
0.0149,
0,
0.66,
0,
74,
0,
2,
0,
0,
74,
0,
0
],
[
1,
0,
0.0299,
0.0149,
0,
0.66,
0.2,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.0597,
0.0149,
0,
0.66... | [
"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
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_* methods.
... | [
[
1,
0,
0.0095,
0.0095,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.019,
0.0095,
0,
0.66,
0.25,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0286,
0.0095,
0,
0.66,... | [
"from django.db import models",
"from django.utils.translation import ugettext_lazy as _",
"from django.utils.encoding import smart_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 all the get_for_... |
from django import db
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.contenttypes.views import shortcut
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from djan... | [
[
1,
0,
0.0145,
0.0145,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.029,
0.0145,
0,
0.66,
0.125,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0435,
0.0145,
0,
0.... | [
"from django import db",
"from django.conf import settings",
"from django.contrib.contenttypes.models import ContentType",
"from django.contrib.sites.models import Site",
"from django.contrib.contenttypes.views import shortcut",
"from django.core.exceptions import ObjectDoesNotExist",
"from django.http ... |
"""
Classes allowing "generic" relations through ContentType and object-id fields.
"""
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import signals
from django.db import models, router, DEFAULT_DB_ALIAS
from django.db.models.fields.related import R... | [
[
8,
0,
0.0047,
0.007,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0117,
0.0023,
0,
0.66,
0.0455,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0141,
0.0023,
0,
0.66,... | [
"\"\"\"\nClasses allowing \"generic\" relations through ContentType and object-id fields.\n\"\"\"",
"from django.core.exceptions import ObjectDoesNotExist",
"from django.db import connection",
"from django.db.models import signals",
"from django.db import models, router, DEFAULT_DB_ALIAS",
"from django.db... |
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
def shortcut(request, content_type_id, object_id):
"Redirect to an object's page based on a content-type ID a... | [
[
1,
0,
0.0141,
0.0141,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0282,
0.0141,
0,
0.66,
0.25,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.0423,
0.0141,
0,
0.... | [
"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",
"def shortcut(request, content_type_id, object_id):\n \"Redirect to an object's page based on... |
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 mo... | [
[
1,
0,
0.0167,
0.0167,
0,
0.66,
0,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.0333,
0.0167,
0,
0.66,
0.1667,
680,
0,
3,
0,
0,
680,
0,
0
],
[
1,
0,
0.05,
0.0167,
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 \"\"\""
] |
"""
This is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.
"""
from django.conf.urls.defaults import *
from django.contrib.formtools.tests import *
urlpatterns = patterns('',
(r'^test1/', TestFormPreview(TestForm)),
(r'^test2/', UserSecur... | [
[
8,
0,
0.1176,
0.1765,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2941,
0.0588,
0,
0.66,
0.3333,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.3529,
0.0588,
0,
0.66... | [
"\"\"\"\nThis is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.\n\"\"\"",
"from django.conf.urls.defaults import *",
"from django.contrib.formtools.tests import *",
"urlpatterns = patterns('',\n (r'^test1/', TestFormPreview(TestForm)),\n (r'... |
import os
from django import forms
from django import http
from django.conf import settings
from django.contrib.formtools import preview, wizard, utils
from django.test import TestCase
from django.utils import unittest
success_string = "Done was called!"
class TestFormPreview(preview.FormPreview):
... | [
[
1,
0,
0.0028,
0.0028,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0083,
0.0028,
0,
0.66,
0.0455,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.011,
0.0028,
0,
0... | [
"import os",
"from django import forms",
"from django import http",
"from django.conf import settings",
"from django.contrib.formtools import preview, wizard, utils",
"from django.test import TestCase",
"from django.utils import unittest",
"success_string = \"Done was called!\"",
"class TestFormPrev... |
"""
Formtools Preview application.
"""
import cPickle as pickle
from django.conf import settings
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.utils.hashcompat import md5_constructor
from django.utils.crypto im... | [
[
8,
0,
0.0133,
0.02,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0333,
0.0067,
0,
0.66,
0.1,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.0467,
0.0067,
0,
0.66,
... | [
"\"\"\"\nFormtools Preview application.\n\"\"\"",
"import cPickle as pickle",
"from django.conf import settings",
"from django.http import Http404",
"from django.shortcuts import render_to_response",
"from django.template.context import RequestContext",
"from django.utils.hashcompat import md5_construct... |
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.forms import BooleanField
from django.utils.crypto import salted_hmac
from django.utils.hashcompat import md5_constructor
def security_hash(request, form, *args):
"""
Calculates a... | [
[
7,
0,
0.0397,
0.0635,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0317,
0.0159,
1,
0.06,
0,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
1,
0.0635,
0.0159,
1,
0.06,
... | [
"try:\n import cPickle as pickle\nexcept ImportError:\n import pickle",
" import cPickle as pickle",
" import pickle",
"from django.conf import settings",
"from django.forms import BooleanField",
"from django.utils.crypto import salted_hmac",
"from django.utils.hashcompat import md5_construc... |
"""
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.
"""
import cPickle as pickle
from django import forms
from django.conf import settings
from django.contrib.formtools.utils impo... | [
[
8,
0,
0.0106,
0.0177,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0247,
0.0035,
0,
0.66,
0.0769,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.0318,
0.0035,
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\"\"\"",
"import cPickle as pickle",
"from django import forms",
"from django.conf import settings",
"from django.contr... |
from django.core.exceptions import MiddlewareNotUsed
from django.utils.http import http_date
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... | [
[
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.5,
516,
0,
1,
0,
0,
516,
0,
0
],
[
3,
0,
0.5625,
0.9062,
0,
0.6... | [
"from django.core.exceptions import MiddlewareNotUsed",
"from django.utils.http import http_date",
"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, t... |
"this is the locale selecting middleware that will look at accept headers"
from django.utils.cache import patch_vary_headers
from django.utils import translation
class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what translation object to instal... | [
[
8,
0,
0.04,
0.04,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.12,
0.04,
0,
0.66,
0.3333,
53,
0,
1,
0,
0,
53,
0,
0
],
[
1,
0,
0.16,
0.04,
0,
0.66,
0.6667,
... | [
"\"this is the locale selecting middleware that will look at accept headers\"",
"from django.utils.cache import patch_vary_headers",
"from django.utils import translation",
"class LocaleMiddleware(object):\n \"\"\"\n This is a very simple middleware that parses a request\n and decides what translatio... |
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, s... | [
[
1,
0,
0.0263,
0.0263,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0789,
0.0263,
0,
0.66,
0.25,
590,
0,
1,
0,
0,
590,
0,
0
],
[
1,
0,
0.1053,
0.0263,
0,
0.... | [
"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 ... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1053,
0.0526,
0,
0.66,
0.5,
294,
0,
1,
0,
0,
294,
0,
0
],
[
3,
0,
0.6053,
0.8421,
0,
0.6... | [
"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 itertools
import re
import random
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils.cache impo... | [
[
8,
0,
0.0101,
0.0174,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0232,
0.0029,
0,
0.66,
0.037,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0261,
0.0029,
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 itertools",
"import re",
"import random",
"from django.conf import settings",
"from django.core.urlresolvers import get_callable",
... |
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
... | [
[
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.4,
... | [
"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... |
"""
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.U... | [
[
8,
0,
0.1572,
0.3082,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3208,
0.0063,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.327,
0.0063,
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.conf import settings
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):
"""
Forces a value to be rendered as a localized val... | [
[
1,
0,
0.0149,
0.0149,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0299,
0.0149,
0,
0.66,
0.0769,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.0448,
0.0149,
0,
... | [
"from django.conf import settings",
"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 r... |
import re
from django.template import Node, Variable, VariableNode, _render_value_in_context
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.utils import translation
from django.utils.encoding import force_unicode
register = L... | [
[
1,
0,
0.0036,
0.0036,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0109,
0.0036,
0,
0.66,
0.0476,
213,
0,
4,
0,
0,
213,
0,
0
],
[
1,
0,
0.0146,
0.0036,
0,
... | [
"import re",
"from django.template import Node, Variable, VariableNode, _render_value_in_context",
"from django.template import TemplateSyntaxError, TokenParser, Library",
"from django.template import TOKEN_TEXT, TOKEN_VAR",
"from django.utils import translation",
"from django.utils.encoding import force_... |
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
from django.utils.http import urlquote
from django.utils.hashcompat import md5_constructor
... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
213,
0,
5,
0,
0,
213,
0,
0
],
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0.1111,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
... | [
"from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist",
"from django.template import resolve_variable",
"from django.core.cache import cache",
"from django.utils.encoding import force_unicode",
"from django.utils.http import urlquote",
"from django.utils.hashcompa... |
# This module is DEPRECATED!
#
# You should no longer be using django.template_loader.
#
# Use django.template.loader instead.
from django.template.loader import *
| [
[
1,
0,
1,
0.1429,
0,
0.66,
0,
970,
0,
1,
0,
0,
970,
0,
0
]
] | [
"from django.template.loader import *"
] |
"""
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.python import Serializer as PythonSerializer
from django.core.serializers.python import Des... | [
[
8,
0,
0.0508,
0.0847,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1186,
0.0169,
0,
0.66,
0.1,
609,
0,
1,
0,
0,
609,
0,
0
],
[
1,
0,
0.1356,
0.0169,
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.python import Serializer as PythonSerializer",
"from django.cor... |
"""
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.utils import datetime_safe
from django.utils i... | [
[
8,
0,
0.0308,
0.0462,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0769,
0.0154,
0,
0.66,
0.0909,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0923,
0.0154,
0,
0.66... | [
"\"\"\"\nSerialize data to/from JSON\n\"\"\"",
"import datetime",
"import decimal",
"from StringIO import StringIO",
"from django.core.serializers.python import Serializer as PythonSerializer",
"from django.core.serializers.python import Deserializer as PythonDeserializer",
"from django.utils import dat... |
"""
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.0067,
0.0101,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0168,
0.0034,
0,
0.66,
0.1111,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0202,
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... | [
[
8,
0,
0.0211,
0.0352,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0493,
0.007,
0,
0.66,
0.1429,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0563,
0.007,
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_str, smart_unicode
from django.utils import datetime_safe
class SerializationError(Exception):
"""Something bad happened during serializa... | [
[
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_str, smart_unicode",
"from django.utils import datetime_safe",
"class SerializationError(Exception):\n \"\"\"Something b... |
"""
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.0796,
0.1504,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1681,
0.0088,
0,
0.66,
0.0714,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.177,
0.0088,
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",
"BUILTI... |
"""
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 dj... | [
[
8,
0,
0.0433,
0.0769,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0962,
0.0096,
0,
0.66,
0.0909,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1058,
0.0096,
0,
0.66... | [
"\"\"\"\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, Encoders
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.Header import Header
from email.Utils import formatdate, getaddresses, formataddr
from dja... | [
[
1,
0,
0.0034,
0.0034,
0,
0.66,
0,
583,
0,
1,
0,
0,
583,
0,
0
],
[
1,
0,
0.0067,
0.0034,
0,
0.66,
0.0476,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0101,
0.0034,
0,
... | [
"import mimetypes",
"import os",
"import random",
"import time",
"from email import Charset, Encoders",
"from email.MIMEText import MIMEText",
"from email.MIMEMultipart import MIMEMultipart",
"from email.MIMEBase import MIMEBase",
"from email.Header import Header",
"from email.Utils import formatd... |
"""
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... | [
[
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)
... | [
[
8,
0,
0.0541,
0.0811,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1081,
0.027,
0,
0.66,
0.25,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.1351,
0.027,
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
class EmailBackend(BaseEmailBackend):
"""
A wrapper that manages the SMTP network ... | [
[
8,
0,
0.0094,
0.0094,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0283,
0.0094,
0,
0.66,
0.1429,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0377,
0.0094,
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",
"class EmailBackend(BaseEmailBackend):\n \"\"\"\n A wr... |
"""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):
... | [
[
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.04,
... | [
"\"\"\"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... | [
[
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
from pprint import pformat
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 ... | [
[
1,
0,
0.0047,
0.0047,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0094,
0.0047,
0,
0.66,
0.0714,
276,
0,
1,
0,
0,
276,
0,
0
],
[
1,
0,
0.0141,
0.0047,
0,
... | [
"import os",
"from pprint import pformat",
"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"... |
import hotshot, time, os
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 append ... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
974,
0,
3,
0,
0,
974,
0,
0
],
[
1,
0,
0.0909,
0.0455,
0,
0.66,
0.3333,
978,
0,
1,
0,
0,
978,
0,
0
],
[
14,
0,
0.1818,
0.0455,
0,
... | [
"import hotshot, time, os",
"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 way (that I\n know... |
from pprint import pformat
import sys
from threading import Lock
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import socket
from django import http
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set... | [
[
1,
0,
0.0036,
0.0036,
0,
0.66,
0,
276,
0,
1,
0,
0,
276,
0,
0
],
[
1,
0,
0.0072,
0.0036,
0,
0.66,
0.0625,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0108,
0.0036,
0,
... | [
"from pprint import pformat",
"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",
"import socket",
"from django import http",
"from d... |
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
... | [
[
1,
0,
0.0083,
0.0083,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
3,
0,
0.0292,
0.0167,
0,
0.66,
0.1667,
933,
0,
0,
0,
0,
645,
0,
0
],
[
3,
0,
0.0542,
0.0167,
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... | [
[
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,
0,
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 whe... | [
[
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_variable... |
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 m... | [
[
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.0169,
0.0169,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0339,
0.0169,
0,
0.66,
0.3333,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.0508,
0.0169,
0,
... | [
"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 \
... | [
[
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(NoAr... | [
[
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.22,
... | [
"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."
opti... | [
[
1,
0,
0.0061,
0.0061,
0,
0.66,
0,
454,
0,
1,
0,
0,
454,
0,
0
],
[
1,
0,
0.0122,
0.0061,
0,
0.66,
0.25,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0244,
0.0061,
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)."
... | [
[
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.")
o... | [
[
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.24,... | [
"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
f... | [
[
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.25,
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)."
op... | [
[
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... |
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 ... | [
[
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 databas... | [
[
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 + (
... | [
[
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... |
from django.core.management.base import BaseCommand
from optparse import make_option
import sys
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput', action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user... | [
[
1,
0,
0.025,
0.025,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.05,
0.025,
0,
0.66,
0.3333,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.075,
0.025,
0,
0.66,
... | [
"from django.core.management.base import BaseCommand",
"from optparse import make_option",
"import sys",
"class Command(BaseCommand):\n option_list = BaseCommand.option_list + (\n make_option('--noinput', action='store_false', dest='interactive', default=True,\n help='Tells Django to NOT ... |
from optparse import make_option
from django.core.management.base import LabelCommand
from django.db import connections, transaction, models, DEFAULT_DB_ALIAS
class Command(LabelCommand):
help = "Creates the table needed to use the SQL cache backend."
args = "<tablename>"
label = 'tablename'
... | [
[
1,
0,
0.0189,
0.0189,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0566,
0.0189,
0,
0.66,
0.3333,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.0755,
0.0189,
0,
... | [
"from optparse import make_option",
"from django.core.management.base import LabelCommand",
"from django.db import connections, transaction, models, DEFAULT_DB_ALIAS",
"class Command(LabelCommand):\n help = \"Creates the table needed to use the SQL cache backend.\"\n args = \"<tablename>\"\n label = ... |
from django.core.management.base import copy_helper, CommandError, LabelCommand
from django.utils.importlib import import_module
import os
import re
from random import choice
class Command(LabelCommand):
help = "Creates a Django project directory structure for the given project name in the current directory... | [
[
1,
0,
0.0256,
0.0256,
0,
0.66,
0,
931,
0,
3,
0,
0,
931,
0,
0
],
[
1,
0,
0.0513,
0.0256,
0,
0.66,
0.2,
118,
0,
1,
0,
0,
118,
0,
0
],
[
1,
0,
0.0769,
0.0256,
0,
0.6... | [
"from django.core.management.base import copy_helper, CommandError, LabelCommand",
"from django.utils.importlib import import_module",
"import os",
"import re",
"from random import choice",
"class Command(LabelCommand):\n help = \"Creates a Django project directory structure for the given project name ... |
import os
from django.core.management.base import copy_helper, CommandError, LabelCommand
from django.utils.importlib import import_module
class Command(LabelCommand):
help = "Creates a Django app directory structure for the given app name in the current directory."
args = "[appname]"
label = 'app... | [
[
1,
0,
0.0213,
0.0213,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0638,
0.0213,
0,
0.66,
0.25,
931,
0,
3,
0,
0,
931,
0,
0
],
[
1,
0,
0.0851,
0.0213,
0,
0.... | [
"import os",
"from django.core.management.base import copy_helper, CommandError, LabelCommand",
"from django.utils.importlib import import_module",
"class Command(LabelCommand):\n help = \"Creates a Django app directory structure for the given app name in the current directory.\"\n args = \"[appname]\"\... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_delete
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the DROP TABLE SQL statements for the given app name(s)."
option_list = ... | [
[
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_delete",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the DROP TABLE SQL statements for the given app name(s).\"\n\... |
from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput', action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input... | [
[
1,
0,
0.0278,
0.0278,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.0833,
0.0278,
0,
0.66,
0.5,
323,
0,
1,
0,
0,
323,
0,
0
],
[
3,
0,
0.5694,
0.8889,
0,
0.6... | [
"from django.core.management.base import BaseCommand",
"from optparse import make_option",
"class Command(BaseCommand):\n option_list = BaseCommand.option_list + (\n make_option('--noinput', action='store_false', dest='interactive', default=True,\n help='Tells Django to NOT prompt the user ... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_custom
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the custom table modifying SQL statements for the given app name(s)."
op... | [
[
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_custom",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the custom table modifying SQL statements for the given app n... |
from django.core.management.base import AppCommand, CommandError
class Command(AppCommand):
help = "RENAMED: see 'sqlcustom'"
def handle(self, *apps, **options):
raise CommandError("This command has been renamed. Use the 'sqlcustom' command instead.")
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
931,
0,
2,
0,
0,
931,
0,
0
],
[
3,
0,
0.7143,
0.7143,
0,
0.66,
1,
73,
0,
1,
0,
0,
369,
0,
1
],
[
14,
1,
0.5714,
0.1429,
1,
0.62,... | [
"from django.core.management.base import AppCommand, CommandError",
"class Command(AppCommand):\n help = \"RENAMED: see 'sqlcustom'\"\n\n def handle(self, *apps, **options):\n raise CommandError(\"This command has been renamed. Use the 'sqlcustom' command instead.\")",
" help = \"RENAMED: see 's... |
from optparse import make_option
import os
import sys
from django.core.management.base import BaseCommand, CommandError
from django.core.handlers.wsgi import WSGIHandler
from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException
from django.utils import autoreload
class BaseRunserve... | [
[
1,
0,
0.0088,
0.0088,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0175,
0.0088,
0,
0.66,
0.125,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0263,
0.0088,
0,
0... | [
"from optparse import make_option",
"import os",
"import sys",
"from django.core.management.base import BaseCommand, CommandError",
"from django.core.handlers.wsgi import WSGIHandler",
"from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException",
"from django.utils import autor... |
import datetime
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = "Can be run as a cronjob or directly to clean out old data from the database (only expired sessions at the moment)."
def handle_noargs(self, **options):
from django.db import transaction
... | [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0.5,
931,
0,
1,
0,
0,
931,
0,
0
],
[
3,
0,
0.6818,
0.7273,
0,
0.6... | [
"import datetime",
"from django.core.management.base import NoArgsCommand",
"class Command(NoArgsCommand):\n help = \"Can be run as a cronjob or directly to clean out old data from the database (only expired sessions at the moment).\"\n\n def handle_noargs(self, **options):\n from django.db import ... |
import os
import re
from django.conf import settings
from django.core.management.base import CommandError
from django.db import models
from django.db.models import get_models
def sql_create(app, style, connection):
"Returns a list of the CREATE TABLE SQL statements for the given app."
if connectio... | [
[
1,
0,
0.0055,
0.0055,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0109,
0.0055,
0,
0.66,
0.0714,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0219,
0.0055,
0,
... | [
"import os",
"import re",
"from django.conf import settings",
"from django.core.management.base import CommandError",
"from django.db import models",
"from django.db.models import get_models",
"def sql_create(app, style, connection):\n \"Returns a list of the CREATE TABLE SQL statements for the given... |
"""
Sets up the terminal color scheme.
"""
import os
import sys
from django.utils import termcolors
def supports_color():
"""
Returns True if the running system's terminal supports color, and False
otherwise.
"""
unsupported_platform = (sys.platform in ('win32', 'Pocket PC'))
#... | [
[
8,
0,
0.04,
0.06,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1,
0.02,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.12,
0.02,
0,
0.66,
0.3333,... | [
"\"\"\"\nSets up the terminal color scheme.\n\"\"\"",
"import os",
"import sys",
"from django.utils import termcolors",
"def supports_color():\n \"\"\"\n Returns True if the running system's terminal supports color, and False\n otherwise.\n \"\"\"\n unsupported_platform = (sys.platform in ('w... |
import sys
from django.core.management.color import color_style
from django.utils.itercompat import is_iterable
class ModelErrorCollection:
def __init__(self, outfile=sys.stdout):
self.errors = []
self.outfile = outfile
self.style = color_style()
def add(self, context, error)... | [
[
1,
0,
0.0035,
0.0035,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0069,
0.0035,
0,
0.66,
0.25,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0104,
0.0035,
0,
0.... | [
"import sys",
"from django.core.management.color import color_style",
"from django.utils.itercompat import is_iterable",
"class ModelErrorCollection:\n def __init__(self, outfile=sys.stdout):\n self.errors = []\n self.outfile = outfile\n self.style = color_style()\n\n def add(self, ... |
"""
Utility functions for handling images.
Requires PIL, as you might imagine.
"""
from django.core.files import File
class ImageFile(File):
"""
A mixin for use alongside django.core.files.base.File, which provides
additional features for dealing with images.
"""
def _get_width(self)... | [
[
8,
0,
0.0484,
0.0806,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1129,
0.0161,
0,
0.66,
0.3333,
659,
0,
1,
0,
0,
659,
0,
0
],
[
3,
0,
0.2903,
0.3065,
0,
0.66... | [
"\"\"\"\nUtility functions for handling images.\n\nRequires PIL, as you might imagine.\n\"\"\"",
"from django.core.files import File",
"class ImageFile(File):\n \"\"\"\n A mixin for use alongside django.core.files.base.File, which provides\n additional features for dealing with images.\n \"\"\"\n ... |
"""
The temp module provides a NamedTemporaryFile that can be re-opened on any
platform. Most platforms use the standard Python tempfile.TemporaryFile class,
but MS Windows users are given a custom class.
This is needed because in Windows NT, the default implementation of
NamedTemporaryFile uses the O_TEMPORARY ... | [
[
8,
0,
0.0982,
0.1786,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2143,
0.0179,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2321,
0.0179,
0,
0.66... | [
"\"\"\"\nThe temp module provides a NamedTemporaryFile that can be re-opened on any\nplatform. Most platforms use the standard Python tempfile.TemporaryFile class,\nbut MS Windows users are given a custom class.\n\nThis is needed because in Windows NT, the default implementation of\nNamedTemporaryFile uses the O_TE... |
class FileProxyMixin(object):
"""
A mixin class used to forward file methods to an underlaying file
object. The internal file object has to be called "file"::
class FileProxy(FileProxyMixin):
def __init__(self, file):
self.file = file
"""
encoding = p... | [
[
3,
0,
0.5172,
1,
0,
0.66,
0,
369,
0,
1,
0,
0,
186,
0,
17
],
[
8,
1,
0.1897,
0.2759,
1,
0.69,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.3793,
0.0345,
1,
0.69,
0.... | [
"class FileProxyMixin(object):\n \"\"\"\n A mixin class used to forward file methods to an underlaying file\n object. The internal file object has to be called \"file\"::\n\n class FileProxy(FileProxyMixin):\n def __init__(self, file):\n self.file = file",
" \"\"\"\n ... |
import os
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.utils.encoding import smart_str, smart_unicode
from django.core.files.utils import FileProxyMixin
class File(FileProxyMixin):
DEFAULT_CHUNK_SIZE = 64 * 2**10
def __init__(self, file... | [
[
1,
0,
0.0075,
0.0075,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
7,
0,
0.0261,
0.0299,
0,
0.66,
0.2,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0224,
0.0075,
1,
0.38,
... | [
"import os",
"try:\n from cStringIO import StringIO\nexcept ImportError:\n from StringIO import StringIO",
" from cStringIO import StringIO",
" from StringIO import StringIO",
"from django.utils.encoding import smart_str, smart_unicode",
"from django.core.files.utils import FileProxyMixin",
... |
from django.core.files.base import File
| [
[
1,
0,
1,
1,
0,
0.66,
0,
293,
0,
1,
0,
0,
293,
0,
0
]
] | [
"from django.core.files.base import File"
] |
"""
Portable file locking utilities.
Based partially on example by Jonathan Feignberg <[email protected]> in the Python
Cookbook, licensed under the Python Software License.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
Example Usage::
>>> from django.core.files import locks
>>> f... | [
[
8,
0,
0.1214,
0.2286,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2571,
0.0143,
0,
0.66,
0.1667,
272,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.2857,
0.0143,
0,
0.66... | [
"\"\"\"\nPortable file locking utilities.\n\nBased partially on example by Jonathan Feignberg <[email protected]> in the Python\nCookbook, licensed under the Python Software License.\n\n http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203",
"__all__ = ('LOCK_EX','LOCK_SH','LOCK_NB','lock','unlock')",
"... |
"""
Functions that modify an HTTP request or response in some way.
"""
# This group of functions are run as part of the response handling, after
# everything else, including all response middleware. Think of them as
# "compulsory response middleware". Be careful about what goes here, because
# it's a little fid... | [
[
8,
0,
0.0238,
0.0357,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.1905,
0.131,
0,
0.66,
0.25,
687,
0,
2,
1,
0,
0,
0,
2
],
[
8,
1,
0.1786,
0.0833,
1,
0.31,
... | [
"\"\"\"\nFunctions that modify an HTTP request or response in some way.\n\"\"\"",
"def fix_location_header(request, response):\n \"\"\"\n Ensures that we always use an absolute URI in any location header in the\n response. This is required by RFC 2616, section 14.30.\n\n Code constructing response obj... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'Y. F j.'
TIME_FORMAT = 'G:i:s'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
MONTH_DAY_FORMAT = 'F j.'
SHORT_DATE_FORMAT = 'Y.m.d.'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPU... | [
[
14,
0,
0.2778,
0.0556,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.0556,
0,
0.66,
0.2,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.5,
0.0556,
0,
0.66,
... | [
"DATE_FORMAT = 'Y. F j.'",
"TIME_FORMAT = 'G:i:s'",
"MONTH_DAY_FORMAT = 'F j.'",
"SHORT_DATE_FORMAT = 'Y.m.d.'",
"DECIMAL_SEPARATOR = ','",
"THOUSAND_SEPARATOR = ' '"
] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'j F Y' # '20 januari 2009'
TIME_FORMAT = 'H:i' # '15:23'
DATETIME_FORMAT = 'j F Y H:i' # '20 januari 2009 15:23'
YEAR_MONTH_FORMAT = 'F Y' ... | [
[
14,
0,
0.1042,
0.0208,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.125,
0.0208,
0,
0.66,
0.0769,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1458,
0.0208,
0,
0.... | [
"DATE_FORMAT = 'j F Y' # '20 januari 2009'",
"TIME_FORMAT = 'H:i' # '15:23'",
"DATETIME_FORMAT = 'j F Y H:i' # '20 januari 2009 15:23'",
"YEAR_MONTH_FORMAT = 'F Y' # 'januari 2009'",
"MONTH_DAY_FORMAT = 'j F' # '20 januari'",
"SH... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
# MONTH_DAY_FORMAT =
SHORT_DATE_FORMAT = 'd.n.Y'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FORMA... | [
[
14,
0,
0.2778,
0.0556,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.0556,
0,
0.66,
0.25,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.5556,
0.0556,
0,
0.6... | [
"DATE_FORMAT = 'd F Y'",
"TIME_FORMAT = 'H:i:s'",
"SHORT_DATE_FORMAT = 'd.n.Y'",
"DECIMAL_SEPARATOR = ','",
"THOUSAND_SEPARATOR = '.'"
] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'd F Y' # 25 Ottobre 2006
TIME_FORMAT = 'H:i:s' # 14:30:59
DATETIME_FORMAT = 'l d F Y H:i:s' # Mercoledì 25 Ottobre 2006 14:30:59
YEAR_MONTH_FORMAT = 'F Y' # Ottobre 2006
MONTH_DAY_FORMAT = 'j/F' ... | [
[
14,
0,
0.122,
0.0244,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1463,
0.0244,
0,
0.66,
0.0769,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1707,
0.0244,
0,
0.... | [
"DATE_FORMAT = 'd F Y' # 25 Ottobre 2006",
"TIME_FORMAT = 'H:i:s' # 14:30:59",
"DATETIME_FORMAT = 'l d F Y H:i:s' # Mercoledì 25 Ottobre 2006 14:30:59",
"YEAR_MONTH_FORMAT = 'F Y' # Ottobre 2006",
"MONTH_DAY_FORMAT = 'j/F' # 10/2006",
"SHORT_DATE_FORMAT = 'd/M/Y' # 25/12/2009",
"SHORT_DATETIME_FORMAT = ... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# DATE_FORMAT =
# TIME_FORMAT =
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
# MONTH_DAY_FORMAT =
# SHORT_DATE_FORMAT =
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FORMATS =
# TIME_I... | [] | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd.m.Y'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FO... | [
[
14,
0,
0.2778,
0.0556,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.0556,
0,
0.66,
0.2,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.5,
0.0556,
0,
0.66,
... | [
"DATE_FORMAT = 'd F Y'",
"TIME_FORMAT = 'H:i:s'",
"MONTH_DAY_FORMAT = 'j F'",
"SHORT_DATE_FORMAT = 'd.m.Y'",
"DECIMAL_SEPARATOR = ','",
"THOUSAND_SEPARATOR = ' '"
] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'G:i:s'
DATETIME_FORMAT = 'j. F Y G:i:s'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s'
FIRST_DAY_O... | [
[
14,
0,
0.1562,
0.0312,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1875,
0.0312,
0,
0.66,
0.0769,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2188,
0.0312,
0,
0... | [
"DATE_FORMAT = 'j. F Y'",
"TIME_FORMAT = 'G:i:s'",
"DATETIME_FORMAT = 'j. F Y G:i:s'",
"YEAR_MONTH_FORMAT = 'F Y'",
"MONTH_DAY_FORMAT = 'j. F'",
"SHORT_DATE_FORMAT = 'd.m.Y'",
"SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s'",
"FIRST_DAY_OF_WEEK = 1 # Monday",
"DATE_INPUT_FORMATS = (\n '%d.%m.%Y', '%d.%m.%... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'G:i:s'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd.m.Y'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FO... | [
[
14,
0,
0.2778,
0.0556,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.0556,
0,
0.66,
0.2,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.5,
0.0556,
0,
0.66,
... | [
"DATE_FORMAT = 'j F Y'",
"TIME_FORMAT = 'G:i:s'",
"MONTH_DAY_FORMAT = 'j F'",
"SHORT_DATE_FORMAT = 'd.m.Y'",
"DECIMAL_SEPARATOR = ','",
"THOUSAND_SEPARATOR = ' '"
] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# DATE_FORMAT =
# TIME_FORMAT =
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
# MONTH_DAY_FORMAT =
# SHORT_DATE_FORMAT =
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FORMATS =
# TIME_I... | [] | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'g:i:s A'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
# MONTH_DAY_FORMAT =
SHORT_DATE_FORMAT = 'j M Y'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FORMATS ... | [
[
14,
0,
0.2778,
0.0556,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.0556,
0,
0.66,
0.5,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.5556,
0.0556,
0,
0.66... | [
"DATE_FORMAT = 'd F Y'",
"TIME_FORMAT = 'g:i:s A'",
"SHORT_DATE_FORMAT = 'j M Y'"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.