code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
from django.core.management.base import BaseCommand
from google.appengine.api import apiproxy_stub_map
from google.appengine.datastore import datastore_stub_util
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput', action='store_f... | [
[
1,
0,
0.0152,
0.0152,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.0455,
0.0152,
0,
0.66,
0.25,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.0606,
0.0152,
0,
0.... | [
"from django.core.management.base import BaseCommand",
"from google.appengine.api import apiproxy_stub_map",
"from google.appengine.datastore import datastore_stub_util",
"from optparse import make_option",
"class Command(BaseCommand):\n option_list = BaseCommand.option_list + (\n make_option('--n... |
import logging
from optparse import make_option
import sys
from django.db import connections
from django.core.management.base import BaseCommand
from django.core.management.commands.runserver import BaseRunserverCommand
from django.core.exceptions import ImproperlyConfigured
from google.appengine.tools import dev_app... | [
[
1,
0,
0.005,
0.005,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0099,
0.005,
0,
0.66,
0.1,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0149,
0.005,
0,
0.66,
... | [
"import logging",
"from optparse import make_option",
"import sys",
"from django.db import connections",
"from django.core.management.base import BaseCommand",
"from django.core.management.commands.runserver import BaseRunserverCommand",
"from django.core.exceptions import ImproperlyConfigured",
"from... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| [
[
1,
0,
0.2,
0.1,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3,
0.1,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
4,
0,
0.75,
0.6,
0,
0.66,
1,
0,
... | [
"import os",
"import sys",
"if __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"{{ project_name }}.settings\")\n\n from django.core.management import execute_from_command_line\n\n execute_from_command_line(sys.argv)",
" os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| [
[
1,
0,
0.2,
0.1,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3,
0.1,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
4,
0,
0.75,
0.6,
0,
0.66,
1,
0,
... | [
"import os",
"import sys",
"if __name__ == \"__main__\":\n os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"{{ project_name }}.settings\")\n\n from django.core.management import execute_from_command_line\n\n execute_from_command_line(sys.argv)",
" os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\... |
from dbindexer import autodiscover
autodiscover()
| [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
215,
0,
1,
0,
0,
215,
0,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
798,
3,
0,
0,
0,
0,
0,
1
]
] | [
"from dbindexer import autodiscover",
"autodiscover()"
] |
from {{ project_name }}.settings import *
| [] | [] |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', '{{ project_name }}.views.home', name='home'),
# url(r'^{{ project_name }}/', include('{{ pr... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
528,
0,
3,
0,
0,
528,
0,
0
],
[
14,
0,
0.7059,
0.6471,
0,
0.66,
1,
990,
3,
1,
0,
0,
75,
10,
1
]
] | [
"from django.conf.urls import patterns, include, url",
"urlpatterns = patterns('',\n # Examples:\n # url(r'^$', '{{ project_name }}.views.home', name='home'),\n # url(r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')),\n\n # Uncomment the admin/doc line below to enable admin documentatio... |
# Django settings for {{ project_name }} project.
# Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *
ADMINS = (
# ('Your Name', 'yo... | [
[
1,
0,
0.0382,
0.0064,
0,
0.66,
0,
423,
0,
1,
0,
0,
423,
0,
0
],
[
14,
0,
0.0573,
0.0191,
0,
0.66,
0.0417,
223,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.0764,
0.0064,
0,
... | [
"from djangoappengine.settings_base import *",
"ADMINS = (\n # ('Your Name', 'your_email@example.com'),\n)",
"MANAGERS = ADMINS",
"DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': DATABASES['default']}",
"AUTOLOAD_SITECONF = 'indexes'",
"ALLOWED_HOSTS = []",
"TIME_ZONE = 'America/Chicago'",
... |
from django.conf import settings
from django.http import HttpResponse
from django.utils.importlib import import_module
def warmup(request):
"""
Provides default procedure for handling warmup requests on App
Engine. Just add this view to your main urls.py.
"""
for app in settings.INSTALLED_APPS:
... | [
[
1,
0,
0.0556,
0.0556,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1111,
0.0556,
0,
0.66,
0.3333,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.1667,
0.0556,
0,
... | [
"from django.conf import settings",
"from django.http import HttpResponse",
"from django.utils.importlib import import_module",
"def warmup(request):\n \"\"\"\n Provides default procedure for handling warmup requests on App\n Engine. Just add this view to your main urls.py.\n \"\"\"\n for app i... |
import django
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.expressions import ExpressionNode
if django.VERSION >= (1, 5):
ExpressionNode_BITAND = ExpressionNode.BITAND
ExpressionNode_BITOR = ExpressionNode.BITOR
def find_col_by_node(cols, node):
col = None
... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0.2,
438,
0,
1,
0,
0,
438,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
0.6... | [
"import django",
"from django.db.models.sql.expressions import SQLEvaluator",
"from django.db.models.expressions import ExpressionNode",
"if django.VERSION >= (1, 5):\n ExpressionNode_BITAND = ExpressionNode.BITAND\n ExpressionNode_BITOR = ExpressionNode.BITOR\n\n def find_col_by_node(cols, node):\n ... |
from djangotoolbox.db.creation import NonrelDatabaseCreation
from .db_settings import get_model_indexes
from .stubs import stub_manager
class DatabaseCreation(NonrelDatabaseCreation):
# For TextFields and XMLFields we'll default to the unindexable,
# but not length-limited, db.Text (db_type of "string" fiel... | [
[
1,
0,
0.0132,
0.0132,
0,
0.66,
0,
682,
0,
1,
0,
0,
682,
0,
0
],
[
1,
0,
0.0395,
0.0132,
0,
0.66,
0.3333,
236,
0,
1,
0,
0,
236,
0,
0
],
[
1,
0,
0.0526,
0.0132,
0,
... | [
"from djangotoolbox.db.creation import NonrelDatabaseCreation",
"from .db_settings import get_model_indexes",
"from .stubs import stub_manager",
"class DatabaseCreation(NonrelDatabaseCreation):\n\n # For TextFields and XMLFields we'll default to the unindexable,\n # but not length-limited, db.Text (db_t... |
from django.db import DEFAULT_DB_ALIAS
from google.appengine.datastore.datastore_query import Cursor
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.3, 2.4 fallback.
class CursorQueryMixin(object):
def clone(self, *args, **kwargs):
kwargs... | [
[
1,
0,
0.0109,
0.0109,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0326,
0.0109,
0,
0.66,
0.1111,
177,
0,
1,
0,
0,
177,
0,
0
],
[
7,
0,
0.0707,
0.0435,
0,
0.... | [
"from django.db import DEFAULT_DB_ALIAS",
"from google.appengine.datastore.datastore_query import Cursor",
"try:\n from functools import wraps\nexcept ImportError:\n from django.utils.functional import wraps # Python 2.3, 2.4 fallback.",
" from functools import wraps",
" from django.utils.funct... |
from django.conf import settings
from django.utils.importlib import import_module
# TODO: Add autodiscover() and make API more like dbindexer's
# register_index.
# TODO: Add support for eventual consistency setting on specific
# models.
_MODULE_NAMES = getattr(settings, 'GAE_SETTINGS_MODULES', ())
FIEL... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0606,
0.0303,
0,
0.66,
0.2,
118,
0,
1,
0,
0,
118,
0,
0
],
[
14,
0,
0.3333,
0.0303,
0,
0.... | [
"from django.conf import settings",
"from django.utils.importlib import import_module",
"_MODULE_NAMES = getattr(settings, 'GAE_SETTINGS_MODULES', ())",
"FIELD_INDEXES = None",
"def get_model_indexes(model):\n indexes = get_indexes()\n model_index = {'indexed': [], 'unindexed': []}\n for item in re... |
from google.appengine.api.memcache import *
| [
[
1,
0,
1,
1,
0,
0.66,
0,
901,
0,
1,
0,
0,
901,
0,
0
]
] | [
"from google.appengine.api.memcache import *"
] |
# Initialize Django.
from djangoappengine import main
from django.utils.importlib import import_module
from django.conf import settings
# Load all models.py to ensure signal handling installation or index
# loading of some apps
for app in settings.INSTALLED_APPS:
try:
import_module('%s.models' % (app))
... | [
[
1,
0,
0.0909,
0.0455,
0,
0.66,
0,
683,
0,
1,
0,
0,
683,
0,
0
],
[
1,
0,
0.1818,
0.0455,
0,
0.66,
0.1667,
118,
0,
1,
0,
0,
118,
0,
0
],
[
1,
0,
0.2273,
0.0455,
0,
... | [
"from djangoappengine import main",
"from django.utils.importlib import import_module",
"from django.conf import settings",
"for app in settings.INSTALLED_APPS:\n try:\n import_module('%s.models' % (app))\n except ImportError:\n pass",
" try:\n import_module('%s.models' % (app)... |
from django.conf import settings
if 'django.contrib.auth' in settings.INSTALLED_APPS:
from dbindexer.api import register_index
from django.contrib.auth.models import User
register_index(User, {
'username': 'iexact',
'email': 'iexact',
})
if 'django.contrib.admin' in settings.INSTALLE... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
4,
0,
0.3947,
0.4211,
0,
0.66,
0.5,
0,
0,
0,
0,
0,
0,
0,
1
],
[
1,
1,
0.2632,
0.0526,
1,
0.11,
... | [
"from django.conf import settings",
"if 'django.contrib.auth' in settings.INSTALLED_APPS:\n from dbindexer.api import register_index\n from django.contrib.auth.models import User\n\n register_index(User, {\n 'username': 'iexact',\n 'email': 'iexact',\n })",
" from dbindexer.api impo... |
#! /usr/bin/env python
__revision__ = "$Id: setup.py,v 1.30 2005/06/14 01:20:22 akuchling Exp $"
from distutils import core
from distutils.core import Extension
from distutils.command.build_ext import build_ext
import os, sys
if sys.version[0:1] == '1':
raise RuntimeError, ("The Python Cryptography Toolkit requi... | [
[
1,
0,
0.0094,
0.0094,
0,
0.66,
0,
901,
0,
1,
0,
0,
901,
0,
0
],
[
1,
0,
0.0189,
0.0094,
0,
0.66,
0.1667,
152,
0,
1,
0,
0,
152,
0,
0
],
[
1,
0,
0.0283,
0.0094,
0,
... | [
"from distutils import core",
"from distutils.core import Extension",
"from distutils.command.build_ext import build_ext",
"import os, sys",
"def find_file(filename, std_dirs, paths):\n \"\"\"Searches for the directory where a given file is located,\n and returns a possibly-empty list of additional di... |
"""Miscellaneous modules
Contains useful modules that don't belong into any of the
other Crypto.* subpackages.
Crypto.Util.number Number-theoretic functions (primality testing, etc.)
Crypto.Util.randpool Random number generation
Crypto.Util.RFC1751 Converts between 128-bit keys and human-readable
... | [
[
8,
0,
0.375,
0.6875,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.8125,
0.0625,
0,
0.66,
0.5,
272,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.9375,
0.0625,
0,
0.66,
... | [
"\"\"\"Miscellaneous modules\n\nContains useful modules that don't belong into any of the\nother Crypto.* subpackages.\n\nCrypto.Util.number Number-theoretic functions (primality testing, etc.)\nCrypto.Util.randpool Random number generation\nCrypto.Util.RFC1751 Converts between 128-bit keys and hu... |
import time
from Crypto.Util import number
# Test of prime-generation speed
# This randfunc is deterministic, so we should always find the same primes.
chars = ''.join(map(chr, range(255, 0, -1)))
def randfunc (N):
s = ''
while len(s)<N:
s += chars
return s[:N]
def main ():
for i in range(12... | [
[
1,
0,
0.0833,
0.0417,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.125,
0.0417,
0,
0.66,
0.2,
888,
0,
1,
0,
0,
888,
0,
0
],
[
14,
0,
0.3333,
0.0417,
0,
0.6... | [
"import time",
"from Crypto.Util import number",
"chars = ''.join(map(chr, range(255, 0, -1)))",
"def randfunc (N):\n s = ''\n while len(s)<N:\n s += chars\n return s[:N]",
" s = ''",
" while len(s)<N:\n s += chars",
" return s[:N]",
"def main ():\n for i in range(12... |
"""Secret-key encryption algorithms.
Secret-key encryption algorithms transform plaintext in some way that
is dependent on a key, producing ciphertext. This transformation can
easily be reversed, if (and, hopefully, only if) one knows the key.
The encryption modules here all support the interface described in PEP
272... | [
[
8,
0,
0.3788,
0.7273,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.8333,
0.1212,
0,
0.66,
0.5,
272,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.9394,
0.0303,
0,
0.66,
... | [
"\"\"\"Secret-key encryption algorithms.\n\nSecret-key encryption algorithms transform plaintext in some way that\nis dependent on a key, producing ciphertext. This transformation can\neasily be reversed, if (and, hopefully, only if) one knows the key.\n\nThe encryption modules here all support the interface descri... |
"""Cryptographic protocols
Implements various cryptographic protocols. (Don't expect to find
network protocols here.)
Crypto.Protocol.AllOrNothing Transforms a message into a set of message
blocks, such that the blocks can be
recombined to get the mess... | [
[
8,
0,
0.4706,
0.7647,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.9412,
0.0588,
0,
0.66,
0.5,
272,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
1,
0.0588,
0,
0.66,
1,... | [
"\"\"\"Cryptographic protocols\n\nImplements various cryptographic protocols. (Don't expect to find\nnetwork protocols here.)\n\nCrypto.Protocol.AllOrNothing Transforms a message into a set of message\n blocks, such that the blocks can be\n recombined t... |
#! /usr/bin/env python
__revision__ = "$Id: setup.py,v 1.30 2005/06/14 01:20:22 akuchling Exp $"
from distutils import core
from distutils.core import Extension
from distutils.command.build_ext import build_ext
import os, sys
if sys.version[0:1] == '1':
raise RuntimeError, ("The Python Cryptography Toolkit requi... | [
[
1,
0,
0.0094,
0.0094,
0,
0.66,
0,
901,
0,
1,
0,
0,
901,
0,
0
],
[
1,
0,
0.0189,
0.0094,
0,
0.66,
0.1667,
152,
0,
1,
0,
0,
152,
0,
0
],
[
1,
0,
0.0283,
0.0094,
0,
... | [
"from distutils import core",
"from distutils.core import Extension",
"from distutils.command.build_ext import build_ext",
"import os, sys",
"def find_file(filename, std_dirs, paths):\n \"\"\"Searches for the directory where a given file is located,\n and returns a possibly-empty list of additional di... |
#
# Test script for the Python Cryptography Toolkit.
#
__revision__ = "$Id: test.py,v 1.7 2002/07/11 14:31:19 akuchling Exp $"
import os, sys
# Add the build directory to the front of sys.path
from distutils.util import get_platform
s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
s = os.path.join(os.getcwd(... | [
[
14,
0,
0.1316,
0.0263,
0,
0.66,
0,
809,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1842,
0.0263,
0,
0.66,
0.0667,
688,
0,
2,
0,
0,
688,
0,
0
],
[
1,
0,
0.2895,
0.0263,
0,
0... | [
"__revision__ = \"$Id: test.py,v 1.7 2002/07/11 14:31:19 akuchling Exp $\"",
"import os, sys",
"from distutils.util import get_platform",
"s = \"build/lib.%s-%.3s\" % (get_platform(), sys.version)",
"s = os.path.join(os.getcwd(), s)",
"sys.path.insert(0, s)",
"s = os.path.join(os.getcwd(), 'test')",
"... |
"""Public-key encryption and signature algorithms.
Public-key encryption uses two different keys, one for encryption and
one for decryption. The encryption key can be made public, and the
decryption key is kept private. Many public-key algorithms can also
be used to sign messages, and some can *only* be used for sig... | [
[
8,
0,
0.4118,
0.7647,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.8824,
0.0588,
0,
0.66,
0.5,
272,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.9412,
0.0588,
0,
0.66,
... | [
"\"\"\"Public-key encryption and signature algorithms.\n\nPublic-key encryption uses two different keys, one for encryption and\none for decryption. The encryption key can be made public, and the\ndecryption key is kept private. Many public-key algorithms can also\nbe used to sign messages, and some can *only* be... |
#!/usr/bin/env python
# Script to time fast and slow RSA operations
# Contributed by Joris Bontje.
import time, pprint
from Crypto.PublicKey import *
from Crypto.Util.randpool import RandomPool
from Crypto.Util import number
pool = RandomPool()
pool.stir()
KEYSIZE=2048
COUNT=5
fasttime=0
slowtime=0
for x in range(C... | [
[
1,
0,
0.125,
0.0208,
0,
0.66,
0,
654,
0,
2,
0,
0,
654,
0,
0
],
[
1,
0,
0.1458,
0.0208,
0,
0.66,
0.0909,
956,
0,
1,
0,
0,
956,
0,
0
],
[
1,
0,
0.1667,
0.0208,
0,
0... | [
"import time, pprint",
"from Crypto.PublicKey import *",
"from Crypto.Util.randpool import RandomPool",
"from Crypto.Util import number",
"pool = RandomPool()",
"pool.stir()",
"KEYSIZE=2048",
"COUNT=5",
"fasttime=0",
"slowtime=0",
"for x in range(COUNT):\n begintime=time.time()\n rsa=RSA.g... |
#!/usr/bin/env python
# Script to time fast and slow RSA operations
# Contributed by Joris Bontje.
import time, pprint
from Crypto.PublicKey import *
from Crypto.Util.randpool import RandomPool
from Crypto.Util import number
pool = RandomPool()
pool.stir()
KEYSIZE=2048
COUNT=5
fasttime=0
slowtime=0
for x in range(C... | [
[
1,
0,
0.125,
0.0208,
0,
0.66,
0,
654,
0,
2,
0,
0,
654,
0,
0
],
[
1,
0,
0.1458,
0.0208,
0,
0.66,
0.0909,
956,
0,
1,
0,
0,
956,
0,
0
],
[
1,
0,
0.1667,
0.0208,
0,
0... | [
"import time, pprint",
"from Crypto.PublicKey import *",
"from Crypto.Util.randpool import RandomPool",
"from Crypto.Util import number",
"pool = RandomPool()",
"pool.stir()",
"KEYSIZE=2048",
"COUNT=5",
"fasttime=0",
"slowtime=0",
"for x in range(COUNT):\n begintime=time.time()\n rsa=RSA.g... |
# Just use the MD5 module from the Python standard library
__revision__ = "$Id: MD5.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $"
from md5 import *
import md5
if hasattr(md5, 'digestsize'):
digest_size = digestsize
del digestsize
del md5
| [
[
14,
0,
0.3077,
0.0769,
0,
0.66,
0,
809,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.4615,
0.0769,
0,
0.66,
0.3333,
604,
0,
1,
0,
0,
604,
0,
0
],
[
1,
0,
0.6154,
0.0769,
0,
0... | [
"__revision__ = \"$Id: MD5.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $\"",
"from md5 import *",
"import md5",
"if hasattr(md5, 'digestsize'):\n digest_size = digestsize\n del digestsize",
" digest_size = digestsize"
] |
"""HMAC (Keyed-Hashing for Message Authentication) Python module.
Implements the HMAC algorithm as described by RFC 2104.
This is just a copy of the Python 2.2 HMAC module, modified to work when
used on versions of Python before 2.2.
"""
__revision__ = "$Id: HMAC.py,v 1.5 2002/07/25 17:19:02 z3p Exp $"
import strin... | [
[
8,
0,
0.037,
0.0648,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0833,
0.0093,
0,
0.66,
0.1667,
809,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1019,
0.0093,
0,
0.66,
... | [
"\"\"\"HMAC (Keyed-Hashing for Message Authentication) Python module.\n\nImplements the HMAC algorithm as described by RFC 2104.\n\nThis is just a copy of the Python 2.2 HMAC module, modified to work when\nused on versions of Python before 2.2.\n\"\"\"",
"__revision__ = \"$Id: HMAC.py,v 1.5 2002/07/25 17:19:02 z3... |
# Just use the SHA module from the Python standard library
__revision__ = "$Id: SHA.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $"
from sha import *
import sha
if hasattr(sha, 'digestsize'):
digest_size = digestsize
del digestsize
del sha
| [
[
14,
0,
0.3636,
0.0909,
0,
0.66,
0,
809,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.5455,
0.0909,
0,
0.66,
0.3333,
263,
0,
1,
0,
0,
263,
0,
0
],
[
1,
0,
0.6364,
0.0909,
0,
0... | [
"__revision__ = \"$Id: SHA.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $\"",
"from sha import *",
"import sha",
"if hasattr(sha, 'digestsize'):\n digest_size = digestsize\n del digestsize",
" digest_size = digestsize"
] |
"""Hashing algorithms
Hash functions take arbitrary strings as input, and produce an output
of fixed size that is dependent on the input; it should never be
possible to derive the input data given only the hash function's
output. Hash functions can be used simply as a checksum, or, in
association with a public-key al... | [
[
8,
0,
0.4375,
0.8333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.9167,
0.0417,
0,
0.66,
0.5,
272,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.9583,
0.0417,
0,
0.66,
... | [
"\"\"\"Hashing algorithms\n\nHash functions take arbitrary strings as input, and produce an output\nof fixed size that is dependent on the input; it should never be\npossible to derive the input data given only the hash function's\noutput. Hash functions can be used simply as a checksum, or, in\nassociation with a... |
"""Python Cryptography Toolkit
A collection of cryptographic modules implementing various algorithms
and protocols.
Subpackages:
Crypto.Cipher Secret-key encryption algorithms (AES, DES, ARC4)
Crypto.Hash Hashing algorithms (MD5, SHA, HMAC)
Crypto.Protocol Cryptographic protocols ... | [
[
8,
0,
0.4,
0.68,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.8,
0.04,
0,
0.66,
0.3333,
272,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.88,
0.04,
0,
0.66,
0.6667,
... | [
"\"\"\"Python Cryptography Toolkit\n\nA collection of cryptographic modules implementing various algorithms\nand protocols.\n\nSubpackages:\nCrypto.Cipher Secret-key encryption algorithms (AES, DES, ARC4)\nCrypto.Hash Hashing algorithms (MD5, SHA, HMAC)",
"__all__ = ['Cipher', 'Hash', 'P... |
#
# testdata.py : Test data for the various algorithms
#
# Part of the Python Cryptography Toolkit
#
# Distribute and use freely; there are no restrictions on further
# dissemination and usage except those imposed by the laws of your
# country of residence. This software is provided "as is" without
# warranty of fitn... | [
[
14,
0,
0.0352,
0.0162,
0,
0.66,
0,
922,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.0558,
0.0162,
0,
0.66,
0.037,
290,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.0764,
0.0162,
0,
0.... | [
"md2= [\n (\"\", \"8350e5a3e24c153df2275c9f80692773\"),\n (\"a\", \"32ec01ec4a6dac72c0ab96fb34c0b5d1\"),\n (\"abc\", \"da853b0d3f88d99b30283a69e6ded6bb\"),\n (\"message digest\", \"ab4f496bfb2a530b219ff33031fe06b0\"),\n (\"abcdefghijklmnopqrstuvwxyz\", \"4e8ddff3650292ab5a4108c3aa47940b\"),\n ... |
#!/usr/bin/python
import code
import getpass
import sys
sys.path.append("/usr/local/google_appengine")
sys.path.append("/usr/local/google_appengine/lib/yaml/lib")
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.ext import db
def auth_func():
return raw_input('Username:'), getpas... | [
[
1,
0,
0.0833,
0.0417,
0,
0.66,
0,
44,
0,
1,
0,
0,
44,
0,
0
],
[
1,
0,
0.125,
0.0417,
0,
0.66,
0.0833,
784,
0,
1,
0,
0,
784,
0,
0
],
[
1,
0,
0.1667,
0.0417,
0,
0.6... | [
"import code",
"import getpass",
"import sys",
"sys.path.append(\"/usr/local/google_appengine\")",
"sys.path.append(\"/usr/local/google_appengine/lib/yaml/lib\")",
"from google.appengine.ext.remote_api import remote_api_stub",
"from google.appengine.ext import db",
"def auth_func():\n return raw_in... |
#!/usr/bin/python
import code
import getpass
import sys
sys.path.append("/usr/local/google_appengine")
sys.path.append("/usr/local/google_appengine/lib/yaml/lib")
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.ext import db
def auth_func():
return raw_input('Username:'), getpas... | [
[
1,
0,
0.0833,
0.0417,
0,
0.66,
0,
44,
0,
1,
0,
0,
44,
0,
0
],
[
1,
0,
0.125,
0.0417,
0,
0.66,
0.0833,
784,
0,
1,
0,
0,
784,
0,
0
],
[
1,
0,
0.1667,
0.0417,
0,
0.6... | [
"import code",
"import getpass",
"import sys",
"sys.path.append(\"/usr/local/google_appengine\")",
"sys.path.append(\"/usr/local/google_appengine/lib/yaml/lib\")",
"from google.appengine.ext.remote_api import remote_api_stub",
"from google.appengine.ext import db",
"def auth_func():\n return raw_in... |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | [
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0,
879,
0,
1,
0,
0,
879,
0,
0
],
[
7,
0,
0.5,
0.5455,
0,
0.66,
0.5,
0,
0,
1,
0,
0,
0,
0,
2
],
[
1,
1,
0.3636,
0.0909,
1,
0.1,
0... | [
"from django.core.management import execute_manager",
"try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run dj... |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from django.contrib import admin
from django.views.generic.base import *
import dbindexer
#from ragendja.urlsauto import urlpatterns
#from ragendja.auth.urls import urlpatterns as auth_patterns
from astoundlearning_app import views
handler500 = 'djangotoo... | [
[
1,
0,
0.0157,
0.0079,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0236,
0.0079,
0,
0.66,
0.1111,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.0315,
0.0079,
0,
... | [
"from django.conf.urls.defaults import *",
"from django.contrib import admin",
"from django.views.generic.base import *",
"import dbindexer",
"from astoundlearning_app import views",
"handler500 = 'djangotoolbox.errorviews.server_error'",
"admin.autodiscover()",
"dbindexer.autodiscover()",
"urlpatte... |
from __future__ import with_statement
from decimal import Decimal, InvalidOperation
import time
from django.core import serializers
from django.db import models
from django.db.models import Q
from django.db.models.signals import post_save
from django.db.utils import DatabaseError
from django.dispatch.dispatcher import... | [
[
1,
0,
0.0012,
0.0012,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0024,
0.0012,
0,
0.66,
0.02,
349,
0,
2,
0,
0,
349,
0,
0
],
[
1,
0,
0.0036,
0.0012,
0,
0.... | [
"from __future__ import with_statement",
"from decimal import Decimal, InvalidOperation",
"import time",
"from django.core import serializers",
"from django.db import models",
"from django.db.models import Q",
"from django.db.models.signals import post_save",
"from django.db.utils import DatabaseError... |
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse
from django.utils import simplejson
from django.utils.encoding import force_unicode
from django.utils.functional import Promise
class LazyEncoder(DjangoJSONEncoder):
def default(self, ... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0606,
0.0303,
0,
0.66,
0.125,
521,
0,
1,
0,
0,
521,
0,
0
],
[
1,
0,
0.0909,
0.0303,
0,
0... | [
"from django.conf import settings",
"from django.core.serializers.json import DjangoJSONEncoder",
"from django.http import HttpResponse",
"from django.utils import simplejson",
"from django.utils.encoding import force_unicode",
"from django.utils.functional import Promise",
"class LazyEncoder(DjangoJSON... |
# All fields except for BlobField written by Jonas Haag <jonas@lophus.org>
from django.core.exceptions import ValidationError
from django.utils.importlib import import_module
from django.db import models
from django.db.models.fields.subclassing import Creator
from django.db.utils import IntegrityError
from django.db.m... | [
[
1,
0,
0.0068,
0.0023,
0,
0.66,
0,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.009,
0.0023,
0,
0.66,
0.0667,
118,
0,
1,
0,
0,
118,
0,
0
],
[
1,
0,
0.0113,
0.0023,
0,
0... | [
"from django.core.exceptions import ValidationError",
"from django.utils.importlib import import_module",
"from django.db import models",
"from django.db.models.fields.subclassing import Creator",
"from django.db.utils import IntegrityError",
"from django.db.models.fields.related import add_lazy_relation"... |
from django.conf import settings
from django.http import HttpResponseRedirect
from django.utils.cache import patch_cache_control
LOGIN_REQUIRED_PREFIXES = getattr(settings, 'LOGIN_REQUIRED_PREFIXES', ())
NO_LOGIN_REQUIRED_PREFIXES = getattr(settings,
'NO_LOGIN_REQUIRED_PREFIXES', ... | [
[
1,
0,
0.0139,
0.0139,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0278,
0.0139,
0,
0.66,
0.1,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0417,
0.0139,
0,
0.6... | [
"from django.conf import settings",
"from django.http import HttpResponseRedirect",
"from django.utils.cache import patch_cache_control",
"LOGIN_REQUIRED_PREFIXES = getattr(settings, 'LOGIN_REQUIRED_PREFIXES', ())",
"NO_LOGIN_REQUIRED_PREFIXES = getattr(settings,\n 'NO_LO... |
from django.conf import settings
from django.core.cache import cache
from django.contrib.sites.models import Site
from djangotoolbox.utils import make_tls_property
_default_site_id = getattr(settings, 'SITE_ID', None)
SITE_ID = settings.__class__.SITE_ID = make_tls_property()
class DynamicSiteIDMiddleware(object):
... | [
[
1,
0,
0.0164,
0.0164,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0328,
0.0164,
0,
0.66,
0.1667,
734,
0,
1,
0,
0,
734,
0,
0
],
[
1,
0,
0.0492,
0.0164,
0,
... | [
"from django.conf import settings",
"from django.core.cache import cache",
"from django.contrib.sites.models import Site",
"from djangotoolbox.utils import make_tls_property",
"_default_site_id = getattr(settings, 'SITE_ID', None)",
"SITE_ID = settings.__class__.SITE_ID = make_tls_property()",
"class Dy... |
from django.test import TestCase
from django.utils.unittest import TextTestResult, TextTestRunner
try:
from django.test.runner import DiscoverRunner as TestRunner
except ImportError:
from django.test.simple import DjangoTestSuiteRunner as TestRunner
from .utils import object_list_to_table
import re
class M... | [
[
1,
0,
0.009,
0.009,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.018,
0.009,
0,
0.66,
0.1111,
270,
0,
2,
0,
0,
270,
0,
0
],
[
7,
0,
0.0495,
0.036,
0,
0.66,... | [
"from django.test import TestCase",
"from django.utils.unittest import TextTestResult, TextTestRunner",
"try:\n from django.test.runner import DiscoverRunner as TestRunner\nexcept ImportError:\n from django.test.simple import DjangoTestSuiteRunner as TestRunner",
" from django.test.runner import Disc... |
def make_tls_property(default=None):
"""
Creates a class-wide instance property with a thread-specific
value.
"""
class TLSProperty(object):
def __init__(self):
from threading import local
self.local = local()
def __get__(self, instance, cls):
i... | [
[
2,
0,
0.1355,
0.2617,
0,
0.66,
0,
317,
0,
1,
1,
0,
0,
0,
4
],
[
8,
1,
0.0327,
0.0374,
1,
0.69,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
1,
0.1542,
0.1869,
1,
0.69,
0... | [
"def make_tls_property(default=None):\n \"\"\"\n Creates a class-wide instance property with a thread-specific\n value.\n \"\"\"\n\n class TLSProperty(object):",
" \"\"\"\n Creates a class-wide instance property with a thread-specific\n value.\n \"\"\"",
" class TLSProperty(object)... |
from django import forms
from django.contrib import admin
from django.contrib.admin.sites import NotRegistered
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User, Group
class UserForm(forms.ModelForm):
class Meta:
model = User
fields = ('username', 'email'... | [
[
1,
0,
0.0323,
0.0323,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0645,
0.0323,
0,
0.66,
0.125,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.0968,
0.0323,
0,
0... | [
"from django import forms",
"from django.contrib import admin",
"from django.contrib.admin.sites import NotRegistered",
"from django.contrib.auth.admin import UserAdmin",
"from django.contrib.auth.models import User, Group",
"class UserForm(forms.ModelForm):\n\n class Meta:\n model = User\n ... |
from django.forms import widgets
from django.template.defaultfilters import filesizeformat
from django.utils.safestring import mark_safe
class BlobWidget(widgets.FileInput):
def render(self, name, value, attrs=None):
try:
blob_size = len(value)
except:
blob_size = 0
... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.125,
0.0625,
0,
0.66,
0.3333,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.1875,
0.0625,
0,
0... | [
"from django.forms import widgets",
"from django.template.defaultfilters import filesizeformat",
"from django.utils.safestring import mark_safe",
"class BlobWidget(widgets.FileInput):\n\n def render(self, name, value, attrs=None):\n try:\n blob_size = len(value)\n except:\n ... |
from django.db.backends.creation import BaseDatabaseCreation
class NonrelDatabaseCreation(BaseDatabaseCreation):
# "Types" used by database conversion methods to decide how to
# convert data for or from the database. Type is understood here
# a bit differently than in vanilla Django -- it should be read
... | [
[
1,
0,
0.0091,
0.0091,
0,
0.66,
0,
340,
0,
1,
0,
0,
340,
0,
0
],
[
3,
0,
0.5182,
0.9727,
0,
0.66,
1,
2,
0,
3,
0,
0,
484,
0,
2
],
[
14,
1,
0.3864,
0.5818,
1,
0.67,
... | [
"from django.db.backends.creation import BaseDatabaseCreation",
"class NonrelDatabaseCreation(BaseDatabaseCreation):\n\n # \"Types\" used by database conversion methods to decide how to\n # convert data for or from the database. Type is understood here\n # a bit differently than in vanilla Django -- it s... |
import datetime
import django
from django.conf import settings
from django.db.models.fields import NOT_PROVIDED
from django.db.models.query import QuerySet
from django.db.models.sql import aggregates as sqlaggregates
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.constants import MULTI... | [
[
1,
0,
0.0015,
0.0015,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0046,
0.0015,
0,
0.66,
0.0417,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0061,
0.0015,
0,
... | [
"import datetime",
"import django",
"from django.conf import settings",
"from django.db.models.fields import NOT_PROVIDED",
"from django.db.models.query import QuerySet",
"from django.db.models.sql import aggregates as sqlaggregates",
"from django.db.models.sql.compiler import SQLCompiler",
"from djan... |
from django.db.backends.util import format_number
def decimal_to_string(value, max_digits=16, decimal_places=0):
"""
Converts decimal to a unicode string for storage / lookup by nonrel
databases that don't support decimals natively.
This is an extension to `django.db.backends.util.format_number`
... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
446,
0,
1,
0,
0,
446,
0,
0
],
[
2,
0,
0.5606,
0.9091,
0,
0.66,
1,
466,
0,
3,
1,
0,
0,
0,
5
],
[
8,
1,
0.303,
0.3333,
1,
0.25,
... | [
"from django.db.backends.util import format_number",
"def decimal_to_string(value, max_digits=16, decimal_places=0):\n \"\"\"\n Converts decimal to a unicode string for storage / lookup by nonrel\n databases that don't support decimals natively.\n\n This is an extension to `django.db.backends.util.for... |
import cPickle as pickle
import datetime
from django.conf import settings
from django.db.backends import (
BaseDatabaseFeatures,
BaseDatabaseOperations,
BaseDatabaseWrapper,
BaseDatabaseClient,
BaseDatabaseValidation,
BaseDatabaseIntrospection)
from django.db.utils import DatabaseError
from dja... | [
[
1,
0,
0.0014,
0.0014,
0,
0.66,
0,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.0028,
0.0014,
0,
0.66,
0.0588,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0055,
0.0014,
0,
... | [
"import cPickle as pickle",
"import datetime",
"from django.conf import settings",
"from django.db.backends import (\n BaseDatabaseFeatures,\n BaseDatabaseOperations,\n BaseDatabaseWrapper,\n BaseDatabaseClient,\n BaseDatabaseValidation,\n BaseDatabaseIntrospection)",
"from django.db.utils... |
from django import http
from django.template import RequestContext, loader
def server_error(request, template_name='500.html'):
"""
500 error handler.
Templates: `500.html`
Context:
request_path
The path of the requested URL (e.g., '/app/pages/bad_page/')
"""
# You need t... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.1053,
0.0526,
0,
0.66,
0.5,
213,
0,
2,
0,
0,
213,
0,
0
],
[
2,
0,
0.6316,
0.7895,
0,
0.6... | [
"from django import http",
"from django.template import RequestContext, loader",
"def server_error(request, template_name='500.html'):\n \"\"\"\n 500 error handler.\n\n Templates: `500.html`\n Context:\n request_path\n The path of the requested URL (e.g., '/app/pages/bad_page/')",
... |
# -*- coding: utf-8 -*-
#from ragendja.settings_pre import *
from djangoappengine.settings_base import *
import logging
import os
#import cookie_based_session_storage_for_django
from djangoappengine.utils import on_production_server, have_appserver
GOOGLE_FRIEND_CONNECT_SITE_ID = '02335252261937609627'
GOOGLE_FRIEND_C... | [
[
1,
0,
0.0211,
0.007,
0,
0.66,
0,
423,
0,
1,
0,
0,
423,
0,
0
],
[
1,
0,
0.0282,
0.007,
0,
0.66,
0.0357,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0352,
0.007,
0,
0.6... | [
"from djangoappengine.settings_base import *",
"import logging",
"import os",
"from djangoappengine.utils import on_production_server, have_appserver",
"GOOGLE_FRIEND_CONNECT_SITE_ID = '02335252261937609627'",
"GOOGLE_FRIEND_CONNECT_CONSUMER_KEY = '*:02335252261937609627'",
"GOOGLE_FRIEND_CONNECT_CONSUM... |
"""
Forms and validation code for user registration.
"""
from django.contrib.auth.models import User
from django import forms
from django.utils.translation import ugettext_lazy as _
from registration.models import RegistrationProfile
# I put this on all required fields, because it's easier to pick up
# on them wit... | [
[
8,
0,
0.0184,
0.0294,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0441,
0.0074,
0,
0.66,
0.1111,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0515,
0.0074,
0,
0.66... | [
"\"\"\"\nForms and validation code for user registration.\n\n\"\"\"",
"from django.contrib.auth.models import User",
"from django import forms",
"from django.utils.translation import ugettext_lazy as _",
"from registration.models import RegistrationProfile",
"attrs_dict = { 'class': 'required' }",
"clas... |
import datetime
import random
import re
import sha
from google.appengine.ext import db
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.db import models
from django.template.loader import render_to_string
from django.utils.translatio... | [
[
1,
0,
0.0039,
0.0039,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0078,
0.0039,
0,
0.66,
0.0769,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0116,
0.0039,
0,
... | [
"import datetime",
"import random",
"import re",
"import sha",
"from google.appengine.ext import db",
"from django.conf import settings",
"from django.contrib.auth.models import User",
"from django.contrib.sites.models import Site",
"from django.db import models",
"from django.template.loader impo... |
"""
Unit tests for django-registration.
These tests assume that you've completed all the prerequisites for
getting django-registration running in the default setup, to wit:
1. You have ``registration`` in your ``INSTALLED_APPS`` setting.
2. You have created all of the templates mentioned in this
application's doc... | [
[
8,
0,
0.0292,
0.0557,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0613,
0.0028,
0,
0.66,
0.0625,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0641,
0.0028,
0,
0.66... | [
"\"\"\"\nUnit tests for django-registration.\n\nThese tests assume that you've completed all the prerequisites for\ngetting django-registration running in the default setup, to wit:\n\n1. You have ``registration`` in your ``INSTALLED_APPS`` setting.",
"import datetime",
"import sha",
"from django.conf import ... |
from django.dispatch import Signal
# A new user has registered.
user_registered = Signal(providing_args=["user"])
# A user has activated his or her account.
user_activated = Signal(providing_args=["user"])
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
548,
0,
1,
0,
0,
548,
0,
0
],
[
14,
0,
0.625,
0.125,
0,
0.66,
0.5,
929,
3,
1,
0,
0,
592,
10,
1
],
[
14,
0,
1,
0.125,
0,
0.66,
... | [
"from django.dispatch import Signal",
"user_registered = Signal(providing_args=[\"user\"])",
"user_activated = Signal(providing_args=[\"user\"])"
] |
"""
URLConf for Django user registration and authentication.
If the default behavior of the registration views is acceptable to
you, simply use a line like this in your root URLConf to set up the
default URLs for registration::
(r'^accounts/', include('registration.urls')),
This will also automatically set up th... | [
[
8,
0,
0.1479,
0.2817,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3239,
0.0141,
0,
0.66,
0.1667,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.338,
0.0141,
0,
0.66,... | [
"\"\"\"\nURLConf for Django user registration and authentication.\n\nIf the default behavior of the registration views is acceptable to\nyou, simply use a line like this in your root URLConf to set up the\ndefault URLs for registration::\n\n (r'^accounts/', include('registration.urls')),",
"from django.conf.ur... |
from ragendja.settings_post import *
try:
ACCOUNT_ACTIVATION_DAYS
except:
ACCOUNT_ACTIVATION_DAYS = 30
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
898,
0,
1,
0,
0,
898,
0,
0
],
[
7,
0,
0.75,
0.6667,
0,
0.66,
1,
0,
0,
1,
0,
0,
0,
0,
0
],
[
8,
1,
0.6667,
0.1667,
1,
0.61,
0... | [
"from ragendja.settings_post import *",
"try:\n ACCOUNT_ACTIVATION_DAYS\nexcept:\n ACCOUNT_ACTIVATION_DAYS = 30",
" ACCOUNT_ACTIVATION_DAYS",
" ACCOUNT_ACTIVATION_DAYS = 30"
] |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^account/', include('registration.urls')),
)
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.8,
0.6,
0,
0.66,
1,
990,
3,
2,
0,
0,
75,
10,
2
]
] | [
"from django.conf.urls.defaults import *",
"urlpatterns = patterns('',\n (r'^account/', include('registration.urls')),\n)"
] |
from django.contrib import admin
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
search_fields = ('user__username', 'user__first_name')
admin.site.register(RegistrationProfile, RegistrationAdmin)
| [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.2727,
0.0909,
0,
0.66,
0.3333,
103,
0,
1,
0,
0,
103,
0,
0
],
[
3,
0,
0.6364,
0.2727,
0,
... | [
"from django.contrib import admin",
"from registration.models import RegistrationProfile",
"class RegistrationAdmin(admin.ModelAdmin):\n list_display = ('__unicode__', 'activation_key_expired')\n search_fields = ('user__username', 'user__first_name')",
" list_display = ('__unicode__', 'activation_key... |
"""
A management command which deletes expired accounts (e.g.,
accounts which signed up but never activated) from the database.
Calls ``RegistrationProfile.objects.delete_expired_users()``, which
contains the actual logic for determining which accounts are deleted.
"""
from django.core.management.base import NoArgsC... | [
[
8,
0,
0.2368,
0.4211,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.5263,
0.0526,
0,
0.66,
0.3333,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.6316,
0.0526,
0,
0.66... | [
"\"\"\"\nA management command which deletes expired accounts (e.g.,\naccounts which signed up but never activated) from the database.\n\nCalls ``RegistrationProfile.objects.delete_expired_users()``, which\ncontains the actual logic for determining which accounts are deleted.\n\n\"\"\"",
"from django.core.manageme... |
"""
Views which allow users to create and activate accounts.
"""
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from registration.forms import Registr... | [
[
8,
0,
0.0163,
0.0261,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0392,
0.0065,
0,
0.66,
0.1111,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0458,
0.0065,
0,
0.66... | [
"\"\"\"\nViews which allow users to create and activate accounts.\n\n\"\"\"",
"from django.conf import settings",
"from django.core.urlresolvers import reverse",
"from django.http import HttpResponseRedirect",
"from django.shortcuts import render_to_response",
"from django.template import RequestContext",... |
import re
import cgi
re_string = re.compile(r'(?P<htmlchars>[<&>])|(?P<space>^[ \t]+)|(?P<lineend>\r\n|\r|\n)|(?P<protocal>(^|\s)((http|ftp)://.*?))(\s|$)', re.S|re.M|re.I)
def plaintext2html(text, tabstop=4):
def do_sub(m):
c = m.groupdict()
if c['htmlchars']:
return cgi.escape... | [
[
1,
0,
0.0345,
0.0345,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.069,
0.0345,
0,
0.66,
0.3333,
934,
0,
1,
0,
0,
934,
0,
0
],
[
14,
0,
0.1379,
0.0345,
0,
... | [
"import re",
"import cgi",
"re_string = re.compile(r'(?P<htmlchars>[<&>])|(?P<space>^[ \\t]+)|(?P<lineend>\\r\\n|\\r|\\n)|(?P<protocal>(^|\\s)((http|ftp)://.*?))(\\s|$)', re.S|re.M|re.I)",
"def plaintext2html(text, tabstop=4):\n def do_sub(m):\n c = m.groupdict()\n if c['htmlchars']:\n ... |
# Load the siteconf module
from django.conf import settings
from django.utils.importlib import import_module
SITECONF_MODULE = getattr(settings, 'AUTOLOAD_SITECONF', settings.ROOT_URLCONF)
import_module(SITECONF_MODULE)
| [
[
1,
0,
0.4,
0.2,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.6,
0.2,
0,
0.66,
0.3333,
118,
0,
1,
0,
0,
118,
0,
0
],
[
14,
0,
0.8,
0.2,
0,
0.66,
0.6667,... | [
"from django.conf import settings",
"from django.utils.importlib import import_module",
"SITECONF_MODULE = getattr(settings, 'AUTOLOAD_SITECONF', settings.ROOT_URLCONF)",
"import_module(SITECONF_MODULE)"
] |
from django.utils.importlib import import_module
from django.conf import settings
# load all models.py to ensure signal handling installation or index loading
# of some apps
for app in settings.INSTALLED_APPS:
try:
import_module('%s.models' % (app))
except ImportError:
pass
class AutoloadMidd... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
118,
0,
1,
0,
0,
118,
0,
0
],
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0.3333,
128,
0,
1,
0,
0,
128,
0,
0
],
[
6,
0,
0.5714,
0.3571,
0,
... | [
"from django.utils.importlib import import_module",
"from django.conf import settings",
"for app in settings.INSTALLED_APPS:\n try:\n import_module('%s.models' % (app))\n except ImportError:\n pass",
" try:\n import_module('%s.models' % (app))\n except ImportError:\n pa... |
def autodiscover(module_name):
"""
Automatically loads modules specified by module_name for each app in
installed apps.
"""
from django.conf import settings
from django.utils.importlib import import_module
from django.utils.module_loading import module_has_submodule
for app in settings.... | [
[
2,
0,
0.525,
1,
0,
0.66,
0,
798,
0,
1,
0,
0,
0,
0,
3
],
[
8,
1,
0.175,
0.2,
1,
0.06,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
1,
0.3,
0.05,
1,
0.06,
0.25,
128,
... | [
"def autodiscover(module_name):\n \"\"\"\n Automatically loads modules specified by module_name for each app in\n installed apps.\n \"\"\"\n from django.conf import settings\n from django.utils.importlib import import_module\n from django.utils.module_loading import module_has_submodule",
" ... |
import settings
def all(request):
return {
'baseURL': 'http://' + request.get_host(),
'environment': settings.ENVIRONMENT,
'FACEBOOK_API_KEY': settings.FACEBOOK_API_KEY,
'GOOGLE_FRIEND_CONNECT_SITE_ID': settings.GOOGLE_FRIEND_CONNECT_SITE_ID
}
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
168,
0,
1,
0,
0,
168,
0,
0
],
[
2,
0,
0.625,
0.875,
0,
0.66,
1,
895,
0,
1,
1,
0,
0,
0,
1
],
[
13,
1,
0.6875,
0.75,
1,
0.85,
0,... | [
"import settings",
"def all(request):\n return {\n\t 'baseURL': 'http://' + request.get_host(), \n\t 'environment': settings.ENVIRONMENT, \n\t 'FACEBOOK_API_KEY': settings.FACEBOOK_API_KEY,\n\t 'GOOGLE_FRIEND_CONNECT_SITE_ID': settings.GOOGLE_FRIEND_CONNECT_SITE_ID\n\t }",
" return {\n\t ... |
from google.appengine.ext import db
from google.appengine.api import memcache
from django.utils import simplejson
import logging
class CustomUser(db.Model):
class Meta:
db_table = 'CustomUser'
isSocial = db.BooleanProperty(default = False)
viewerID = db.StringProperty(default = '')
consumerKey = db.StringProperty... | [
[
1,
0,
0.003,
0.003,
0,
0.66,
0,
167,
0,
1,
0,
0,
167,
0,
0
],
[
1,
0,
0.0059,
0.003,
0,
0.66,
0.0667,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.0089,
0.003,
0,
0.66... | [
"from google.appengine.ext import db",
"from google.appengine.api import memcache",
"from django.utils import simplejson",
"import logging",
"class CustomUser(db.Model):\n\tclass Meta:\n\t\tdb_table = 'CustomUser'\n\tisSocial = db.BooleanProperty(default = False)\n\tviewerID = db.StringProperty(default = ''... |
import cgi
import urllib
import time
import random
import urlparse
import hmac
import binascii
VERSION = '1.0' # Hi Blaine!
HTTP_METHOD = 'GET'
SIGNATURE_METHOD = 'PLAINTEXT'
# Generic exception class
class OAuthError(RuntimeError):
def __init__(self, message='OAuth error occured.'):
self.message = messag... | [
[
1,
0,
0.0019,
0.0019,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.0037,
0.0019,
0,
0.66,
0.0417,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0056,
0.0019,
0,
... | [
"import cgi",
"import urllib",
"import time",
"import random",
"import urlparse",
"import hmac",
"import binascii",
"VERSION = '1.0' # Hi Blaine!",
"HTTP_METHOD = 'GET'",
"SIGNATURE_METHOD = 'PLAINTEXT'",
"class OAuthError(RuntimeError):\n def __init__(self, message='OAuth error occured.'):\n... |
#!/usr/bin/python
# This code is original from jsmin by Douglas Crockford, it was translated to
# Python by Baruch Even. The original code had the following copyright and
# license.
#
# /* jsmin.c
# 2007-05-22
#
# Copyright (c) 2002 Douglas Crockford (www.crockford.com)
#
# Permission is hereby granted,... | [
[
1,
0,
0.1514,
0.0046,
0,
0.66,
0,
609,
0,
1,
0,
0,
609,
0,
0
],
[
2,
0,
0.1766,
0.0367,
0,
0.66,
0.1429,
275,
0,
1,
1,
0,
0,
0,
6
],
[
14,
1,
0.1651,
0.0046,
1,
0... | [
"from StringIO import StringIO",
"def jsmin(js):\n ins = StringIO(js)\n outs = StringIO()\n JavascriptMinify().minify(ins, outs)\n str = outs.getvalue()\n if len(str) > 0 and str[0] == '\\n':\n str = str[1:]\n return str",
" ins = StringIO(js)",
" outs = StringIO()",
" Java... |
#!/usr/bin/python
# This code is original from jsmin by Douglas Crockford, it was translated to
# Python by Baruch Even. The original code had the following copyright and
# license.
#
# /* jsmin.c
# 2007-05-22
#
# Copyright (c) 2002 Douglas Crockford (www.crockford.com)
#
# Permission is hereby granted,... | [
[
1,
0,
0.1514,
0.0046,
0,
0.66,
0,
609,
0,
1,
0,
0,
609,
0,
0
],
[
2,
0,
0.1766,
0.0367,
0,
0.66,
0.1429,
275,
0,
1,
1,
0,
0,
0,
6
],
[
14,
1,
0.1651,
0.0046,
1,
0... | [
"from StringIO import StringIO",
"def jsmin(js):\n ins = StringIO(js)\n outs = StringIO()\n JavascriptMinify().minify(ins, outs)\n str = outs.getvalue()\n if len(str) > 0 and str[0] == '\\n':\n str = str[1:]\n return str",
" ins = StringIO(js)",
" outs = StringIO()",
" Java... |
import cgi, urllib, logging
from django.utils import simplejson
from google.appengine.api import urlfetch
class BitLy():
def __init__(self, login, apikey):
self.login = login
self.apikey = apikey
def shorten(self,longUrl):
longUrl = urllib.quote_plus(longUrl)
request = "http://api.bit.ly/v3/shorten?longUrl=... | [
[
1,
0,
0.04,
0.04,
0,
0.66,
0,
934,
0,
3,
0,
0,
934,
0,
0
],
[
1,
0,
0.08,
0.04,
0,
0.66,
0.3333,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.12,
0.04,
0,
0.66,
0.... | [
"import cgi, urllib, logging",
"from django.utils import simplejson",
"from google.appengine.api import urlfetch",
"class BitLy():\n\tdef __init__(self, login, apikey):\n\t\tself.login = login\n\t\tself.apikey = apikey\n\n\tdef shorten(self,longUrl):\n\t\tlongUrl = urllib.quote_plus(longUrl)\n\t\trequest = \"... |
from django.shortcuts import render_to_response, redirect
from django.template.loader import get_template
from django.template import Context, Template, RequestContext
from django.http import HttpResponse
from django.utils import simplejson
from django.utils.decorators import decorator_from_middleware
from django.core ... | [
[
1,
0,
0.0006,
0.0006,
0,
0.66,
0,
852,
0,
2,
0,
0,
852,
0,
0
],
[
1,
0,
0.0011,
0.0006,
0,
0.66,
0.0091,
970,
0,
1,
0,
0,
970,
0,
0
],
[
1,
0,
0.0017,
0.0006,
0,
... | [
"from django.shortcuts import render_to_response, redirect",
"from django.template.loader import get_template",
"from django.template import Context, Template, RequestContext",
"from django.http import HttpResponse",
"from django.utils import simplejson",
"from django.utils.decorators import decorator_fro... |
import logging
import pickle
import cPickle
from google.appengine.api import users
from google.appengine.api import memcache
from google.appengine.api import mail
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
import os
import re
imp... | [
[
1,
0,
0.0035,
0.0035,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.007,
0.0035,
0,
0.66,
0.0357,
848,
0,
1,
0,
0,
848,
0,
0
],
[
1,
0,
0.0105,
0.0035,
0,
0... | [
"import logging",
"import pickle",
"import cPickle",
"from google.appengine.api import users",
"from google.appengine.api import memcache",
"from google.appengine.api import mail",
"from google.appengine.ext import webapp",
"from google.appengine.ext.webapp.util import run_wsgi_app",
"from google.ap... |
from astoundlearning_app.models import StudySet, SetEntry
from google.appengine.ext import db
# This script is for manipulating the data on the live GAE datastore via the remote_api.
# If we need to manipulate the data on live GAE datastore, modify this script, and execute it:
# python manage.py shell --remote
# impor... | [
[
1,
0,
0.0357,
0.0357,
0,
0.66,
0,
376,
0,
2,
0,
0,
376,
0,
0
],
[
1,
0,
0.0714,
0.0357,
0,
0.66,
0.5,
167,
0,
1,
0,
0,
167,
0,
0
],
[
2,
0,
0.6786,
0.6786,
0,
0.6... | [
"from astoundlearning_app.models import StudySet, SetEntry",
"from google.appengine.ext import db",
"def run_remote_job():\n\tall_decks = StudySet.all().fetch(1000)\n\tdeck_count = 0\n\tentry_count = 0\n\tfor deck in all_decks:\n\t\tdeck_count = deck_count + 1\n\t\tentries_t = SetEntry.all().filter('set =', dec... |
from __future__ import unicode_literals
import datetime
import os
import re
import sys
import types
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.http import (HttpResponse, HttpResponseServerError,
HttpResponseNotFound, HttpRequest, build_request_repr)
from d... | [
[
1,
0,
0.0009,
0.0009,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0027,
0.0009,
0,
0.66,
0.0323,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0036,
0.0009,
0,
... | [
"from __future__ import unicode_literals",
"import datetime",
"import os",
"import re",
"import sys",
"import types",
"from django.conf import settings",
"from django.core.exceptions import ImproperlyConfigured",
"from django.http import (HttpResponse, HttpResponseServerError,\n HttpResponseNotFo... |
"""
Decorators for views based on HTTP headers.
"""
import logging
from calendar import timegm
from functools import wraps
from django.utils.decorators import decorator_from_middleware, available_attrs
from django.utils.http import http_date, parse_http_date_safe, parse_etags, quote_etag
from django.middleware.http i... | [
[
8,
0,
0.012,
0.0181,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0301,
0.006,
0,
0.66,
0.0526,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0361,
0.006,
0,
0.66,
... | [
"\"\"\"\nDecorators for views based on HTTP headers.\n\"\"\"",
"import logging",
"from calendar import timegm",
"from functools import wraps",
"from django.utils.decorators import decorator_from_middleware, available_attrs",
"from django.utils.http import http_date, parse_http_date_safe, parse_etags, quot... |
import functools
from django.http import HttpRequest
def sensitive_variables(*variables):
"""
Indicates which variables used in the decorated function are sensitive, so
that those variables can later be treated in a special way, for example
by hiding them when logging unhandled exceptions.
Two f... | [
[
1,
0,
0.013,
0.013,
0,
0.66,
0,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
0,
0.039,
0.013,
0,
0.66,
0.3333,
779,
0,
1,
0,
0,
779,
0,
0
],
[
2,
0,
0.2857,
0.4286,
0,
0.66... | [
"import functools",
"from django.http import HttpRequest",
"def sensitive_variables(*variables):\n \"\"\"\n Indicates which variables used in the decorated function are sensitive, so\n that those variables can later be treated in a special way, for example\n by hiding them when logging unhandled exc... |
from functools import wraps
from django.utils.cache import patch_vary_headers
from django.utils.decorators import available_attrs
def vary_on_headers(*headers):
"""
A view decorator that adds the specified headers to the Vary header of the
response. Usage:
@vary_on_headers('Cookie', 'Accept-languag... | [
[
1,
0,
0.0256,
0.0256,
0,
0.66,
0,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
0,
0.0513,
0.0256,
0,
0.66,
0.25,
53,
0,
1,
0,
0,
53,
0,
0
],
[
1,
0,
0.0769,
0.0256,
0,
0.66... | [
"from functools import wraps",
"from django.utils.cache import patch_vary_headers",
"from django.utils.decorators import available_attrs",
"def vary_on_headers(*headers):\n \"\"\"\n A view decorator that adds the specified headers to the Vary header of the\n response. Usage:\n\n @vary_on_header... |
from django.utils.decorators import decorator_from_middleware
from django.middleware.gzip import GZipMiddleware
gzip_page = decorator_from_middleware(GZipMiddleware)
gzip_page.__doc__ = "Decorator for views that gzips pages if the client supports it."
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
532,
0,
1,
0,
0,
532,
0,
0
],
[
1,
0,
0.4,
0.2,
0,
0.66,
0.3333,
282,
0,
1,
0,
0,
282,
0,
0
],
[
14,
0,
0.8,
0.2,
0,
0.66,
0.6667,... | [
"from django.utils.decorators import decorator_from_middleware",
"from django.middleware.gzip import GZipMiddleware",
"gzip_page = decorator_from_middleware(GZipMiddleware)",
"gzip_page.__doc__ = \"Decorator for views that gzips pages if the client supports it.\""
] |
import warnings
from django.middleware.csrf import CsrfViewMiddleware, get_token
from django.utils.decorators import decorator_from_middleware, available_attrs
from functools import wraps
csrf_protect = decorator_from_middleware(CsrfViewMiddleware)
csrf_protect.__name__ = "csrf_protect"
csrf_protect.__doc__ = """
Thi... | [
[
1,
0,
0.0127,
0.0127,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.038,
0.0127,
0,
0.66,
0.0588,
574,
0,
2,
0,
0,
574,
0,
0
],
[
1,
0,
0.0506,
0.0127,
0,
0... | [
"import warnings",
"from django.middleware.csrf import CsrfViewMiddleware, get_token",
"from django.utils.decorators import decorator_from_middleware, available_attrs",
"from functools import wraps",
"csrf_protect = decorator_from_middleware(CsrfViewMiddleware)",
"csrf_protect.__name__ = \"csrf_protect\""... |
from functools import wraps
from django.utils.decorators import available_attrs
def xframe_options_deny(view_func):
"""
Modifies a view function so its response has the X-Frame-Options HTTP
header set to 'DENY' as long as the response doesn't already have that
header set.
e.g.
@xframe_optio... | [
[
1,
0,
0.0156,
0.0156,
0,
0.66,
0,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
0,
0.0469,
0.0156,
0,
0.66,
0.25,
532,
0,
1,
0,
0,
532,
0,
0
],
[
2,
0,
0.2344,
0.2969,
0,
0.... | [
"from functools import wraps",
"from django.utils.decorators import available_attrs",
"def xframe_options_deny(view_func):\n \"\"\"\n Modifies a view function so its response has the X-Frame-Options HTTP\n header set to 'DENY' as long as the response doesn't already have that\n header set.\n\n e.... |
from functools import wraps
from django.utils.decorators import decorator_from_middleware_with_args, available_attrs
from django.utils.cache import patch_cache_control, add_never_cache_headers
from django.middleware.cache import CacheMiddleware
def cache_page(*args, **kwargs):
"""
Decorator for views that tri... | [
[
1,
0,
0.0109,
0.0109,
0,
0.66,
0,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
0,
0.0217,
0.0109,
0,
0.66,
0.1667,
532,
0,
2,
0,
0,
532,
0,
0
],
[
1,
0,
0.0326,
0.0109,
0,
... | [
"from functools import wraps",
"from django.utils.decorators import decorator_from_middleware_with_args, available_attrs",
"from django.utils.cache import patch_cache_control, add_never_cache_headers",
"from django.middleware.cache import CacheMiddleware",
"def cache_page(*args, **kwargs):\n \"\"\"\n ... |
"""
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
from __future__ import unicode_literals
import mimetypes
import os
import stat
import posixpath
import re
try:
from urllib.parse import unquote
except ImportError: ... | [
[
8,
0,
0.0172,
0.0276,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0345,
0.0069,
0,
0.66,
0.0625,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0483,
0.0069,
0,
0.66... | [
"\"\"\"\nViews and functions for serving static files. These are only to be used\nduring development, and SHOULD NOT be used in a production setting.\n\"\"\"",
"from __future__ import unicode_literals",
"import mimetypes",
"import os",
"import stat",
"import posixpath",
"import re",
"try:\n from ur... |
from django.http import HttpResponseForbidden
from django.template import Context, Template
from django.conf import settings
# We include the template inline since we need to be able to reliably display
# this error message, especially for the sake of developers, and there isn't any
# other way of making it available ... | [
[
1,
0,
0.0096,
0.0096,
0,
0.66,
0,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0192,
0.0096,
0,
0.66,
0.25,
213,
0,
2,
0,
0,
213,
0,
0
],
[
1,
0,
0.0288,
0.0096,
0,
0.... | [
"from django.http import HttpResponseForbidden",
"from django.template import Context, Template",
"from django.conf import settings",
"CSRF_FAILURE_TEMPLATE = \"\"\"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n <meta name=\"robots\"... |
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.util... | [
[
1,
0,
0.0013,
0.0013,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0038,
0.0013,
0,
0.66,
0.0286,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0051,
0.0013,
0,
... | [
"from __future__ import unicode_literals",
"import datetime",
"from django.conf import settings",
"from django.db import models",
"from django.core.exceptions import ImproperlyConfigured",
"from django.http import Http404",
"from django.utils.encoding import force_text",
"from django.utils.functional ... |
from __future__ import unicode_literals
from django.core.paginator import Paginator, InvalidPage
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
c... | [
[
1,
0,
0.0057,
0.0057,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.017,
0.0057,
0,
0.66,
0.1111,
831,
0,
2,
0,
0,
831,
0,
0
],
[
1,
0,
0.0227,
0.0057,
0,
0... | [
"from __future__ import unicode_literals",
"from django.core.paginator import Paginator, InvalidPage",
"from django.core.exceptions import ImproperlyConfigured",
"from django.http import Http404",
"from django.utils.translation import ugettext as _",
"from django.views.generic.base import TemplateResponse... |
from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.db import models
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
class Sin... | [
[
1,
0,
0.0061,
0.0061,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0182,
0.0061,
0,
0.66,
0.1111,
160,
0,
2,
0,
0,
160,
0,
0
],
[
1,
0,
0.0242,
0.0061,
0,
... | [
"from __future__ import unicode_literals",
"from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist",
"from django.db import models",
"from django.http import Http404",
"from django.utils.translation import ugettext as _",
"from django.views.generic.base import TemplateResponseMixin, C... |
from django.forms import models as model_forms
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.utils.encoding import force_text
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
from django.views.generic.detail import (Single... | [
[
1,
0,
0.0037,
0.0037,
0,
0.66,
0,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.0073,
0.0037,
0,
0.66,
0.0588,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.011,
0.0037,
0,
0... | [
"from django.forms import models as model_forms",
"from django.core.exceptions import ImproperlyConfigured",
"from django.http import HttpResponseRedirect",
"from django.utils.encoding import force_text",
"from django.views.generic.base import TemplateResponseMixin, ContextMixin, View",
"from django.views... |
from __future__ import unicode_literals
import logging
from functools import update_wrapper
from django import http
from django.core.exceptions import ImproperlyConfigured
from django.template.response import TemplateResponse
from django.utils.decorators import classonlymethod
from django.utils import six
logger = l... | [
[
1,
0,
0.0048,
0.0048,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0144,
0.0048,
0,
0.66,
0.0769,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0192,
0.0048,
0,
... | [
"from __future__ import unicode_literals",
"import logging",
"from functools import update_wrapper",
"from django import http",
"from django.core.exceptions import ImproperlyConfigured",
"from django.template.response import TemplateResponse",
"from django.utils.decorators import classonlymethod",
"fr... |
from django.views.generic.base import View, TemplateView, RedirectView
from django.views.generic.dates import (ArchiveIndexView, YearArchiveView, MonthArchiveView,
WeekArchiveView, DayArchiveView, TodayArchiveView,
DateDetailView)
from django.vie... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
48,
0,
3,
0,
0,
48,
0,
0
],
[
1,
0,
0.25,
0.25,
0,
0.66,
0.2,
718,
0,
7,
0,
0,
718,
0,
0
],
[
1,
0,
0.4167,
0.0833,
0,
0.66,
... | [
"from django.views.generic.base import View, TemplateView, RedirectView",
"from django.views.generic.dates import (ArchiveIndexView, YearArchiveView, MonthArchiveView,\n WeekArchiveView, DayArchiveView, TodayArchiveView,\n DateDetailView)",
... |
from django import http
from django.template import (Context, RequestContext,
loader, Template, TemplateDoesNotExist)
from django.views.decorators.csrf import requires_csrf_token
# This can be called when CsrfViewMiddleware.process_view has not run,
# therefore need @requires_csrf_token i... | [
[
1,
0,
0.0135,
0.0135,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0338,
0.027,
0,
0.66,
0.1667,
213,
0,
5,
0,
0,
213,
0,
0
],
[
1,
0,
0.0541,
0.0135,
0,
0... | [
"from django import http",
"from django.template import (Context, RequestContext,\n loader, Template, TemplateDoesNotExist)",
"from django.views.decorators.csrf import requires_csrf_token",
"def page_not_found(request, template_name='404.html'):\n \"\"\"\n Default 404 handler... |
import os
import gettext as gettext_module
from django import http
from django.conf import settings
from django.utils import importlib
from django.utils.translation import check_for_language, activate, to_locale, get_language
from django.utils.text import javascript_quote
from django.utils.encoding import smart_text
f... | [
[
1,
0,
0.0035,
0.0035,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.007,
0.0035,
0,
0.66,
0.0435,
723,
0,
1,
0,
0,
723,
0,
0
],
[
1,
0,
0.0141,
0.0035,
0,
0... | [
"import os",
"import gettext as gettext_module",
"from django import http",
"from django.conf import settings",
"from django.utils import importlib",
"from django.utils.translation import check_for_language, activate, to_locale, get_language",
"from django.utils.text import javascript_quote",
"from dj... |
"""
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
import warnings
from django.template import loader, RequestContext
from django.http import HttpResponse, Http404
from django.http i... | [
[
8,
0,
0.0186,
0.0311,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0373,
0.0062,
0,
0.66,
0.0667,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0497,
0.0062,
0,
0.66... | [
"\"\"\"\nThis module collects helper functions and classes that \"span\" multiple levels\nof MVC. In other words, these functions/classes introduce controlled coupling\nfor convenience's sake.\n\"\"\"",
"import warnings",
"from django.template import loader, RequestContext",
"from django.http import HttpRespo... |
"""Multi-consumer multi-producer dispatching mechanism
Originally based on pydispatch (BSD) http://pypi.python.org/pypi/PyDispatcher/2.0.1
See license.txt for original license.
Heavily modified for Django's purposes.
"""
from django.dispatch.dispatcher import Signal, receiver | [
[
8,
0,
0.4444,
0.7778,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
1,
0.1111,
0,
0.66,
1,
819,
0,
2,
0,
0,
819,
0,
0
]
] | [
"\"\"\"Multi-consumer multi-producer dispatching mechanism\n\nOriginally based on pydispatch (BSD) http://pypi.python.org/pypi/PyDispatcher/2.0.1\nSee license.txt for original license.\n\nHeavily modified for Django's purposes.\n\"\"\"",
"from django.dispatch.dispatcher import Signal, receiver"
] |
import weakref
import threading
from django.dispatch import saferef
from django.utils.six.moves import xrange
WEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref)
def _make_id(target):
if hasattr(target, '__func__'):
return (id(target.__self__), id(target.__func__))
return id(target)
... | [
[
1,
0,
0.0037,
0.0037,
0,
0.66,
0,
708,
0,
1,
0,
0,
708,
0,
0
],
[
1,
0,
0.0073,
0.0037,
0,
0.66,
0.1429,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0147,
0.0037,
0,
0.... | [
"import weakref",
"import threading",
"from django.dispatch import saferef",
"from django.utils.six.moves import xrange",
"WEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref)",
"def _make_id(target):\n if hasattr(target, '__func__'):\n return (id(target.__self__), id(target.__fun... |
"""
"Safe weakrefs", originally from pyDispatcher.
Provides a way to safely weakref any function, including bound methods (which
aren't handled by the core weakref module).
"""
import traceback
import weakref
def safeRef(target, onDelete = None):
"""Return a *safe* weak reference to a callable target
target... | [
[
8,
0,
0.0136,
0.0233,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0311,
0.0039,
0,
0.66,
0.1667,
423,
0,
1,
0,
0,
423,
0,
0
],
[
1,
0,
0.035,
0.0039,
0,
0.66,... | [
"\"\"\"\n\"Safe weakrefs\", originally from pyDispatcher.\n\nProvides a way to safely weakref any function, including bound methods (which\naren't handled by the core weakref module).\n\"\"\"",
"import traceback",
"import weakref",
"def safeRef(target, onDelete = None):\n \"\"\"Return a *safe* weak referen... |
"""
Common checksum routines (used in multiple localflavor/ cases, for example).
"""
__all__ = ['luhn',]
from django.utils import six
LUHN_ODD_LOOKUP = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9) # sum_of_digits(index * 2)
def luhn(candidate):
"""
Checks a candidate number for validity according to the Luhn
algorith... | [
[
8,
0,
0.0833,
0.125,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2083,
0.0417,
0,
0.66,
0.25,
272,
0,
0,
0,
0,
0,
5,
0
],
[
1,
0,
0.2917,
0.0417,
0,
0.66,
... | [
"\"\"\"\nCommon checksum routines (used in multiple localflavor/ cases, for example).\n\"\"\"",
"__all__ = ['luhn',]",
"from django.utils import six",
"LUHN_ODD_LOOKUP = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9) # sum_of_digits(index * 2)",
"def luhn(candidate):\n \"\"\"\n Checks a candidate number for validity ... |
"Commonly-used date structures"
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
WEEKDAYS = {
0:_('Monday'), 1:_('Tuesday'), 2:_('Wednesday'), 3:_('Thursday'), 4:_('Friday'),
5:_('Saturday'), 6:_('Sunday')
}
WEEKDAYS_ABBR = {
0:_('Mon'), 1:_('Tue'), 2:_('Wed'), 3:_('Thu'), 4:_('Fri')... | [
[
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.1111,
389,
0,
2,
0,
0,
389,
0,
0
],
[
14,
0,
0.114,
0.0702,
0,
0.66... | [
"\"Commonly-used date structures\"",
"from django.utils.translation import ugettext_lazy as _, pgettext_lazy",
"WEEKDAYS = {\n 0:_('Monday'), 1:_('Tuesday'), 2:_('Wednesday'), 3:_('Thursday'), 4:_('Friday'),\n 5:_('Saturday'), 6:_('Sunday')\n}",
"WEEKDAYS_ABBR = {\n 0:_('Mon'), 1:_('Tue'), 2:_('Wed')... |
import imp
import os
import sys
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.importlib import import_module
def import_by_path(dotted_path, error_prefix=''):
"""
Import a dotted module path and return the attribute/class designated by the
last nam... | [
[
1,
0,
0.0102,
0.0102,
0,
0.66,
0,
201,
0,
1,
0,
0,
201,
0,
0
],
[
1,
0,
0.0204,
0.0102,
0,
0.66,
0.1429,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0306,
0.0102,
0,
... | [
"import imp",
"import os",
"import sys",
"from django.core.exceptions import ImproperlyConfigured",
"from django.utils import six",
"from django.utils.importlib import import_module",
"def import_by_path(dotted_path, error_prefix=''):\n \"\"\"\n Import a dotted module path and return the attribute... |
"""
termcolors.py
"""
from django.utils import six
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
background = dict([(color_names[x], '4%s' % x) for x in range(8)])
RESET = '0'
opt_dict = {'bold': '1', 'undersco... | [
[
8,
0,
0.01,
0.015,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.025,
0.005,
0,
0.66,
0.0714,
944,
0,
1,
0,
0,
944,
0,
0
],
[
14,
0,
0.035,
0.005,
0,
0.66,
... | [
"\"\"\"\ntermcolors.py\n\"\"\"",
"from django.utils import six",
"color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')",
"foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])",
"background = dict([(color_names[x], '4%s' % x) for x in range(8)])",
"RESET = '0'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.