code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
from django.middleware.csrf import CsrfViewMiddleware
from django.utils.decorators import decorator_from_middleware, available_attrs
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
csrf_protect = decorator_from_middleware(CsrfViewMiddlewar... | [
[
1,
0,
0.0156,
0.0156,
0,
0.66,
0,
574,
0,
1,
0,
0,
574,
0,
0
],
[
1,
0,
0.0312,
0.0156,
0,
0.66,
0.0833,
532,
0,
2,
0,
0,
532,
0,
0
],
[
7,
0,
0.0859,
0.0625,
0,
... | [
"from django.middleware.csrf import CsrfViewMiddleware",
"from django.utils.decorators import decorator_from_middleware, available_attrs",
"try:\n from functools import wraps\nexcept ImportError:\n from django.utils.functional import wraps # Python 2.4 fallback.",
" from functools import wraps",
"... |
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
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.cach... | [
[
7,
0,
0.0309,
0.0494,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0247,
0.0123,
1,
0.4,
0,
711,
0,
1,
0,
0,
711,
0,
0
],
[
1,
1,
0.0494,
0.0123,
1,
0.4,
0... | [
"try:\n from functools import wraps\nexcept ImportError:\n from django.utils.functional import wraps # Python 2.4 fallback.",
" from functools import wraps",
" from django.utils.functional import wraps # Python 2.4 fallback.",
"from django.utils.decorators import decorator_from_middleware_with_a... |
"""
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
import mimetypes
import os
import posixpath
import re
import stat
import urllib
from email.Utils import parsedate_tz, mktime_tz
from django.template import loader
from dj... | [
[
8,
0,
0.0175,
0.028,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.042,
0.007,
0,
0.66,
0.0667,
583,
0,
1,
0,
0,
583,
0,
0
],
[
1,
0,
0.049,
0.007,
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\"\"\"",
"import mimetypes",
"import os",
"import posixpath",
"import re",
"import stat",
"import urllib",
"from email.Utils import parsedate_tz, mktim... |
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.0098,
0.0098,
0,
0.66,
0,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.0196,
0.0098,
0,
0.66,
0.25,
213,
0,
2,
0,
0,
213,
0,
0
],
[
1,
0,
0.0294,
0.0098,
0,
0.... | [
"from django.http import HttpResponseForbidden",
"from django.template import Context, Template",
"from django.conf import settings",
"CSRF_FAILRE_TEMPLATE = \"\"\"\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html lang=\"en\">\n<head>\n <meta ... |
from django.template import loader, RequestContext
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs):
"""
Render a given template with any extra URL parameters in the... | [
[
1,
0,
0.0244,
0.0244,
0,
0.66,
0,
213,
0,
2,
0,
0,
213,
0,
0
],
[
1,
0,
0.0488,
0.0244,
0,
0.66,
0.3333,
779,
0,
4,
0,
0,
779,
0,
0
],
[
2,
0,
0.2683,
0.3659,
0,
... | [
"from django.template import loader, RequestContext",
"from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone",
"def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs):\n \"\"\"\n Render a given template with any extra UR... |
from django.forms.models import ModelFormMetaclass, ModelForm
from django.template import RequestContext, loader
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.core.xheaders import populate_xheaders
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
from django.... | [
[
1,
0,
0.0047,
0.0047,
0,
0.66,
0,
625,
0,
2,
0,
0,
625,
0,
0
],
[
1,
0,
0.0093,
0.0047,
0,
0.66,
0.0667,
213,
0,
2,
0,
0,
213,
0,
0
],
[
1,
0,
0.014,
0.0047,
0,
0... | [
"from django.forms.models import ModelFormMetaclass, ModelForm",
"from django.template import RequestContext, loader",
"from django.http import Http404, HttpResponse, HttpResponseRedirect",
"from django.core.xheaders import populate_xheaders",
"from django.core.exceptions import ObjectDoesNotExist, Improper... |
from django.template import loader, RequestContext
from django.http import Http404, HttpResponse
from django.core.xheaders import populate_xheaders
from django.core.paginator import Paginator, InvalidPage
from django.core.exceptions import ObjectDoesNotExist
def object_list(request, queryset, paginate_by=None, page=No... | [
[
1,
0,
0.0069,
0.0069,
0,
0.66,
0,
213,
0,
2,
0,
0,
213,
0,
0
],
[
1,
0,
0.0138,
0.0069,
0,
0.66,
0.1667,
779,
0,
2,
0,
0,
779,
0,
0
],
[
1,
0,
0.0207,
0.0069,
0,
... | [
"from django.template import loader, RequestContext",
"from django.http import Http404, HttpResponse",
"from django.core.xheaders import populate_xheaders",
"from django.core.paginator import Paginator, InvalidPage",
"from django.core.exceptions import ObjectDoesNotExist",
"def object_list(request, querys... |
import datetime
import time
from django.template import loader, RequestContext
from django.core.exceptions import ObjectDoesNotExist
from django.core.xheaders import populate_xheaders
from django.db.models.fields import DateTimeField
from django.http import Http404, HttpResponse
def archive_index(request, queryset, d... | [
[
1,
0,
0.0027,
0.0027,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0054,
0.0027,
0,
0.66,
0.0769,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0109,
0.0027,
0,
... | [
"import datetime",
"import time",
"from django.template import loader, RequestContext",
"from django.core.exceptions import ObjectDoesNotExist",
"from django.core.xheaders import populate_xheaders",
"from django.db.models.fields import DateTimeField",
"from django.http import Http404, HttpResponse",
"... |
class GenericViewError(Exception):
"""A problem in a generic view."""
pass
| [
[
3,
0,
0.6667,
1,
0,
0.66,
0,
943,
0,
0,
0,
0,
645,
0,
0
],
[
8,
1,
0.6667,
0.3333,
1,
0.07,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"class GenericViewError(Exception):\n \"\"\"A problem in a generic view.\"\"\"\n pass",
" \"\"\"A problem in a generic view.\"\"\""
] |
from django import http
from django.views.decorators.csrf import requires_csrf_token
from django.template import Context, RequestContext, loader
# This can be called when CsrfViewMiddleware.process_view has not run, therefore
# need @requires_csrf_token in case the template needs {% csrf_token %}.
@requires_csrf_toke... | [
[
1,
0,
0.0233,
0.0233,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0465,
0.0233,
0,
0.66,
0.2,
456,
0,
1,
0,
0,
456,
0,
0
],
[
1,
0,
0.0698,
0.0233,
0,
0.6... | [
"from django import http",
"from django.views.decorators.csrf import requires_csrf_token",
"from django.template import Context, RequestContext, loader",
"def page_not_found(request, template_name='404.html'):\n \"\"\"\n Default 404 handler.\n\n Templates: `404.html`\n Context:\n request_pa... |
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_unicod... | [
[
1,
0,
0.0038,
0.0038,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0077,
0.0038,
0,
0.66,
0.05,
723,
0,
1,
0,
0,
723,
0,
0
],
[
1,
0,
0.0153,
0.0038,
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.
"""
from django.template import loader
from django.http import HttpResponse, Http404
from django.http import HttpResponseRedirect, Http... | [
[
8,
0,
0.0288,
0.0481,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0673,
0.0096,
0,
0.66,
0.0909,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.0769,
0.0096,
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\"\"\"",
"from django.template import loader",
"from django.http import HttpResponse, Http404",
"from django.http im... |
"""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 | [
[
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,
1,
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"
] |
"""
Common checksum routines (used in multiple localflavor/ cases, for example).
"""
__all__ = ['luhn',]
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
algorithm (used in validation of, for ... | [
[
8,
0,
0.0909,
0.1364,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2273,
0.0455,
0,
0.66,
0.3333,
272,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.3182,
0.0455,
0,
0.66... | [
"\"\"\"\nCommon checksum routines (used in multiple localflavor/ cases, for example).\n\"\"\"",
"__all__ = ['luhn',]",
"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 according to the Luhn\n algorit... |
"Commonly-used date structures"
from django.utils.translation import ugettext_lazy as _
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'),
5:_('Sat'... | [
[
8,
0,
0.0303,
0.0303,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0909,
0.0303,
0,
0.66,
0.125,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.197,
0.1212,
0,
0.66,... | [
"\"Commonly-used date structures\"",
"from django.utils.translation import ugettext_lazy as _",
"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'), 3:_('Thu'), 4... |
import imp
import os
import sys
def module_has_submodule(package, module_name):
"""See if 'module' is in 'package'."""
name = ".".join([package.__name__, module_name])
try:
# None indicates a cached miss; see mark_miss() in Python/import.c.
return sys.modules[name] is not None
except K... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
201,
0,
1,
0,
0,
201,
0,
0
],
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0.3333,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
... | [
"import imp",
"import os",
"import sys",
"def module_has_submodule(package, module_name):\n \"\"\"See if 'module' is in 'package'.\"\"\"\n name = \".\".join([package.__name__, module_name])\n try:\n # None indicates a cached miss; see mark_miss() in Python/import.c.\n return sys.modules... |
"""
termcolors.py
"""
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', 'underscore': '4', 'blink': '5', 'rever... | [
[
8,
0,
0.0101,
0.0152,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0253,
0.0051,
0,
0.66,
0.0769,
708,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.0303,
0.0051,
0,
0.66... | [
"\"\"\"\ntermcolors.py\n\"\"\"",
"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', 'un... |
"""Thread-local objects
(Note that this module provides a Python version of thread
threading.local class. Depending on the version of Python you're
using, there may be a faster one available. You should always import
the local class from threading.)
Thread-local objects support the management of thread-local dat... | [
[
8,
0,
0.2812,
0.5583,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.6146,
0.0833,
0,
0.66,
0.25,
595,
0,
1,
0,
0,
186,
0,
10
],
[
14,
1,
0.5792,
0.0042,
1,
0.26... | [
"\"\"\"Thread-local objects\n\n(Note that this module provides a Python version of thread\n threading.local class. Depending on the version of Python you're\n using, there may be a faster one available. You should always import\n the local class from threading.)\n\nThread-local objects support the management of t... |
"""
Code used in a couple of places to work with the current thread's environment.
Current users include i18n and request prefix handling.
"""
try:
import threading
currentThread = threading.currentThread
except ImportError:
def currentThread():
return "no threading"
| [
[
8,
0,
0.2083,
0.3333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.7083,
0.5,
0,
0.66,
1,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.5833,
0.0833,
1,
0.34,
0,
... | [
"\"\"\"\nCode used in a couple of places to work with the current thread's environment.\nCurrent users include i18n and request prefix handling.\n\"\"\"",
"try:\n import threading\n currentThread = threading.currentThread\nexcept ImportError:\n def currentThread():\n return \"no threading\"",
" ... |
"""
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print df.format('jS F Y H:i')
7th October 2003 11:39
>>>
"""
import re
import time
import calendar
from django.utils.dates import MONTHS, MONTHS_3, ... | [
[
8,
0,
0.0227,
0.042,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.049,
0.0035,
0,
0.66,
0.0714,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0524,
0.0035,
0,
0.66,
... | [
"\"\"\"\nPHP date() style date formatting\nSee http://www.php.net/date for format strings\n\nUsage:\n>>> import datetime\n>>> d = datetime.datetime.now()\n>>> df = DateFormat(d)",
"import re",
"import time",
"import calendar",
"from django.utils.dates import MONTHS, MONTHS_3, MONTHS_AP, WEEKDAYS, WEEKDAYS_A... |
import datetime
import time
from django.utils.tzinfo import LocalTimezone
from django.utils.translation import ungettext, ugettext
def timesince(d, now=None):
"""
Takes two datetime objects and returns the time between d and now
as a nicely formatted string, e.g. "10 minutes". If d occurs after now,
... | [
[
1,
0,
0.0145,
0.0145,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.029,
0.0145,
0,
0.66,
0.2,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.058,
0.0145,
0,
0.66,... | [
"import datetime",
"import time",
"from django.utils.tzinfo import LocalTimezone",
"from django.utils.translation import ungettext, ugettext",
"def timesince(d, now=None):\n \"\"\"\n Takes two datetime objects and returns the time between d and now\n as a nicely formatted string, e.g. \"10 minutes\... |
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | [
[
1,
0,
0.2605,
0.0084,
0,
0.66,
0,
688,
0,
3,
0,
0,
688,
0,
0
],
[
7,
0,
0.2899,
0.0336,
0,
0.66,
0.0909,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.2857,
0.0084,
1,
0.62... | [
"import os, sys, time",
"try:\n import thread\nexcept ImportError:\n import dummy_thread as thread",
" import thread",
" import dummy_thread as thread",
"try:\n import threading\nexcept ImportError:\n pass",
" import threading",
"RUN_RELOADER = True",
"_mtimes = {}",
"_win = (sy... |
import re
import sys
import urllib
from email.Utils import formatdate
from django.utils.encoding import smart_str, force_unicode
from django.utils.functional import allow_lazy
ETAG_MATCH = re.compile(r'(?:W/)?"((?:\\.|[^"])*)"')
def urlquote(url, safe='/'):
"""
A version of Python's urllib.quote() function t... | [
[
1,
0,
0.0077,
0.0077,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0154,
0.0077,
0,
0.66,
0.0588,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0231,
0.0077,
0,
... | [
"import re",
"import sys",
"import urllib",
"from email.Utils import formatdate",
"from django.utils.encoding import smart_str, force_unicode",
"from django.utils.functional import allow_lazy",
"ETAG_MATCH = re.compile(r'(?:W/)?\"((?:\\\\.|[^\"])*)\"')",
"def urlquote(url, safe='/'):\n \"\"\"\n ... |
# License for code in this file that was taken from Python 2.5.
# PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
# --------------------------------------------
#
# 1. This LICENSE AGREEMENT is between the Python Software Foundation
# ("PSF"), and the Individual or Organization ("Licensee") accessing and
# otherwise usin... | [
[
2,
0,
0.1485,
0.0109,
0,
0.66,
0,
553,
0,
3,
1,
0,
0,
0,
2
],
[
2,
1,
0.1485,
0.0054,
1,
0.3,
0,
144,
0,
2,
1,
0,
0,
0,
2
],
[
13,
2,
0.1499,
0.0027,
2,
0.16,
... | [
"def curry(_curried_func, *args, **kwargs):\n def _curried(*moreargs, **morekwargs):\n return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))\n return _curried",
" def _curried(*moreargs, **morekwargs):\n return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))",
... |
"""
Utilities for XML generation/parsing.
"""
from xml.sax.saxutils import XMLGenerator
class SimplerXMLGenerator(XMLGenerator):
def addQuickElement(self, name, contents=None, attrs=None):
"Convenience method for adding an element with no children"
if attrs is None: attrs = {}
self.startEl... | [
[
8,
0,
0.1429,
0.2143,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3571,
0.0714,
0,
0.66,
0.5,
759,
0,
1,
0,
0,
759,
0,
0
],
[
3,
0,
0.75,
0.5714,
0,
0.66,
... | [
"\"\"\"\nUtilities for XML generation/parsing.\n\"\"\"",
"from xml.sax.saxutils import XMLGenerator",
"class SimplerXMLGenerator(XMLGenerator):\n def addQuickElement(self, name, contents=None, attrs=None):\n \"Convenience method for adding an element with no children\"\n if attrs is None: attrs... |
# Performance note: I benchmarked this code using a set instead of
# a list for the stopwords and was surprised to find that the list
# performed /better/ than the set - maybe because it's only a small
# list.
stopwords = '''
i
a
an
are
as
at
be
by
for
from
how
in
is
it
of
on
or
that
the
this
to
was
what
when
where
''... | [
[
14,
0,
0.4524,
0.6429,
0,
0.66,
0,
557,
3,
0,
0,
0,
908,
10,
1
],
[
2,
0,
0.8929,
0.1905,
0,
0.66,
1,
492,
0,
1,
1,
0,
0,
0,
4
],
[
8,
1,
0.8333,
0.0238,
1,
0.7,
... | [
"stopwords = '''\ni\na\nan\nare\nas\nat\nbe",
"def strip_stopwords(sentence):\n \"Removes stopwords - also normalizes whitespace\"\n words = sentence.split()\n sentence = []\n for word in words:\n if word.lower() not in stopwords:\n sentence.append(word)\n return u' '.join(sentenc... |
"""
Functions for working with "safe strings": strings that can be displayed safely
without further escaping in HTML. Marking something as a "safe string" means
that the producer of the string has already turned characters that should not
be interpreted by the HTML engine (e.g. '<') into the appropriate entities.
"""
f... | [
[
8,
0,
0.0294,
0.0504,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0588,
0.0084,
0,
0.66,
0.1111,
375,
0,
2,
0,
0,
375,
0,
0
],
[
3,
0,
0.0798,
0.0168,
0,
0.66... | [
"\"\"\"\nFunctions for working with \"safe strings\": strings that can be displayed safely\nwithout further escaping in HTML. Marking something as a \"safe string\" means\nthat the producer of the string has already turned characters that should not\nbe interpreted by the HTML engine (e.g. '<') into the appropriate... |
"""
Synchronization primitives:
- reader-writer lock (preference to writers)
(Contributed to Django by eugene@lazutkin.com)
"""
try:
import threading
except ImportError:
import dummy_threading as threading
class RWLock:
"""
Classic implementation of reader-writer lock with preference to writers.... | [
[
8,
0,
0.046,
0.0805,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.1207,
0.046,
0,
0.66,
0.5,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.1149,
0.0115,
1,
0.57,
0,
... | [
"\"\"\"\nSynchronization primitives:\n\n - reader-writer lock (preference to writers)\n\n(Contributed to Django by eugene@lazutkin.com)\n\"\"\"",
"try:\n import threading\nexcept ImportError:\n import dummy_threading as threading",
" import threading",
" import dummy_threading as threading",
... |
"Implementation of tzinfo classes for use with datetime.datetime."
import time
from datetime import timedelta, tzinfo
from django.utils.encoding import smart_unicode, smart_str, DEFAULT_LOCALE_ENCODING
class FixedOffset(tzinfo):
"Fixed offset in minutes east from UTC."
def __init__(self, offset):
if i... | [
[
8,
0,
0.013,
0.013,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.039,
0.013,
0,
0.66,
0.2,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0519,
0.013,
0,
0.66,
0.... | [
"\"Implementation of tzinfo classes for use with datetime.datetime.\"",
"import time",
"from datetime import timedelta, tzinfo",
"from django.utils.encoding import smart_unicode, smart_str, DEFAULT_LOCALE_ENCODING",
"class FixedOffset(tzinfo):\n \"Fixed offset in minutes east from UTC.\"\n def __init_... |
import decimal
import datetime
from django.conf import settings
from django.utils.translation import get_language, to_locale, check_for_language
from django.utils.importlib import import_module
from django.utils.encoding import smart_str
from django.utils import dateformat, numberformat, datetime_safe
from django.util... | [
[
1,
0,
0.0063,
0.0063,
0,
0.66,
0,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.0126,
0.0063,
0,
0.66,
0.0526,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0252,
0.0063,
0,
... | [
"import decimal",
"import datetime",
"from django.conf import settings",
"from django.utils.translation import get_language, to_locale, check_for_language",
"from django.utils.importlib import import_module",
"from django.utils.encoding import smart_str",
"from django.utils import dateformat, numberform... |
"""
Functions for reversing a regular expression (used in reverse URL resolving).
Used internally by Django and not intended for external use.
This is not, and is not intended to be, a complete reg-exp decompiler. It
should be good enough for a large class of URLS, however.
"""
# Mapping of an escape character to a r... | [
[
8,
0,
0.0122,
0.0213,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0534,
0.0366,
0,
0.66,
0.1,
775,
0,
0,
0,
0,
0,
6,
0
],
[
3,
0,
0.0838,
0.0183,
0,
0.66,
... | [
"\"\"\"\nFunctions for reversing a regular expression (used in reverse URL resolving).\nUsed internally by Django and not intended for external use.\n\nThis is not, and is not intended to be, a complete reg-exp decompiler. It\nshould be good enough for a large class of URLS, however.\n\"\"\"",
"ESCAPE_MAPPINGS = ... |
import re
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy
from django.utils.translation import ugettext_lazy
from htmlentitydefs import name2codepoint
# Capitalizes the first letter of a string.
capfirst = lambda x: x and force_unicode(x)[0].upper() + force_unicode(x)[1:]... | [
[
1,
0,
0.0035,
0.0035,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0071,
0.0035,
0,
0.66,
0.0286,
96,
0,
1,
0,
0,
96,
0,
0
],
[
1,
0,
0.0106,
0.0035,
0,
0.... | [
"import re",
"from django.utils.encoding import force_unicode",
"from django.utils.functional import allow_lazy",
"from django.utils.translation import ugettext_lazy",
"from htmlentitydefs import name2codepoint",
"capfirst = lambda x: x and force_unicode(x)[0].upper() + force_unicode(x)[1:]",
"capfirst ... |
import os
from os.path import join, normcase, normpath, abspath, isabs, sep
from django.utils.encoding import force_unicode
# Define our own abspath function that can handle joining
# unicode paths to a current working directory that has non-ASCII
# characters in it. This isn't necessary on Windows since the
# Wind... | [
[
1,
0,
0.0217,
0.0217,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0435,
0.0217,
0,
0.66,
0.25,
79,
0,
6,
0,
0,
79,
0,
0
],
[
1,
0,
0.0652,
0.0217,
0,
0.66... | [
"import os",
"from os.path import join, normcase, normpath, abspath, isabs, sep",
"from django.utils.encoding import force_unicode",
"if os.name == 'nt':\n abspathu = abspath\nelse:\n def abspathu(path):\n \"\"\"\n Version of os.path.abspath that uses the unicode representation\n of... |
"""Implementation of JSONEncoder
"""
import re
c_encode_basestring_ascii = None
c_make_encoder = None
ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
HAS_UTF8 = re.compile(r'[\x80-\xff]')
ESCAPE_DCT = {
'\\': '\\\\',
'"': '\\"',
'\b': '\\b',
'\f': '\\f',
... | [
[
8,
0,
0.0035,
0.0047,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.007,
0.0023,
0,
0.66,
0.0667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
14,
0,
0.0117,
0.0023,
0,
0.66... | [
"\"\"\"Implementation of JSONEncoder\n\"\"\"",
"import re",
"c_encode_basestring_ascii = None",
"c_make_encoder = None",
"ESCAPE = re.compile(r'[\\x00-\\x1f\\\\\"\\b\\f\\n\\r\\t]')",
"ESCAPE_ASCII = re.compile(r'([\\\\\"]|[^\\ -~])')",
"HAS_UTF8 = re.compile(r'[\\x80-\\xff]')",
"ESCAPE_DCT = {\n '\... |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | [
[
8,
0,
0.1433,
0.2837,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3009,
0.0029,
0,
0.66,
0.2,
162,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3066,
0.0029,
0,
0.66,
... | [
"r\"\"\"JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\n:mod:`simplejson` exposes an API familiar to users of the standard library\n:mod:`marshal` and :mod:`pickle` modules. It is the externally maintaine... |
"""JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scan... | [
[
8,
0,
0.0231,
0.0308,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0462,
0.0154,
0,
0.66,
0.1667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
7,
0,
0.0846,
0.0615,
0,
0.66... | [
"\"\"\"JSON token scanner\n\"\"\"",
"import re",
"try:\n from simplejson._speedups import make_scanner as c_make_scanner\nexcept ImportError:\n c_make_scanner = None",
" from simplejson._speedups import make_scanner as c_make_scanner",
" c_make_scanner = None",
"__all__ = ['make_scanner']",
... |
"""
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
from django.utils.copycompat import deepcopy
class Node(object):
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
... | [
[
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.5,
125,
0,
1,
0,
0,
125,
0,
0
],
[
3,
0,
0.5229,
0.9477,
0,
0.66,
... | [
"\"\"\"\nA class for storing a tree graph. Primarily used for filter constructs in the\nORM.\n\"\"\"",
"from django.utils.copycompat import deepcopy",
"class Node(object):\n \"\"\"\n A single internal node in the tree graph. A Node should be viewed as a\n connection (the root) with the children being e... |
"""
Providing iterator functions that are not in all version of Python we support.
Where possible, we try to use the system-native version and only fall back to
these implementations if necessary.
"""
import itertools
# Fallback for Python 2.4, Python 2.5
def product(*args, **kwds):
"""
Taken from http://docs... | [
[
8,
0,
0.0667,
0.1111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1556,
0.0222,
0,
0.66,
0.1667,
808,
0,
1,
0,
0,
808,
0,
0
],
[
2,
0,
0.3444,
0.2667,
0,
0.66... | [
"\"\"\"\nProviding iterator functions that are not in all version of Python we support.\nWhere possible, we try to use the system-native version and only fall back to\nthese implementations if necessary.\n\"\"\"",
"import itertools",
"def product(*args, **kwds):\n \"\"\"\n Taken from http://docs.python.or... |
import django
import os.path
import re
def get_svn_revision(path=None):
"""
Returns the SVN revision in the form SVN-XXXX,
where XXXX is the revision number.
Returns SVN-unknown if anything goes wrong, such as an unexpected
format of internal SVN files.
If path is provided, it should be a dir... | [
[
1,
0,
0.0238,
0.0238,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0476,
0.0238,
0,
0.66,
0.3333,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.0714,
0.0238,
0,
0.... | [
"import django",
"import os.path",
"import re",
"def get_svn_revision(path=None):\n \"\"\"\n Returns the SVN revision in the form SVN-XXXX,\n where XXXX is the revision number.\n\n Returns SVN-unknown if anything goes wrong, such as an unexpected\n format of internal SVN files.",
" \"\"\"\... |
from django.conf import settings
from django.utils.safestring import mark_safe
def format(number, decimal_sep, decimal_pos, grouping=0, thousand_sep=''):
"""
Gets a number (as a number or string), and returns it as a string,
using formats definied as arguments:
* decimal_sep: Decimal separator symbol... | [
[
1,
0,
0.0208,
0.0208,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0417,
0.0208,
0,
0.66,
0.5,
375,
0,
1,
0,
0,
375,
0,
0
],
[
2,
0,
0.5417,
0.8958,
0,
0.6... | [
"from django.conf import settings",
"from django.utils.safestring import mark_safe",
"def format(number, decimal_sep, decimal_pos, grouping=0, thousand_sep=''):\n \"\"\"\n Gets a number (as a number or string), and returns it as a string,\n using formats definied as arguments:\n\n * decimal_sep: Dec... |
"""HTML utilities suitable for global use."""
import re
import string
from django.utils.safestring import SafeData, mark_safe
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy
from django.utils.http import urlquote
# Configuration for urlize() function.
LEADING_PUNCTUATIO... | [
[
8,
0,
0.0052,
0.0052,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0156,
0.0052,
0,
0.66,
0.0263,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0208,
0.0052,
0,
0.66... | [
"\"\"\"HTML utilities suitable for global use.\"\"\"",
"import re",
"import string",
"from django.utils.safestring import SafeData, mark_safe",
"from django.utils.encoding import force_unicode",
"from django.utils.functional import allow_lazy",
"from django.utils.http import urlquote",
"LEADING_PUNCTU... |
# Taken from Python 2.7 with permission from/by the original author.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex'):
raise ValueError("'package' not set to a string")
dot = len(package)
for x in ... | [
[
1,
0,
0.0556,
0.0278,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.2639,
0.3333,
0,
0.66,
0.5,
132,
0,
3,
1,
0,
0,
0,
6
],
[
8,
1,
0.1389,
0.0278,
1,
0.33,... | [
"import sys",
"def _resolve_name(name, package, level):\n \"\"\"Return the absolute name of the module to be imported.\"\"\"\n if not hasattr(package, 'rindex'):\n raise ValueError(\"'package' not set to a string\")\n dot = len(package)\n for x in xrange(level, 1, -1):\n try:\n ... |
"""
Fixes Python 2.4's failure to deepcopy unbound functions.
"""
import copy
import types
# Monkeypatch copy's deepcopy registry to handle functions correctly.
if (hasattr(copy, '_deepcopy_dispatch') and types.FunctionType not in copy._deepcopy_dispatch):
copy._deepcopy_dispatch[types.FunctionType] = copy._deepc... | [
[
8,
0,
0.1429,
0.2143,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3571,
0.0714,
0,
0.66,
0.25,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.4286,
0.0714,
0,
0.66,
... | [
"\"\"\"\nFixes Python 2.4's failure to deepcopy unbound functions.\n\"\"\"",
"import copy",
"import types",
"if (hasattr(copy, '_deepcopy_dispatch') and types.FunctionType not in copy._deepcopy_dispatch):\n copy._deepcopy_dispatch[types.FunctionType] = copy._deepcopy_atomic",
" copy._deepcopy_dispatch... |
"""
The md5 and sha modules are deprecated since Python 2.5, replaced by the
hashlib module containing both hash algorithms. Here, we provide a common
interface to the md5 and sha constructors, depending on system version.
"""
import sys
if sys.version_info >= (2, 5):
import hashlib
md5_constructor = hashlib.m... | [
[
8,
0,
0.15,
0.25,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.35,
0.05,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
4,
0,
0.7,
0.65,
0,
0.66,
1,
0,
... | [
"\"\"\"\nThe md5 and sha modules are deprecated since Python 2.5, replaced by the\nhashlib module containing both hash algorithms. Here, we provide a common\ninterface to the md5 and sha constructors, depending on system version.\n\"\"\"",
"import sys",
"if sys.version_info >= (2, 5):\n import hashlib\n m... |
from types import GeneratorType
from django.utils.copycompat import deepcopy
class MergeDict(object):
"""
A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
If a key appears in more than one of the given diction... | [
[
1,
0,
0.0021,
0.0021,
0,
0.66,
0,
209,
0,
1,
0,
0,
209,
0,
0
],
[
1,
0,
0.0063,
0.0021,
0,
0.66,
0.125,
125,
0,
1,
0,
0,
125,
0,
0
],
[
3,
0,
0.0888,
0.1543,
0,
0... | [
"from types import GeneratorType",
"from django.utils.copycompat import deepcopy",
"class MergeDict(object):\n \"\"\"\n A simple class for creating new \"virtual\" dictionaries that actually look\n up values in more than one dictionary, passed in the constructor.\n\n If a key appears in more than on... |
"""
Syndication feed generation library -- used for generating RSS, etc.
Sample usage:
>>> from django.utils import feedgenerator
>>> feed = feedgenerator.Rss201rev2Feed(
... title=u"Poynter E-Media Tidbits",
... link=u"http://www.poynter.org/column.asp?id=31",
... description=u"A group Weblog by the shar... | [
[
8,
0,
0.0335,
0.0643,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0697,
0.0027,
0,
0.66,
0.0714,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0724,
0.0027,
0,
0.66... | [
"\"\"\"\nSyndication feed generation library -- used for generating RSS, etc.\n\nSample usage:\n\n>>> from django.utils import feedgenerator\n>>> feed = feedgenerator.Rss201rev2Feed(\n... title=u\"Poynter E-Media Tidbits\",",
"import datetime",
"import urlparse",
"from django.utils.xmlutils import Simpler... |
# Python's datetime strftime doesn't handle dates before 1900.
# These classes override date and datetime to support the formatting of a date
# through its full "proleptic Gregorian" date range.
#
# Based on code submitted to comp.lang.python by Andrew Dalke
#
# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%m/%d was... | [
[
1,
0,
0.1124,
0.0112,
0,
0.66,
0,
426,
0,
2,
0,
0,
426,
0,
0
],
[
1,
0,
0.1236,
0.0112,
0,
0.66,
0.1111,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1348,
0.0112,
0,
... | [
"from datetime import date as real_date, datetime as real_datetime",
"import re",
"import time",
"class date(real_date):\n def strftime(self, fmt):\n return strftime(self, fmt)",
" def strftime(self, fmt):\n return strftime(self, fmt)",
" return strftime(self, fmt)",
"class da... |
# These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
import warnings
from django.conf import settings
from django.utils.encoding import force_uni... | [
[
1,
0,
0.0694,
0.0139,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0833,
0.0139,
0,
0.66,
0.0526,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0972,
0.0139,
0,
... | [
"import warnings",
"from django.conf import settings",
"from django.utils.encoding import force_unicode",
"from django.utils.safestring import mark_safe, SafeData",
"def ngettext(singular, plural, number):\n if number == 1: return singular\n return plural",
" if number == 1: return singular",
"... |
"""
Internationalization support.
"""
from django.utils.encoding import force_unicode
from django.utils.functional import lazy, curry
__all__ = ['gettext', 'gettext_noop', 'gettext_lazy', 'ngettext',
'ngettext_lazy', 'string_concat', 'activate', 'deactivate',
'get_language', 'get_language_bidi', 'get_... | [
[
8,
0,
0.0192,
0.0288,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0385,
0.0096,
0,
0.66,
0.0345,
96,
0,
1,
0,
0,
96,
0,
0
],
[
1,
0,
0.0481,
0.0096,
0,
0.66,
... | [
"\"\"\"\nInternationalization support.\n\"\"\"",
"from django.utils.encoding import force_unicode",
"from django.utils.functional import lazy, curry",
"__all__ = ['gettext', 'gettext_noop', 'gettext_lazy', 'ngettext',\n 'ngettext_lazy', 'string_concat', 'activate', 'deactivate',\n 'get_language'... |
"""
This module contains helper functions for controlling caching. It does so by
managing the "Vary" header of responses. It includes functions to patch the
header of response objects directly and decorators that change functions to do
that header-patching themselves.
For information on the Vary header, see:
http... | [
[
8,
0,
0.0417,
0.0789,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0877,
0.0044,
0,
0.66,
0.0455,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0921,
0.0044,
0,
0.66... | [
"\"\"\"\nThis module contains helper functions for controlling caching. It does so by\nmanaging the \"Vary\" header of responses. It includes functions to patch the\nheader of response objects directly and decorators that change functions to do\nthat header-patching themselves.\n\nFor information on the Vary header... |
from django.contrib.syndication import views
from django.core.exceptions import ObjectDoesNotExist
import warnings
# This is part of the deprecated API
from django.contrib.syndication.views import FeedDoesNotExist, add_domain
class Feed(views.Feed):
"""Provided for backwards compatibility."""
def __init__(sel... | [
[
1,
0,
0.0263,
0.0263,
0,
0.66,
0,
61,
0,
1,
0,
0,
61,
0,
0
],
[
1,
0,
0.0526,
0.0263,
0,
0.66,
0.25,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0789,
0.0263,
0,
0.66... | [
"from django.contrib.syndication import views",
"from django.core.exceptions import ObjectDoesNotExist",
"import warnings",
"from django.contrib.syndication.views import FeedDoesNotExist, add_domain",
"class Feed(views.Feed):\n \"\"\"Provided for backwards compatibility.\"\"\"\n def __init__(self, slu... |
import datetime
from django.conf import settings
from django.contrib.sites.models import get_current_site
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import HttpResponse, Http404
from django.template import loader, Template, TemplateDoesNotExist, RequestContext
from djan... | [
[
1,
0,
0.0043,
0.0043,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0087,
0.0043,
0,
0.66,
0.0833,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.013,
0.0043,
0,
0... | [
"import datetime",
"from django.conf import settings",
"from django.contrib.sites.models import get_current_site",
"from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist",
"from django.http import HttpResponse, Http404",
"from django.template import loader, Template, TemplateDoesNotE... |
"""
Czech-specific form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Select, RegexField, Field
from django.utils.translation import ugettext_lazy as _
import re
birth_number = re.compile(r'^(?P<birth>\d{6})/?(?P<id>\d{3,4})$')
ic_... | [
[
8,
0,
0.0143,
0.0214,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0357,
0.0071,
0,
0.66,
0.0909,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0429,
0.0071,
0,
0.66... | [
"\"\"\"\nCzech-specific form helpers\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Select, RegexField, Field",
"from django.utils.translation import ugettext_lazy as _",
"import re",
"birth_number = re.compile(r'... |
"""
Czech regions, translations get from http://www.crwflags.com/fotw/Flags/cz-re.html
"""
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('PR', _('Prague')),
('CE', _('Central Bohemian Region')),
('SO', _('South Bohemian Region')),
('PI', _('Pilsen Region')),
('CA', _(... | [
[
8,
0,
0.0909,
0.1364,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2273,
0.0455,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.6591,
0.7273,
0,
0.66,
... | [
"\"\"\"\nCzech regions, translations get from http://www.crwflags.com/fotw/Flags/cz-re.html\n\"\"\"",
"from django.utils.translation import ugettext_lazy as _",
"REGION_CHOICES = (\n ('PR', _('Prague')),\n ('CE', _('Central Bohemian Region')),\n ('SO', _('South Bohemian Region')),\n ('PI', _('Pilsen... |
"""
India-specific Form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import gettext
import re
class INZipCodeField(RegexFiel... | [
[
8,
0,
0.0357,
0.0536,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0893,
0.0179,
0,
0.66,
0.1111,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.1071,
0.0179,
0,
0.66... | [
"\"\"\"\nIndia-specific Form helpers.\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField, Select",
"from django.utils.encoding import smart_unicode",
"from django.utils.translation import gettext",
"... |
"""
A mapping of state misspellings/abbreviations to normalized abbreviations, and
an alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('KA', 'Karnataka'),
('AP', 'Andhra Pr... | [
[
8,
0,
0.0476,
0.0833,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3333,
0.4643,
0,
0.66,
0.5,
633,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.7857,
0.4167,
0,
0.66,
... | [
"\"\"\"\nA mapping of state misspellings/abbreviations to normalized abbreviations, and\nan alphabetical list of states for use as `choices` in a formfield.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"STATE_CHOICES = (\n ('KA', 'Karnataka'),... |
"""
NL-specific Form helpers
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
pc_re = re.compile('^\d{4}[A-Z]{2}$... | [
[
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.0769,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0693,
0.0099,
0,
0.66... | [
"\"\"\"\nNL-specific Form helpers\n\"\"\"",
"import re",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, Select",
"from django.utils.translation import ugettext_lazy as _",
"from django.utils.encoding import smart_uni... |
from django.utils.translation import ugettext_lazy as _
PROVINCE_CHOICES = (
('DR', _('Drenthe')),
('FL', _('Flevoland')),
('FR', _('Friesland')),
('GL', _('Gelderland')),
('GR', _('Groningen')),
('LB', _('Limburg')),
('NB', _('Noord-Brabant')),
('NH', _('Noord-Holland')),
('OV', _(... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5938,
0.875,
0,
0.66,
1,
540,
0,
0,
0,
0,
0,
8,
12
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"PROVINCE_CHOICES = (\n ('DR', _('Drenthe')),\n ('FL', _('Flevoland')),\n ('FR', _('Friesland')),\n ('GL', _('Gelderland')),\n ('GR', _('Groningen')),\n ('LB', _('Limburg')),\n ('NB', _('Noord-Brabant')),"
] |
"""
Iceland specific form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField
from django.forms.widgets import Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
cla... | [
[
8,
0,
0.0241,
0.0361,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0602,
0.012,
0,
0.66,
0.1111,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0723,
0.012,
0,
0.66,
... | [
"\"\"\"\nIceland specific form helpers.\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import RegexField",
"from django.forms.widgets import Select",
"from django.utils.translation import ugettext_lazy as _",
"from djang... |
# -*- coding: utf-8 -*-
IS_POSTALCODES = (
('101', u'101 Reykjavík'),
('103', u'103 Reykjavík'),
('104', u'104 Reykjavík'),
('105', u'105 Reykjavík'),
('107', u'107 Reykjavík'),
('108', u'108 Reykjavík'),
('109', u'109 Reykjavík'),
('110', u'110 Reykjavík'),
('111', u'111 Reykjavík'... | [
[
14,
0,
0.5099,
0.9868,
0,
0.66,
0,
247,
0,
0,
0,
0,
0,
8,
0
]
] | [
"IS_POSTALCODES = (\n ('101', u'101 Reykjavík'),\n ('103', u'103 Reykjavík'),\n ('104', u'104 Reykjavík'),\n ('105', u'105 Reykjavík'),\n ('107', u'107 Reykjavík'),\n ('108', u'108 Reykjavík'),\n ('109', u'109 Reykjavík'),"
] |
# -*- coding: utf-8 -*-
"""
Swedish specific Form helpers
"""
import re
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.core.validators import EMPTY_VALUES
from django.contrib.localflavor.se.utils import (id_number_checksum,
validate_id_birthday, format_personal_id_numbe... | [
[
8,
0,
0.0191,
0.0191,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0318,
0.0064,
0,
0.66,
0.0833,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0382,
0.0064,
0,
0.66... | [
"\"\"\"\nSwedish specific Form helpers\n\"\"\"",
"import re",
"from django import forms",
"from django.utils.translation import ugettext_lazy as _",
"from django.core.validators import EMPTY_VALUES",
"from django.contrib.localflavor.se.utils import (id_number_checksum,\n validate_id_birthday, format_pe... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Swedish counties, sorted by codes.
http://en.wikipedia.org/wiki/Counties_of_Sweden
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from django.utils.translation import ugettext_lazy as _
COUNTY_CHOICES = (
... | [
[
8,
0,
0.1667,
0.25,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3333,
0.0278,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.6944,
0.6389,
0,
0.66,
... | [
"\"\"\"\nAn alphabetical list of Swedish counties, sorted by codes.\n\nhttp://en.wikipedia.org/wiki/Counties_of_Sweden\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.",
"from django.utils.translation import ugettext_lazy as _",
"COUNTY_CHOICES = (\n ('AB... |
import re
import datetime
def id_number_checksum(gd):
"""
Calculates a Swedish ID number checksum, using the
"Luhn"-algoritm
"""
n = s = 0
for c in (gd['year'] + gd['month'] + gd['day'] + gd['serial']):
tmp = ((n % 2) and 1 or 2) * int(c)
if tmp > 9:
tmp = sum([int(... | [
[
1,
0,
0.0119,
0.0119,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0238,
0.0119,
0,
0.66,
0.1667,
426,
0,
1,
0,
0,
426,
0,
0
],
[
2,
0,
0.1548,
0.2262,
0,
... | [
"import re",
"import datetime",
"def id_number_checksum(gd):\n \"\"\"\n Calculates a Swedish ID number checksum, using the\n \"Luhn\"-algoritm\n \"\"\"\n n = s = 0\n for c in (gd['year'] + gd['month'] + gd['day'] + gd['serial']):\n tmp = ((n % 2) and 1 or 2) * int(c)",
" \"\"\"\n ... |
"""
IT-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django.contrib.localflavor.it.... | [
[
8,
0,
0.0238,
0.0357,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0595,
0.0119,
0,
0.66,
0.0833,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0714,
0.0119,
0,
0.66... | [
"\"\"\"\nIT-specific Form helpers\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField, Select",
"from django.utils.translation import ugettext_lazy as _",
"from django.utils.encoding import smart_unicod... |
# -*- coding: utf-8 -*
REGION_CHOICES = (
('ABR', 'Abruzzo'),
('BAS', 'Basilicata'),
('CAL', 'Calabria'),
('CAM', 'Campania'),
('EMR', 'Emilia-Romagna'),
('FVG', 'Friuli-Venezia Giulia'),
('LAZ', 'Lazio'),
('LIG', 'Liguria'),
('LOM', 'Lombardia'),
('MAR', 'Marche'),
('MOL', ... | [
[
14,
0,
0.5625,
0.9167,
0,
0.66,
0,
868,
0,
0,
0,
0,
0,
8,
0
]
] | [
"REGION_CHOICES = (\n ('ABR', 'Abruzzo'),\n ('BAS', 'Basilicata'),\n ('CAL', 'Calabria'),\n ('CAM', 'Campania'),\n ('EMR', 'Emilia-Romagna'),\n ('FVG', 'Friuli-Venezia Giulia'),\n ('LAZ', 'Lazio'),"
] |
from django.utils.encoding import smart_str, smart_unicode
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': ... | [
[
1,
0,
0.0227,
0.0227,
0,
0.66,
0,
96,
0,
2,
0,
0,
96,
0,
0
],
[
2,
0,
0.4091,
0.7045,
0,
0.66,
0.5,
910,
0,
1,
1,
0,
0,
0,
5
],
[
8,
1,
0.0909,
0.0227,
1,
0.34,
... | [
"from django.utils.encoding import smart_str, smart_unicode",
"def ssn_check_digit(value):\n \"Calculate Italian social security number check digit.\"\n ssn_even_chars = {\n '0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,\n '9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4... |
# -*- coding: utf-8 -*
PROVINCE_CHOICES = (
('AG', 'Agrigento'),
('AL', 'Alessandria'),
('AN', 'Ancona'),
('AO', 'Aosta'),
('AR', 'Arezzo'),
('AP', 'Ascoli Piceno'),
('AT', 'Asti'),
('AV', 'Avellino'),
('BA', 'Bari'),
('BT', 'Barletta-Andria-Trani'), # active starting from 2009
... | [
[
14,
0,
0.5132,
0.9825,
0,
0.66,
0,
540,
0,
0,
0,
0,
0,
8,
0
]
] | [
"PROVINCE_CHOICES = (\n ('AG', 'Agrigento'),\n ('AL', 'Alessandria'),\n ('AN', 'Ancona'),\n ('AO', 'Aosta'),\n ('AR', 'Arezzo'),\n ('AP', 'Ascoli Piceno'),\n ('AT', 'Asti'),"
] |
"""
JP-specific Form helpers
"""
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import RegexField, Select
class JPPostalCodeField(RegexField):
"""
A form field that validates its input is a Japanese postcode.
Accepts 7 digits, wit... | [
[
8,
0,
0.0541,
0.0811,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1351,
0.027,
0,
0.66,
0.2,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.1622,
0.027,
0,
0.66,
... | [
"\"\"\"\nJP-specific Form helpers\n\"\"\"",
"from django.forms import ValidationError",
"from django.utils.translation import ugettext_lazy as _",
"from django.forms.fields import RegexField, Select",
"class JPPostalCodeField(RegexField):\n \"\"\"\n A form field that validates its input is a Japanese ... |
from django.utils.translation import ugettext_lazy
JP_PREFECTURES = (
('hokkaido', ugettext_lazy('Hokkaido'),),
('aomori', ugettext_lazy('Aomori'),),
('iwate', ugettext_lazy('Iwate'),),
('miyagi', ugettext_lazy('Miyagi'),),
('akita', ugettext_lazy('Akita'),),
('yamagata', ugettext_lazy('Yamagat... | [
[
1,
0,
0.0196,
0.0196,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5294,
0.9608,
0,
0.66,
1,
74,
0,
0,
0,
0,
0,
8,
47
]
] | [
"from django.utils.translation import ugettext_lazy",
"JP_PREFECTURES = (\n ('hokkaido', ugettext_lazy('Hokkaido'),),\n ('aomori', ugettext_lazy('Aomori'),),\n ('iwate', ugettext_lazy('Iwate'),),\n ('miyagi', ugettext_lazy('Miyagi'),),\n ('akita', ugettext_lazy('Akita'),),\n ('yamagata', ugettex... |
"""
Chile specific form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
class CLRegionSelect(Select):
""... | [
[
8,
0,
0.0211,
0.0316,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0526,
0.0105,
0,
0.66,
0.1429,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0632,
0.0105,
0,
0.66... | [
"\"\"\"\nChile specific form helpers.\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import RegexField, Select",
"from django.utils.translation import ugettext_lazy as _",
"from django.utils.encoding import smart_unicode",... |
# -*- coding: utf-8 -*-
"""
A list of Chilean regions as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
REGION_CHOICES = (
('RM', u'Región Metropolitana de Santiago'),
('I', u'Región de Tarapacá'),
('II', u'Región de Ant... | [
[
8,
0,
0.18,
0.24,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.68,
0.68,
0,
0.66,
1,
868,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nA list of Chilean regions as `choices` in a formfield.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"REGION_CHOICES = (\n ('RM', u'Región Metropolitana de Santiago'),\n ('I', u'Región de Tarapacá'),\n ('II', u'Región de Anto... |
"""
AT-specific Form helpers
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
re_ssn = re.compile(r'^\d{4} \d{6}')
class ATZipCodeField(RegexField)... | [
[
8,
0,
0.029,
0.0435,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0725,
0.0145,
0,
0.66,
0.1111,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1014,
0.0145,
0,
0.66,... | [
"\"\"\"\nAT-specific Form helpers\n\"\"\"",
"import re",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField, Select",
"from django.utils.translation import ugettext_lazy as _",
"re_ssn = re.compile(r'^\\d{4} \... |
# -*- coding: utf-8 -*
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('BL', _('Burgenland')),
('KA', _('Carinthia')),
('NO', _('Lower Austria')),
('OO', _('Upper Austria')),
('SA', _('Salzburg')),
('ST', _('Styria')),
('TI', _('Tyrol')),
('VO', _('Vorarlberg'... | [
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.6429,
0.7857,
0,
0.66,
1,
633,
0,
0,
0,
0,
0,
8,
9
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"STATE_CHOICES = (\n ('BL', _('Burgenland')),\n ('KA', _('Carinthia')),\n ('NO', _('Lower Austria')),\n ('OO', _('Upper Austria')),\n ('SA', _('Salzburg')),\n ('ST', _('Styria')),\n ('TI', _('Tyrol')),"
] |
"""
DE-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
import re
id_re = re.compile(r"^(?P<residence>\d{10})(?P<origin>\w{1,3})[-\ ]?(?P<... | [
[
8,
0,
0.0238,
0.0357,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0595,
0.0119,
0,
0.66,
0.1111,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0714,
0.0119,
0,
0.66... | [
"\"\"\"\nDE-specific Form helpers\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField, Select",
"from django.utils.translation import ugettext_lazy as _",
"import re",
"id_re = re.compile(r\"^(?P<resi... |
# -*- coding: utf-8 -*
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('BW', _('Baden-Wuerttemberg')),
('BY', _('Bavaria')),
('BE', _('Berlin')),
('BB', _('Brandenburg')),
('HB', _('Bremen')),
('HH', _('Hamburg')),
('HE', _('Hessen')),
('MV', _('Mecklenburg-We... | [
[
1,
0,
0.0952,
0.0476,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5952,
0.8571,
0,
0.66,
1,
633,
0,
0,
0,
0,
0,
8,
16
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"STATE_CHOICES = (\n ('BW', _('Baden-Wuerttemberg')),\n ('BY', _('Bavaria')),\n ('BE', _('Berlin')),\n ('BB', _('Brandenburg')),\n ('HB', _('Bremen')),\n ('HH', _('Hamburg')),\n ('HE', _('Hessen')),"
] |
"""
Australian-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
PHONE_DIGITS_RE ... | [
[
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.1,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.12,
0.02,
0,
0.66,
0.2,
6... | [
"\"\"\"\nAustralian-specific Form helpers\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField, Select",
"from django.utils.encoding import smart_unicode",
"from django.utils.translation import ugettext_... |
"""
An alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('ACT', 'Australian Capital Territory'),
('NSW', 'New South Wales'),
('NT', 'Northern Territory'),
('QLD', 'Q... | [
[
8,
0,
0.2059,
0.3529,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.7353,
0.5882,
0,
0.66,
1,
633,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nAn alphabetical list of states for use as `choices` in a formfield.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"STATE_CHOICES = (\n ('ACT', 'Australian Capital Territory'),\n ('NSW', 'New South Wales'),\n ('NT', 'Northern Terr... |
"""
PT-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_re = re.com... | [
[
8,
0,
0.0417,
0.0625,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1042,
0.0208,
0,
0.66,
0.1111,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.125,
0.0208,
0,
0.66,... | [
"\"\"\"\nPT-specific Form helpers\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField, Select",
"from django.utils.encoding import smart_unicode",
"from django.utils.translation import ugettext_lazy as ... |
# -*- coding: utf-8 -*-
"""
AR-specific Form helpers.
"""
from django.forms import ValidationError
from django.core.validators import EMPTY_VALUES
from django.forms.fields import RegexField, CharField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
class... | [
[
8,
0,
0.0261,
0.0261,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0522,
0.0087,
0,
0.66,
0.1111,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.0609,
0.0087,
0,
0.66... | [
"\"\"\"\nAR-specific Form helpers.\n\"\"\"",
"from django.forms import ValidationError",
"from django.core.validators import EMPTY_VALUES",
"from django.forms.fields import RegexField, CharField, Select",
"from django.utils.encoding import smart_unicode",
"from django.utils.translation import ugettext_laz... |
# -*- coding: utf-8 -*-
"""
A list of Argentinean provinces and autonomous cities as `choices` in a
formfield. From
http://www.argentina.gov.ar/argentina/portal/paginas.dhtml?pagina=425
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
PROVINCE_CHOICES = (
('B'... | [
[
8,
0,
0.1528,
0.2222,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6528,
0.7222,
0,
0.66,
1,
540,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nA list of Argentinean provinces and autonomous cities as `choices` in a\nformfield. From\nhttp://www.argentina.gov.ar/argentina/portal/paginas.dhtml?pagina=425\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"PROVINCE_CHOICES = (\n ('B',... |
# -*- coding: utf-8 -*-
"""
BR-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, CharField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
... | [
[
8,
0,
0.0184,
0.0184,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0368,
0.0061,
0,
0.66,
0.0714,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0429,
0.0061,
0,
0.66... | [
"\"\"\"\nBR-specific Form helpers\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField, CharField, Select",
"from django.utils.encoding import smart_unicode",
"from django.utils.translation import ugette... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Brazilian states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('AC', 'Acre'),
('AL', 'Alagoas'),
('AP', u'Amapá'),
('AM', 'Amazonas'),
... | [
[
8,
0,
0.1216,
0.1622,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6216,
0.7838,
0,
0.66,
1,
633,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nAn alphabetical list of Brazilian states for use as `choices` in a formfield.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"STATE_CHOICES = (\n ('AC', 'Acre'),\n ('AL', 'Alagoas'),\n ('AP', u'Amapá'),\n ('AM', 'Amazonas'),\n ... |
"""
Slovak-specific form helpers
"""
from django.forms.fields import Select, RegexField
from django.utils.translation import ugettext_lazy as _
class SKRegionSelect(Select):
"""
A select widget widget with list of Slovak regions as choices.
"""
def __init__(self, attrs=None):
from sk_regions i... | [
[
8,
0,
0.0465,
0.0698,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1163,
0.0233,
0,
0.66,
0.2,
910,
0,
2,
0,
0,
910,
0,
0
],
[
1,
0,
0.1395,
0.0233,
0,
0.66,
... | [
"\"\"\"\nSlovak-specific form helpers\n\"\"\"",
"from django.forms.fields import Select, RegexField",
"from django.utils.translation import ugettext_lazy as _",
"class SKRegionSelect(Select):\n \"\"\"\n A select widget widget with list of Slovak regions as choices.\n \"\"\"\n def __init__(self, at... |
"""
Slovak districts according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska
"""
from django.utils.translation import ugettext_lazy as _
DISTRICT_CHOICES = (
('BB', _('Banska Bystrica')),
('BS', _('Banska Stiavnica')),
('BJ', _('Bardejov')),
('BN', _('Banovce nad Bebravo... | [
[
8,
0,
0.023,
0.0345,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0575,
0.0115,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5402,
0.931,
0,
0.66,
... | [
"\"\"\"\nSlovak districts according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska\n\"\"\"",
"from django.utils.translation import ugettext_lazy as _",
"DISTRICT_CHOICES = (\n ('BB', _('Banska Bystrica')),\n ('BS', _('Banska Stiavnica')),\n ('BJ', _('Bardejov')),\n ('BN... |
"""
Slovak regions according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska
"""
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('BB', _('Banska Bystrica region')),
('BA', _('Bratislava region')),
('KE', _('Kosice region')),
('NR', _('Nitra regi... | [
[
8,
0,
0.125,
0.1875,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3125,
0.0625,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.7188,
0.625,
0,
0.66,
... | [
"\"\"\"\nSlovak regions according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska\n\"\"\"",
"from django.utils.translation import ugettext_lazy as _",
"REGION_CHOICES = (\n ('BB', _('Banska Bystrica region')),\n ('BA', _('Bratislava region')),\n ('KE', _('Kosice region')),\... |
"""
Mexican-specific form helpers.
"""
from django.forms.fields import Select
class MXStateSelect(Select):
"""
A Select widget that uses a list of Mexican states as its choices.
"""
def __init__(self, attrs=None):
from mx_states import STATE_CHOICES
super(MXStateSelect, self).__init__(... | [
[
8,
0,
0.1429,
0.2143,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3571,
0.0714,
0,
0.66,
0.5,
910,
0,
1,
0,
0,
910,
0,
0
],
[
3,
0,
0.7143,
0.5,
0,
0.66,
... | [
"\"\"\"\nMexican-specific form helpers.\n\"\"\"",
"from django.forms.fields import Select",
"class MXStateSelect(Select):\n \"\"\"\n A Select widget that uses a list of Mexican states as its choices.\n \"\"\"\n def __init__(self, attrs=None):\n from mx_states import STATE_CHOICES\n sup... |
# -*- coding: utf-8 -*-
"""
A list of Mexican states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('AGU', _(u'Aguascalientes')),
('BCN', _(u... | [
[
8,
0,
0.1,
0.1333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2,
0.0222,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.6111,
0.7556,
0,
0.66,
1,... | [
"\"\"\"\nA list of Mexican states for use as `choices` in a formfield.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"from django.utils.translation import ugettext_lazy as _",
"STATE_CHOICES = (\n ('AGU', _(u'Aguascalientes')),\n ('BCN', _... |
# -*- coding: utf-8 -*-
"""
Spanish-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
import re
class ESPostalCodeField(RegexField):
"""
A... | [
[
8,
0,
0.0162,
0.0162,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0324,
0.0054,
0,
0.66,
0.0833,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0378,
0.0054,
0,
0.66... | [
"\"\"\"\nSpanish-specific Form helpers\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import RegexField, Select",
"from django.utils.translation import ugettext_lazy as _",
"import re",
"class ESPostalCodeField(RegexFiel... |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('AN', _('Andalusia')),
('AR', _('Aragon')),
('O', _('Principality of Asturias')),
('IB', _('Balearic Islands')),
('PV', _('Basque Country')),
('CN', _('Canary Islands')),
('S', _('Cantabria')... | [
[
1,
0,
0.087,
0.0435,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5652,
0.8261,
0,
0.66,
1,
868,
0,
0,
0,
0,
0,
8,
17
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"REGION_CHOICES = (\n ('AN', _('Andalusia')),\n ('AR', _('Aragon')),\n ('O', _('Principality of Asturias')),\n ('IB', _('Balearic Islands')),\n ('PV', _('Basque Country')),\n ('CN', _('Canary Islands')),\n ('S', _('Cantabria')),"
] |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
PROVINCE_CHOICES = (
('01', _('Arava')),
('02', _('Albacete')),
('03', _('Alacant')),
('04', _('Almeria')),
('05', _('Avila')),
('06', _('Badajoz')),
('07', _('Illes Balears')),
('08', _('Barcelona')),
(... | [
[
1,
0,
0.0345,
0.0172,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5259,
0.931,
0,
0.66,
1,
540,
0,
0,
0,
0,
0,
8,
52
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"PROVINCE_CHOICES = (\n ('01', _('Arava')),\n ('02', _('Albacete')),\n ('03', _('Alacant')),\n ('04', _('Almeria')),\n ('05', _('Avila')),\n ('06', _('Badajoz')),\n ('07', _('Illes Balears')),"
] |
"""
FR-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_re = re.com... | [
[
8,
0,
0.0392,
0.0588,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.098,
0.0196,
0,
0.66,
0.1,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.1176,
0.0196,
0,
0.66,
... | [
"\"\"\"\nFR-specific Form helpers\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField, Select",
"from django.utils.encoding import smart_unicode",
"from django.utils.translation import ugettext_lazy as ... |
# -*- coding: utf-8 -*-
DEPARTMENT_ASCII_CHOICES = (
('01', '01 - Ain'),
('02', '02 - Aisne'),
('03', '03 - Allier'),
('04', '04 - Alpes-de-Haute-Provence'),
('05', '05 - Hautes-Alpes'),
('06', '06 - Alpes-Maritimes'),
('07', '07 - Ardeche'),
('08', '08 - Ardennes'),
('09', '09 - Ar... | [
[
14,
0,
0.5136,
0.9818,
0,
0.66,
0,
807,
0,
0,
0,
0,
0,
8,
0
]
] | [
"DEPARTMENT_ASCII_CHOICES = (\n ('01', '01 - Ain'),\n ('02', '02 - Aisne'),\n ('03', '03 - Allier'),\n ('04', '04 - Alpes-de-Haute-Provence'),\n ('05', '05 - Hautes-Alpes'),\n ('06', '06 - Alpes-Maritimes'),\n ('07', '07 - Ardeche'),"
] |
"""
South Africa-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField
from django.utils.checksums import luhn
from django.utils.translation import gettext as _
import re
from datetime import date
id_re = re... | [
[
8,
0,
0.0333,
0.05,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0167,
0,
0.66,
0.1,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.1,
0.0167,
0,
0.66,
0.... | [
"\"\"\"\nSouth Africa-specific Form helpers\n\"\"\"",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField",
"from django.utils.checksums import luhn",
"from django.utils.translation import gettext as _",
"impor... |
from django.utils.translation import gettext_lazy as _
PROVINCE_CHOICES = (
('EC', _('Eastern Cape')),
('FS', _('Free State')),
('GP', _('Gauteng')),
('KN', _('KwaZulu-Natal')),
('LP', _('Limpopo')),
('MP', _('Mpumalanga')),
('NC', _('Northern Cape')),
('NW', _('North West')),
('WC'... | [
[
1,
0,
0.0769,
0.0769,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.6154,
0.8462,
0,
0.66,
1,
540,
0,
0,
0,
0,
0,
8,
9
]
] | [
"from django.utils.translation import gettext_lazy as _",
"PROVINCE_CHOICES = (\n ('EC', _('Eastern Cape')),\n ('FS', _('Free State')),\n ('GP', _('Gauteng')),\n ('KN', _('KwaZulu-Natal')),\n ('LP', _('Limpopo')),\n ('MP', _('Mpumalanga')),\n ('NC', _('Northern Cape')),"
] |
"""
UK-specific Form helpers
"""
import re
from django.forms.fields import CharField, Select
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
class UKPostcodeField(CharField):
"""
A form field that validates its input is a UK postcode.
The regular expressi... | [
[
8,
0,
0.0377,
0.0566,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0943,
0.0189,
0,
0.66,
0.1429,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1321,
0.0189,
0,
0.66... | [
"\"\"\"\nUK-specific Form helpers\n\"\"\"",
"import re",
"from django.forms.fields import CharField, Select",
"from django.forms import ValidationError",
"from django.utils.translation import ugettext_lazy as _",
"class UKPostcodeField(CharField):\n \"\"\"\n A form field that validates its input is ... |
"""
Sources:
English regions: http://www.statistics.gov.uk/geography/downloads/31_10_01_REGION_names_and_codes_12_00.xls
Northern Ireland regions: http://en.wikipedia.org/wiki/List_of_Irish_counties_by_area
Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales
Scottish regions: http://... | [
[
8,
0,
0.0412,
0.0722,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0825,
0.0103,
0,
0.66,
0.1429,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.3196,
0.4433,
0,
0.6... | [
"\"\"\"\nSources:\n English regions: http://www.statistics.gov.uk/geography/downloads/31_10_01_REGION_names_and_codes_12_00.xls\n Northern Ireland regions: http://en.wikipedia.org/wiki/List_of_Irish_counties_by_area\n Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales\n Scottish reg... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Finnish municipalities for use as `choices` in a
formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
MUNICIPALITY_CHOICES = (
('akaa', u"Akaa"),
('alajarvi', u"Alajärvi"),
('alavieska', u"Alav... | [
[
8,
0,
0.0142,
0.0198,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5142,
0.9745,
0,
0.66,
1,
881,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nAn alphabetical list of Finnish municipalities for use as `choices` in a\nformfield.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"MUNICIPALITY_CHOICES = (\n ('akaa', u\"Akaa\"),\n ('alajarvi', u\"Alajärvi\"),\n ('alavieska', u\... |
"""
FI-specific Form helpers
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
class FIZipCodeField(RegexField):
default_error_messages = {
... | [
[
8,
0,
0.0392,
0.0588,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.098,
0.0196,
0,
0.66,
0.125,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1176,
0.0196,
0,
0.66,
... | [
"\"\"\"\nFI-specific Form helpers\n\"\"\"",
"import re",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField, Select",
"from django.utils.translation import ugettext_lazy as _",
"class FIZipCodeField(RegexField... |
"""
Kuwait-specific Form helpers
"""
import re
from datetime import date
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField
from django.utils.translation import gettext as _
id_re = re.compile(r'^(?P<initial>\d{1})(?P<yy>\d\d)(?P<... | [
[
8,
0,
0.0317,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0635,
0.0159,
0,
0.66,
0.125,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0794,
0.0159,
0,
0.66,... | [
"\"\"\"\nKuwait-specific Form helpers\n\"\"\"",
"import re",
"from datetime import date",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField",
"from django.utils.translation import gettext as _",
"id_re = re... |
from django import forms
DEFAULT_DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
'%B %d %Y', '%B %d, %Y', ... | [
[
1,
0,
0.0208,
0.0208,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.125,
0.1458,
0,
0.66,
0.2,
243,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.3333,
0.2292,
0,
0.66... | [
"from django import forms",
"DEFAULT_DATE_INPUT_FORMATS = (\n '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'\n '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'\n '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'\n '%B %d %Y', '%B %d, %... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.