code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
from __future__ import unicode_literals
import codecs
import datetime
from decimal import Decimal
import locale
try:
from urllib.parse import quote
except ImportError: # Python 2
from urllib import quote
import warnings
from django.utils.functional import Promise
from django.utils import six
class Django... | [
[
1,
0,
0.0041,
0.0041,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0123,
0.0041,
0,
0.66,
0.0455,
220,
0,
1,
0,
0,
220,
0,
0
],
[
1,
0,
0.0164,
0.0041,
0,
... | [
"from __future__ import unicode_literals",
"import codecs",
"import datetime",
"from decimal import Decimal",
"import locale",
"try:\n from urllib.parse import quote\nexcept ImportError: # Python 2\n from urllib import quote",
" from urllib.parse import quote",
" from urllib import quo... |
"""JsLex: a lexer for Javascript"""
# Originally from https://bitbucket.org/ned/jslex
import re
class Tok(object):
"""
A specification for a token class.
"""
num = 0
def __init__(self, name, regex, next=None):
self.id = Tok.num
Tok.num += 1
self.name = name
self.reg... | [
[
8,
0,
0.0046,
0.0046,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0137,
0.0046,
0,
0.66,
0.1667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
3,
0,
0.0479,
0.0548,
0,
0.66... | [
"\"\"\"JsLex: a lexer for Javascript\"\"\"",
"import re",
"class Tok(object):\n \"\"\"\n A specification for a token class.\n \"\"\"\n num = 0\n\n def __init__(self, name, regex, next=None):\n self.id = Tok.num",
" \"\"\"\n A specification for a token class.\n \"\"\"",
" nu... |
"""
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
>>>
"""
from __future__ import unicode_literals
import re
import time
import calendar
import d... | [
[
8,
0,
0.0205,
0.0379,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.041,
0.0032,
0,
0.66,
0.0556,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0473,
0.0032,
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)",
"from __future__ import unicode_literals",
"import re",
"import time",
"import calendar",
"import datetime",
"from django.ut... |
from __future__ import unicode_literals
import datetime
from django.utils.timezone import is_aware, utc
from django.utils.translation import ungettext, ugettext
def timesince(d, now=None, reversed=False):
"""
Takes two datetime objects and returns the time between d and now
as a nicely formatted string, ... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
0.66,
0.2,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0794,
0.0159,
0,
0.6... | [
"from __future__ import unicode_literals",
"import datetime",
"from django.utils.timezone import is_aware, utc",
"from django.utils.translation import ungettext, ugettext",
"def timesince(d, now=None, reversed=False):\n \"\"\"\n Takes two datetime objects and returns the time between d and now\n as... |
# Copyright (c) 2010 Guilherme Gondim. All rights reserved.
# Copyright (c) 2009 Simon Willison. All rights reserved.
# Copyright (c) 2002 Drew Perttula. All rights reserved.
#
# License:
# Python Software Foundation License version 2
#
# See the file "LICENSE" for terms & conditions for usage, and a DISCLAIMER OF
# ... | [
[
8,
0,
0.2828,
0.2121,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.404,
0.0101,
0,
0.66,
0.0769,
89,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.4141,
0.0101,
0,
0.66,
... | [
"\"\"\"\nConvert numbers from base 10 integers to base X strings and back again.\n\nSample usage::\n\n >>> base20 = BaseConverter('0123456789abcdefghij')\n >>> base20.encode(1234)\n '31e'",
"BASE2_ALPHABET = '01'",
"BASE16_ALPHABET = '0123456789ABCDEF'",
"BASE56_ALPHABET = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ... |
# 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.2123,
0.0068,
0,
0.66,
0,
688,
0,
4,
0,
0,
688,
0,
0
],
[
7,
0,
0.2363,
0.0274,
0,
0.66,
0.0769,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.2329,
0.0068,
1,
0.18... | [
"import os, sys, time, signal",
"try:\n from django.utils.six.moves import _thread as thread\nexcept ImportError:\n from django.utils.six.moves import _dummy_thread as thread",
" from django.utils.six.moves import _thread as thread",
" from django.utils.six.moves import _dummy_thread as thread",
... |
from __future__ import unicode_literals
import base64
import calendar
import datetime
import re
import sys
try:
from urllib import parse as urllib_parse
except ImportError: # Python 2
import urllib as urllib_parse
import urlparse
urllib_parse.urlparse = urlparse.urlparse
from binascii import Error... | [
[
1,
0,
0.0038,
0.0038,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0113,
0.0038,
0,
0.66,
0.0227,
177,
0,
1,
0,
0,
177,
0,
0
],
[
1,
0,
0.0151,
0.0038,
0,
... | [
"from __future__ import unicode_literals",
"import base64",
"import calendar",
"import datetime",
"import re",
"import sys",
"try:\n from urllib import parse as urllib_parse\nexcept ImportError: # Python 2\n import urllib as urllib_parse\n import urlparse\n urllib_parse.urlparse = urlpar... |
import copy
import operator
from functools import wraps, update_wrapper
import sys
from django.utils import six
from django.utils.six.moves import copyreg
# You can't trivially replace this `functools.partial` because this binds to
# classes and returns bound instances, whereas functools.partial (on CPython)
# is a ... | [
[
1,
0,
0.0026,
0.0026,
0,
0.66,
0,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.0051,
0.0026,
0,
0.66,
0.05,
616,
0,
1,
0,
0,
616,
0,
0
],
[
1,
0,
0.0077,
0.0026,
0,
0.... | [
"import copy",
"import operator",
"from functools import wraps, update_wrapper",
"import sys",
"from django.utils import six",
"from django.utils.six.moves import copyreg",
"def curry(_curried_func, *args, **kwargs):\n def _curried(*moreargs, **morekwargs):\n return _curried_func(*(args+morear... |
"""
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... |
import os
import sys
if os.name == 'posix':
def become_daemon(our_home_dir='.', out_log='/dev/null',
err_log='/dev/null', umask=0o022):
"Robustly turn into a UNIX daemon, running in our_home_dir."
# First fork
try:
if os.fork() > 0:
sys.exit... | [
[
1,
0,
0.0172,
0.0172,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0345,
0.0172,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
4,
0,
0.5345,
0.9483,
0,
0.6... | [
"import os",
"import sys",
"if os.name == 'posix':\n def become_daemon(our_home_dir='.', out_log='/dev/null',\n err_log='/dev/null', umask=0o022):\n \"Robustly turn into a UNIX daemon, running in our_home_dir.\"\n # First fork\n try:\n if os.fork() > 0:\n ... |
"""
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.0261,
0.0448,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0522,
0.0075,
0,
0.66,
0.0833,
375,
0,
2,
0,
0,
375,
0,
0
],
[
1,
0,
0.0597,
0.0075,
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... |
import os
import sys
try:
from functools import wraps
except ImportError:
# only needed for Python 2.4
def wraps(_):
def _wraps(func):
return func
return _wraps
__unittest = True
def _relpath_nt(path, start=os.path.curdir):
"""Return a relative version of a path"""
if... | [
[
1,
0,
0.0156,
0.0156,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0312,
0.0156,
0,
0.66,
0.1667,
509,
0,
1,
0,
0,
509,
0,
0
],
[
7,
0,
0.1172,
0.125,
0,
0... | [
"import os",
"import sys",
"try:\n from functools import wraps\nexcept ImportError:\n # only needed for Python 2.4\n def wraps(_):\n def _wraps(func):\n return func\n return _wraps",
" from functools import wraps",
" def wraps(_):\n def _wraps(func):\n ... |
"""Unittest main program"""
import sys
import os
import types
from django.utils.unittest import loader, runner
try:
from django.utils.unittest.signals import installHandler
except ImportError:
installHandler = None
__unittest = True
FAILFAST = " -f, --failfast Stop on first failure\n"
CATCHBREAK = ... | [
[
8,
0,
0.0041,
0.0041,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0124,
0.0041,
0,
0.66,
0.0714,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0166,
0.0041,
0,
0.66... | [
"\"\"\"Unittest main program\"\"\"",
"import sys",
"import os",
"import types",
"from django.utils.unittest import loader, runner",
"try:\n from django.utils.unittest.signals import installHandler\nexcept ImportError:\n installHandler = None",
" from django.utils.unittest.signals import install... |
import signal
import weakref
from django.utils.unittest.compatibility import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.default_handler = default_handler
def __call__(self, signum, frame):
installed_handler ... | [
[
1,
0,
0.0175,
0.0175,
0,
0.66,
0,
621,
0,
1,
0,
0,
621,
0,
0
],
[
1,
0,
0.0351,
0.0175,
0,
0.66,
0.1,
708,
0,
1,
0,
0,
708,
0,
0
],
[
1,
0,
0.0702,
0.0175,
0,
0.6... | [
"import signal",
"import weakref",
"from django.utils.unittest.compatibility import wraps",
"__unittest = True",
"class _InterruptHandler(object):\n def __init__(self, default_handler):\n self.called = False\n self.default_handler = default_handler\n\n def __call__(self, signum, frame):\... |
"""Test result object"""
import sys
import traceback
import unittest
from StringIO import StringIO
from django.utils.unittest import util
from django.utils.unittest.compatibility import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'fail... | [
[
8,
0,
0.0055,
0.0055,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0164,
0.0055,
0,
0.66,
0.0909,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0219,
0.0055,
0,
0.66... | [
"\"\"\"Test result object\"\"\"",
"import sys",
"import traceback",
"import unittest",
"from StringIO import StringIO",
"from django.utils.unittest import util",
"from django.utils.unittest.compatibility import wraps",
"__unittest = True",
"def failfast(method):\n @wraps(method)\n def inner(se... |
import os
import sys
from django.utils.unittest.loader import defaultTestLoader
def collector():
# import __main__ triggers code re-execution
__main__ = sys.modules['__main__']
setupDir = os.path.abspath(os.path.dirname(__main__.__file__))
return defaultTestLoader.discover(setupDir)
| [
[
1,
0,
0.1111,
0.1111,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2222,
0.1111,
0,
0.66,
0.3333,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.3333,
0.1111,
0,
... | [
"import os",
"import sys",
"from django.utils.unittest.loader import defaultTestLoader",
"def collector():\n # import __main__ triggers code re-execution\n __main__ = sys.modules['__main__']\n setupDir = os.path.abspath(os.path.dirname(__main__.__file__))\n return defaultTestLoader.discover(setupD... |
"""TestSuite"""
import sys
import unittest
from django.utils.unittest import case, util
__unittest = True
class BaseTestSuite(unittest.TestSuite):
"""A simple test suite that doesn't provide class or module shared fixtures.
"""
def __init__(self, tests=()):
self._tests = []
self.addTests... | [
[
8,
0,
0.0035,
0.0035,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0105,
0.0035,
0,
0.66,
0.1111,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0139,
0.0035,
0,
0.66... | [
"\"\"\"TestSuite\"\"\"",
"import sys",
"import unittest",
"from django.utils.unittest import case, util",
"__unittest = True",
"class BaseTestSuite(unittest.TestSuite):\n \"\"\"A simple test suite that doesn't provide class or module shared fixtures.\n \"\"\"\n def __init__(self, tests=()):\n ... |
"""Test case implementation"""
import sys
import difflib
import pprint
import re
import unittest
import warnings
from django.utils.unittest import result
from django.utils.unittest.util import\
safe_repr, safe_str, strclass,\
unorderable_list_difference
from django.utils.unittest.compatibility import wraps
... | [
[
8,
0,
0.0009,
0.0009,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0028,
0.0009,
0,
0.66,
0.0435,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0037,
0.0009,
0,
0.66... | [
"\"\"\"Test case implementation\"\"\"",
"import sys",
"import difflib",
"import pprint",
"import re",
"import unittest",
"import warnings",
"from django.utils.unittest import result",
"from django.utils.unittest.util import\\\n safe_repr, safe_str, strclass,\\\n unorderable_list_difference",
... |
"""Various utility functions."""
__unittest = True
_MAX_LENGTH = 80
def safe_repr(obj, short=False):
try:
result = repr(obj)
except Exception:
result = object.__repr__(obj)
if not short or len(result) < _MAX_LENGTH:
return result
return result[:_MAX_LENGTH] + ' [truncated]...'... | [
[
8,
0,
0.0101,
0.0101,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0303,
0.0101,
0,
0.66,
0.1429,
368,
1,
0,
0,
0,
0,
4,
0
],
[
14,
0,
0.0606,
0.0101,
0,
0.66... | [
"\"\"\"Various utility functions.\"\"\"",
"__unittest = True",
"_MAX_LENGTH = 80",
"def safe_repr(obj, short=False):\n try:\n result = repr(obj)\n except Exception:\n result = object.__repr__(obj)\n if not short or len(result) < _MAX_LENGTH:\n return result\n return result[:_M... |
"""
unittest2
unittest2 is a backport of the new features added to the unittest testing
framework in Python 2.7. It is tested to run on Python 2.4 - 2.6.
To use unittest2 instead of unittest simply replace ``import unittest`` with
``import unittest2``.
Copyright (c) 1999-2003 Steve Purcell
Copyright (c) 2003-2010 P... | [
[
8,
0,
0.175,
0.3375,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3625,
0.0125,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
7,
0,
0.7063,
0.6,
0,
0.66,
1... | [
"\"\"\"\nunittest2\n\nunittest2 is a backport of the new features added to the unittest testing\nframework in Python 2.7. It is tested to run on Python 2.4 - 2.6.\n\nTo use unittest2 instead of unittest simply replace ``import unittest`` with\n``import unittest2``.",
"import sys",
"try:\n # check the system ... |
"""Main entry point"""
import sys
if sys.argv[0].endswith("__main__.py"):
sys.argv[0] = "unittest2"
__unittest = True
from django.utils.unittest.main import main_
main_()
| [
[
8,
0,
0.1,
0.1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3,
0.1,
0,
0.66,
0.2,
509,
0,
1,
0,
0,
509,
0,
0
],
[
4,
0,
0.45,
0.2,
0,
0.66,
0.4,
0,
... | [
"\"\"\"Main entry point\"\"\"",
"import sys",
"if sys.argv[0].endswith(\"__main__.py\"):\n sys.argv[0] = \"unittest2\"",
" sys.argv[0] = \"unittest2\"",
"__unittest = True",
"from django.utils.unittest.main import main_",
"main_()"
] |
"""Loading unittests."""
import os
import re
import sys
import traceback
import types
import unittest
from fnmatch import fnmatch
from django.utils.unittest import case, suite
try:
from os.path import relpath
except ImportError:
from django.utils.unittest.compatibility import relpath
__unittest = True
de... | [
[
8,
0,
0.0031,
0.0031,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0093,
0.0031,
0,
0.66,
0.0476,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0124,
0.0031,
0,
0.66... | [
"\"\"\"Loading unittests.\"\"\"",
"import os",
"import re",
"import sys",
"import traceback",
"import types",
"import unittest",
"from fnmatch import fnmatch",
"from django.utils.unittest import case, suite",
"try:\n from os.path import relpath\nexcept ImportError:\n from django.utils.unitte... |
"""Running tests"""
import sys
import time
import unittest
from django.utils.unittest import result
try:
from django.utils.unittest.signals import registerResult
except ImportError:
def registerResult(_):
pass
__unittest = True
class _WritelnDecorator(object):
"""Used to decorate file-like obj... | [
[
8,
0,
0.0049,
0.0049,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0146,
0.0049,
0,
0.66,
0.1111,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0194,
0.0049,
0,
0.66... | [
"\"\"\"Running tests\"\"\"",
"import sys",
"import time",
"import unittest",
"from django.utils.unittest import result",
"try:\n from django.utils.unittest.signals import registerResult\nexcept ImportError:\n def registerResult(_):\n pass",
" from django.utils.unittest.signals import reg... |
"""
Synchronization primitives:
- reader-writer lock (preference to writers)
(Contributed to Django by eugene@lazutkin.com)
"""
import contextlib
try:
import threading
except ImportError:
import dummy_threading as threading
class RWLock(object):
"""
Classic implementation of reader-writer lock ... | [
[
8,
0,
0.043,
0.0753,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0968,
0.0108,
0,
0.66,
0.3333,
479,
0,
1,
0,
0,
479,
0,
0
],
[
7,
0,
0.1237,
0.043,
0,
0.66,
... | [
"\"\"\"\nSynchronization primitives:\n\n - reader-writer lock (preference to writers)\n\n(Contributed to Django by eugene@lazutkin.com)\n\"\"\"",
"import contextlib",
"try:\n import threading\nexcept ImportError:\n import dummy_threading as threading",
" import threading",
" import dummy_thre... |
"Implementation of tzinfo classes for use with datetime.datetime."
from __future__ import unicode_literals
import time
from datetime import timedelta, tzinfo
from django.utils.encoding import force_str, force_text, DEFAULT_LOCALE_ENCODING
# Python's doc say: "A tzinfo subclass must have an __init__() method that ca... | [
[
8,
0,
0.01,
0.01,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.03,
0.01,
0,
0.66,
0.1667,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.05,
0.01,
0,
0.66,
0.3333... | [
"\"Implementation of tzinfo classes for use with datetime.datetime.\"",
"from __future__ import unicode_literals",
"import time",
"from datetime import timedelta, tzinfo",
"from django.utils.encoding import force_str, force_text, DEFAULT_LOCALE_ENCODING",
"class FixedOffset(tzinfo):\n \"Fixed offset in... |
import decimal
import datetime
from django.conf import settings
from django.utils import dateformat, numberformat, datetime_safe
from django.utils.importlib import import_module
from django.utils.encoding import force_str
from django.utils.functional import lazy
from django.utils.safestring import mark_safe
from djang... | [
[
1,
0,
0.0048,
0.0048,
0,
0.66,
0,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.0097,
0.0048,
0,
0.66,
0.0435,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0193,
0.0048,
0,
... | [
"import decimal",
"import datetime",
"from django.conf import settings",
"from django.utils import dateformat, numberformat, datetime_safe",
"from django.utils.importlib import import_module",
"from django.utils.encoding import force_str",
"from django.utils.functional import lazy",
"from django.utils... |
"""
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.
"""
from __future__ import unicode_literals
... | [
[
8,
0,
0.0117,
0.0205,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0234,
0.0029,
0,
0.66,
0.0769,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0292,
0.0029,
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\"\"\"",
"from __future__ im... |
from django.utils.six.moves import html_parser as _html_parser
import re
import sys
current_version = sys.version_info
use_workaround = (
(current_version < (2, 7, 3)) or
(current_version >= (3, 0) and current_version < (3, 2, 3))
)
HTMLParseError = _html_parser.HTMLParseError
if not use_workaround:
HTM... | [
[
1,
0,
0.0088,
0.0088,
0,
0.66,
0,
886,
0,
1,
0,
0,
886,
0,
0
],
[
1,
0,
0.0177,
0.0088,
0,
0.66,
0.1667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0265,
0.0088,
0,
... | [
"from django.utils.six.moves import html_parser as _html_parser",
"import re",
"import sys",
"current_version = sys.version_info",
"use_workaround = (\n (current_version < (2, 7, 3)) or\n (current_version >= (3, 0) and current_version < (3, 2, 3))\n)",
"HTMLParseError = _html_parser.HTMLParseError",... |
from __future__ import unicode_literals
import re
import unicodedata
import warnings
from gzip import GzipFile
from io import BytesIO
from django.utils.encoding import force_text
from django.utils.functional import allow_lazy, SimpleLazyObject
from django.utils import six
from django.utils.six.moves import html_entit... | [
[
1,
0,
0.0023,
0.0023,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.007,
0.0023,
0,
0.66,
0.02,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0093,
0.0023,
0,
0.6... | [
"from __future__ import unicode_literals",
"import re",
"import unicodedata",
"import warnings",
"from gzip import GzipFile",
"from io import BytesIO",
"from django.utils.encoding import force_text",
"from django.utils.functional import allow_lazy, SimpleLazyObject",
"from django.utils import six",
... |
import os
import stat
import sys
from os.path import join, normcase, normpath, abspath, isabs, sep, dirname
from django.utils.encoding import force_text
from django.utils import six
try:
WindowsError = WindowsError
except NameError:
class WindowsError(Exception):
pass
if not six.PY3:
fs_encoding ... | [
[
1,
0,
0.0102,
0.0102,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0204,
0.0102,
0,
0.66,
0.0833,
48,
0,
1,
0,
0,
48,
0,
0
],
[
1,
0,
0.0306,
0.0102,
0,
0.... | [
"import os",
"import stat",
"import sys",
"from os.path import join, normcase, normpath, abspath, isabs, sep, dirname",
"from django.utils.encoding import force_text",
"from django.utils import six",
"try:\n WindowsError = WindowsError\nexcept NameError:\n class WindowsError(Exception):\n p... |
import logging
import traceback
from django.conf import settings
from django.core import mail
from django.views.debug import ExceptionReporter, get_exception_reporter_filter
# Make sure a NullHandler is available
# This was added in Python 2.7/3.2
try:
from logging import NullHandler
except ImportError:
clas... | [
[
1,
0,
0.0068,
0.0068,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0135,
0.0068,
0,
0.66,
0.0833,
423,
0,
1,
0,
0,
423,
0,
0
],
[
1,
0,
0.027,
0.0068,
0,
0... | [
"import logging",
"import traceback",
"from django.conf import settings",
"from django.core import mail",
"from django.views.debug import ExceptionReporter, get_exception_reporter_filter",
"try:\n from logging import NullHandler\nexcept ImportError:\n class NullHandler(logging.Handler):\n def... |
"""
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
import copy
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
Node instances.
"""
# S... | [
[
8,
0,
0.016,
0.0256,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0385,
0.0064,
0,
0.66,
0.5,
739,
0,
1,
0,
0,
739,
0,
0
],
[
3,
0,
0.5224,
0.9487,
0,
0.66,
... | [
"\"\"\"\nA class for storing a tree graph. Primarily used for filter constructs in the\nORM.\n\"\"\"",
"import copy",
"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 either leaf nodes or other\n No... |
"""
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 collections
import itertools
import sys
import warnings
def is_iterable(x):
"A implementation independent... | [
[
8,
0,
0.0652,
0.1087,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1522,
0.0217,
0,
0.66,
0.1111,
193,
0,
1,
0,
0,
193,
0,
0
],
[
1,
0,
0.1739,
0.0217,
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 collections",
"import itertools",
"import sys",
"import warnings",
"def is_iterable(... |
from __future__ import unicode_literals
import datetime
import os
import subprocess
def get_version(version=None):
"Returns a PEP 386-compliant version number from VERSION."
if version is None:
from django import VERSION as version
else:
assert len(version) == 5
assert version[3] i... | [
[
1,
0,
0.0196,
0.0196,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0588,
0.0196,
0,
0.66,
0.2,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0784,
0.0196,
0,
0.6... | [
"from __future__ import unicode_literals",
"import datetime",
"import os",
"import subprocess",
"def get_version(version=None):\n \"Returns a PEP 386-compliant version number from VERSION.\"\n if version is None:\n from django import VERSION as version\n else:\n assert len(version) ==... |
"Functions that help with dynamically creating decorators for views."
from functools import wraps, update_wrapper, WRAPPER_ASSIGNMENTS
class classonlymethod(classmethod):
def __get__(self, instance, owner):
if instance is not None:
raise AttributeError("This method is available only on the vie... | [
[
8,
0,
0.0089,
0.0089,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0268,
0.0089,
0,
0.66,
0.1429,
711,
0,
3,
0,
0,
711,
0,
0
],
[
3,
0,
0.0625,
0.0446,
0,
0.66... | [
"\"Functions that help with dynamically creating decorators for views.\"",
"from functools import wraps, update_wrapper, WRAPPER_ASSIGNMENTS",
"class classonlymethod(classmethod):\n def __get__(self, instance, owner):\n if instance is not None:\n raise AttributeError(\"This method is availa... |
from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils import six
def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
force_grouping=False):
"""
Gets a number (as a number or string), and returns it as a string,
using formats ... | [
[
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.3333,
375,
0,
1,
0,
0,
375,
0,
0
],
[
1,
0,
0.0625,
0.0208,
0,
... | [
"from django.conf import settings",
"from django.utils.safestring import mark_safe",
"from django.utils import six",
"def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',\n force_grouping=False):\n \"\"\"\n Gets a number (as a number or string), and returns it as a st... |
"""Fixer for __unicode__ methods.
Uses the django.utils.encoding.python_2_unicode_compatible decorator.
"""
from __future__ import unicode_literals
from lib2to3 import fixer_base
from lib2to3.fixer_util import find_indentation, Name, syms, touch_import
from lib2to3.pgen2 import token
from lib2to3.pytree import Leaf,... | [
[
8,
0,
0.0694,
0.1111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1667,
0.0278,
0,
0.66,
0.1667,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.2222,
0.0278,
0,
0.66... | [
"\"\"\"Fixer for __unicode__ methods.\n\nUses the django.utils.encoding.python_2_unicode_compatible decorator.\n\"\"\"",
"from __future__ import unicode_literals",
"from lib2to3 import fixer_base",
"from lib2to3.fixer_util import find_indentation, Name, syms, touch_import",
"from lib2to3.pgen2 import token"... |
# This is a copy of the Python logging.config.dictconfig module,
# reproduced with permission. It is provided here for backwards
# compatibility for Python versions prior to 2.7.
#
# Copyright 2009-2010 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# docu... | [
[
1,
0,
0.0378,
0.0018,
0,
0.66,
0,
365,
0,
1,
0,
0,
365,
0,
0
],
[
1,
0,
0.0396,
0.0018,
0,
0.66,
0.0714,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0414,
0.0018,
0,
... | [
"import logging.handlers",
"import re",
"import sys",
"import types",
"from django.utils import six",
"IDENTIFIER = re.compile('^[a-z_][a-z0-9_]*$', re.I)",
"def valid_ident(s):\n m = IDENTIFIER.match(s)\n if not m:\n raise ValueError('Not a valid Python identifier: %r' % s)\n return Tru... |
"""Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2014 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including with... | [
[
8,
0,
0.0015,
0.0015,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.034,
0.0015,
0,
0.66,
0.0128,
616,
0,
1,
0,
0,
616,
0,
0
],
[
1,
0,
0.0355,
0.0015,
0,
0.66,... | [
"\"\"\"Utilities for writing code that runs on Python 2 and 3\"\"\"",
"import operator",
"import sys",
"import types",
"__author__ = \"Benjamin Peterson <benjamin@python.org>\"",
"__version__ = \"1.6.1\"",
"PY2 = sys.version_info[0] == 2",
"PY3 = sys.version_info[0] == 3",
"if PY3:\n string_types... |
"""
Based on "python-archive" -- http://pypi.python.org/pypi/python-archive/
Copyright (c) 2010 Gary Wilson Jr. <gary.wilson@gmail.com> and contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the So... | [
[
8,
0,
0.0558,
0.107,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1116,
0.0047,
0,
0.66,
0.0769,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1163,
0.0047,
0,
0.66,... | [
"\"\"\"\nBased on \"python-archive\" -- http://pypi.python.org/pypi/python-archive/\n\nCopyright (c) 2010 Gary Wilson Jr. <gary.wilson@gmail.com> and contributors.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"),... |
"""Timezone helper functions.
This module uses pytz when it's available and fallbacks when it isn't.
"""
from datetime import datetime, timedelta, tzinfo
from threading import local
import time as _time
try:
import pytz
except ImportError:
pytz = None
from django.conf import settings
from django.utils impor... | [
[
8,
0,
0.0085,
0.0137,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0205,
0.0034,
0,
0.66,
0.0345,
426,
0,
3,
0,
0,
426,
0,
0
],
[
1,
0,
0.0239,
0.0034,
0,
0.66... | [
"\"\"\"Timezone helper functions.\n\nThis module uses pytz when it's available and fallbacks when it isn't.\n\"\"\"",
"from datetime import datetime, timedelta, tzinfo",
"from threading import local",
"import time as _time",
"try:\n import pytz\nexcept ImportError:\n pytz = None",
" import pytz",... |
"""HTML utilities suitable for global use."""
from __future__ import unicode_literals
import re
import string
try:
from urllib.parse import quote, unquote, urlsplit, urlunsplit
except ImportError: # Python 2
from urllib import quote, unquote
from urlparse import urlsplit, urlunsplit
from django.utils... | [
[
8,
0,
0.0037,
0.0037,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.011,
0.0037,
0,
0.66,
0.0208,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0183,
0.0037,
0,
0.66,... | [
"\"\"\"HTML utilities suitable for global use.\"\"\"",
"from __future__ import unicode_literals",
"import re",
"import string",
"try:\n from urllib.parse import quote, unquote, urlsplit, urlunsplit\nexcept ImportError: # Python 2\n from urllib import quote, unquote\n from urlparse import urlspl... |
"""
Django's standard crypto functions and utilities.
"""
from __future__ import unicode_literals
import hmac
import struct
import hashlib
import binascii
import operator
import time
from functools import reduce
# Use the system PRNG if possible
import random
try:
random = random.SystemRandom()
using_sysrando... | [
[
8,
0,
0.0122,
0.0183,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0244,
0.0061,
0,
0.66,
0.0455,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0366,
0.0061,
0,
0.66... | [
"\"\"\"\nDjango's standard crypto functions and utilities.\n\"\"\"",
"from __future__ import unicode_literals",
"import hmac",
"import struct",
"import hashlib",
"import binascii",
"import operator",
"import time",
"from functools import reduce",
"import random",
"try:\n random = random.Syste... |
# This code was mostly based on ipaddr-py
# Copyright 2007 Google Inc. http://code.google.com/p/ipaddr-py/
# Licensed under the Apache License, Version 2.0 (the "License").
from django.core.exceptions import ValidationError
from django.utils.six.moves import xrange
def clean_ipv6_address(ip_str, unpack_ipv4=False,
... | [
[
1,
0,
0.0149,
0.0037,
0,
0.66,
0,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0187,
0.0037,
0,
0.66,
0.1429,
886,
0,
1,
0,
0,
886,
0,
0
],
[
2,
0,
0.1735,
0.2985,
0,
... | [
"from django.core.exceptions import ValidationError",
"from django.utils.six.moves import xrange",
"def clean_ipv6_address(ip_str, unpack_ipv4=False,\n error_message=\"This is not a valid IPv6 address\"):\n \"\"\"\n Cleans a IPv6 address string.\n\n Validity is checked by calling is_valid_ipv6_a... |
# 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.59,... | [
"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 range(level, 1, -1):\n try:\n ... |
# Django 1.5 only supports Python >= 2.6, where the standard library includes
# the json module. Previous version of Django shipped a copy for Python < 2.6.
# For backwards compatibility, we're keeping an importable json module
# at this location, with the same lookup sequence.
# Avoid shadowing the simplejson module... | [
[
1,
0,
0.2581,
0.0323,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.3226,
0.0323,
0,
0.66,
0.25,
358,
0,
1,
0,
0,
358,
0,
0
],
[
8,
0,
0.371,
0.0645,
0,
0.6... | [
"from __future__ import absolute_import",
"import warnings",
"warnings.warn(\"django.utils.simplejson is deprecated; use json instead.\",\n PendingDeprecationWarning)",
"try:\n import simplejson\nexcept ImportError:\n use_simplejson = False\nelse:\n # The system-installed version has pri... |
"""Functions to parse datetime objects."""
# We're using regular expressions rather than time.strptime because:
# - They provide both validation and parsing.
# - They're more flexible for datetimes.
# - The date/datetime/time constructors produce friendlier error messages.
import datetime
import re
from django.utils ... | [
[
8,
0,
0.0122,
0.0122,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0976,
0.0122,
0,
0.66,
0.0909,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.1098,
0.0122,
0,
0.66... | [
"\"\"\"Functions to parse datetime objects.\"\"\"",
"import datetime",
"import re",
"from django.utils import six",
"from django.utils.timezone import utc",
"from django.utils.tzinfo import FixedOffset",
"date_re = re.compile(\n r'(?P<year>\\d{4})-(?P<month>\\d{1,2})-(?P<day>\\d{1,2})$'\n)",
"time_... |
"""
Fixes Python 2.4's failure to deepcopy unbound functions.
"""
import copy
import types
import warnings
warnings.warn("django.utils.copycompat is deprecated; use the native copy module instead",
DeprecationWarning)
# Monkeypatch copy's deepcopy registry to handle functions correctly.
if (hasattr(cop... | [
[
8,
0,
0.1111,
0.1667,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2778,
0.0556,
0,
0.66,
0.1667,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.3333,
0.0556,
0,
0.66... | [
"\"\"\"\nFixes Python 2.4's failure to deepcopy unbound functions.\n\"\"\"",
"import copy",
"import types",
"import warnings",
"warnings.warn(\"django.utils.copycompat is deprecated; use the native copy module instead\",\n DeprecationWarning)",
"if (hasattr(copy, '_deepcopy_dispatch') and typ... |
"""
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 warnings
warnings.warn("django.utils.hashcompat is deprecated; use hashlib instead",
... | [
[
8,
0,
0.2,
0.3333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4667,
0.0667,
0,
0.66,
0.1429,
358,
0,
1,
0,
0,
358,
0,
0
],
[
8,
0,
0.5667,
0.1333,
0,
0.66,
... | [
"\"\"\"\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 warnings",
"warnings.warn(\"django.utils.hashcompat is deprecate... |
import copy
import warnings
from django.utils import six
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 dictionaries, only the
f... | [
[
1,
0,
0.0019,
0.0019,
0,
0.66,
0,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.0039,
0.0019,
0,
0.66,
0.125,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0058,
0.0019,
0,
0... | [
"import copy",
"import warnings",
"from django.utils import six",
"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 one of the given ... |
"""
Syndication feed generation library -- used for generating RSS, etc.
Sample usage:
>>> from django.utils import feedgenerator
>>> feed = feedgenerator.Rss201rev2Feed(
... title="Poynter E-Media Tidbits",
... link="http://www.poynter.org/column.asp?id=31",
... description="A group Weblog by the sharpes... | [
[
8,
0,
0.0308,
0.0591,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0617,
0.0026,
0,
0.66,
0.0526,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0668,
0.0026,
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=\"Poynter E-Media Tidbits\",",
"from __future__ import unicode_literals",
"import datetime",
"try:\n from url... |
# 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.1087,
0.0109,
0,
0.66,
0,
426,
0,
2,
0,
0,
426,
0,
0
],
[
1,
0,
0.1196,
0.0109,
0,
0.66,
0.1111,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1304,
0.0109,
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... |
"""Translation helper functions."""
from __future__ import unicode_literals
import locale
import os
import re
import sys
import gettext as gettext_module
from threading import local
from django.utils.importlib import import_module
from django.utils.encoding import force_str, force_text
from django.utils._os import up... | [
[
8,
0,
0.0016,
0.0016,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0033,
0.0016,
0,
0.66,
0.0185,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0065,
0.0016,
0,
0.66... | [
"\"\"\"Translation helper functions.\"\"\"",
"from __future__ import unicode_literals",
"import locale",
"import os",
"import re",
"import sys",
"import gettext as gettext_module",
"from threading import local",
"from django.utils.importlib import import_module",
"from django.utils.encoding import... |
# 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.
from django.conf import settings
from django.utils.encoding import force_text
from django.ut... | [
[
1,
0,
0.0794,
0.0159,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0952,
0.0159,
0,
0.66,
0.0526,
96,
0,
1,
0,
0,
96,
0,
0
],
[
1,
0,
0.1111,
0.0159,
0,
0.... | [
"from django.conf import settings",
"from django.utils.encoding import force_text",
"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",
" if number == 1: retu... |
"""
Internationalization support.
"""
from __future__ import unicode_literals
from django.utils.encoding import force_text
from django.utils.functional import lazy
from django.utils import six
__all__ = [
'activate', 'deactivate', 'override', 'deactivate_all',
'get_language', 'get_language_from_request',
... | [
[
8,
0,
0.0133,
0.02,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0267,
0.0067,
0,
0.66,
0.0286,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.04,
0.0067,
0,
0.66,
... | [
"\"\"\"\nInternationalization support.\n\"\"\"",
"from __future__ import unicode_literals",
"from django.utils.encoding import force_text",
"from django.utils.functional import lazy",
"from django.utils import six",
"__all__ = [\n 'activate', 'deactivate', 'override', 'deactivate_all',\n 'get_langua... |
"""
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.0374,
0.0709,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0748,
0.0039,
0,
0.66,
0.0417,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0827,
0.0039,
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 __future__ import unicode_literals
from calendar import timegm
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, Te... | [
[
1,
0,
0.0051,
0.0051,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0153,
0.0051,
0,
0.66,
0.0667,
917,
0,
1,
0,
0,
917,
0,
0
],
[
1,
0,
0.0255,
0.0051,
0,
... | [
"from __future__ import unicode_literals",
"from calendar import timegm",
"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 ... |
"""
Czech-specific form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.cz.cz_regions import REGION_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Select, RegexField, Field... | [
[
8,
0,
0.0147,
0.0221,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0368,
0.0074,
0,
0.66,
0.0769,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0515,
0.0074,
0,
0.66... | [
"\"\"\"\nCzech-specific form helpers\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"import re",
"from django.contrib.localflavor.cz.cz_regions import REGION_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms... |
"""
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 __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.in_.in_states import STATES_NORMALIZED, STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field,... | [
[
8,
0,
0.0174,
0.0261,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0435,
0.0087,
0,
0.66,
0.0769,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0609,
0.0087,
0,
0.66... | [
"\"\"\"\nIndia-specific Form helpers.\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"import re",
"from django.contrib.localflavor.in_.in_states import STATES_NORMALIZED, STATE_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
... |
"""
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.0301,
0.0526,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2105,
0.2932,
0,
0.66,
0.5,
633,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.6842,
0.6391,
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
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.nl.nl_provinces import PROVINCE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select
from djang... | [
[
8,
0,
0.0192,
0.0288,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0481,
0.0096,
0,
0.66,
0.0667,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0673,
0.0096,
0,
0.66... | [
"\"\"\"\nNL-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"import re",
"from django.contrib.localflavor.nl.nl_provinces import PROVINCE_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.form... |
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')),"
] |
from __future__ import absolute_import, unicode_literals
import datetime
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.contrib.localflavor.mk.mk_choices im... | [
[
1,
0,
0.0098,
0.0098,
0,
0.66,
0,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0294,
0.0098,
0,
0.66,
0.1111,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.049,
0.0098,
0,
0... | [
"from __future__ import absolute_import, unicode_literals",
"import datetime",
"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.cont... |
# -*- coding: utf-8 -*-
"""
Macedonian municipalities per the reorganization from 2004.
"""
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
MK_MUNICIPALITIES = (
('AD', _('Aerodrom')),
('AR', _('Aračinovo')),
('BR', _('Berovo')),
('TL', _('Bitola')),
... | [
[
8,
0,
0.0319,
0.0319,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0532,
0.0106,
0,
0.66,
0.3333,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0745,
0.0106,
0,
0.66... | [
"\"\"\"\nMacedonian municipalities per the reorganization from 2004.\n\"\"\"",
"from __future__ import unicode_literals",
"from django.utils.translation import ugettext_lazy as _",
"MK_MUNICIPALITIES = (\n ('AD', _('Aerodrom')),\n ('AR', _('Aračinovo')),\n ('BR', _('Berovo')),\n ('TL', _('Bitola')... |
from django.db.models.fields import CharField
from django.utils.translation import ugettext_lazy as _
from django.contrib.localflavor.mk.mk_choices import MK_MUNICIPALITIES
from django.contrib.localflavor.mk.forms import (UMCNField as UMCNFormField,
MKIdentityCardNumberField as MKIdentityCardNumberFormField)
cla... | [
[
1,
0,
0.0227,
0.0227,
0,
0.66,
0,
5,
0,
1,
0,
0,
5,
0,
0
],
[
1,
0,
0.0455,
0.0227,
0,
0.66,
0.1667,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0909,
0.0227,
0,
0.66... | [
"from django.db.models.fields import CharField",
"from django.utils.translation import ugettext_lazy as _",
"from django.contrib.localflavor.mk.mk_choices import MK_MUNICIPALITIES",
"from django.contrib.localflavor.mk.forms import (UMCNField as UMCNFormField,\n MKIdentityCardNumberField as MKIdentityCardNu... |
"""
Iceland specific form helpers.
"""
from __future__ import absolute_import, unicode_literals
from django.contrib.localflavor.is_.is_postalcodes import IS_POSTALCODES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField
from django.forms... | [
[
8,
0,
0.0233,
0.0349,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0581,
0.0116,
0,
0.66,
0.0909,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0814,
0.0116,
0,
0.66... | [
"\"\"\"\nIceland specific form helpers.\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"from django.contrib.localflavor.is_.is_postalcodes import IS_POSTALCODES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
IS_POSTALCODES = (
('101', '101 Reykjavík'),
('103', '103 Reykjavík'),
('104', '104 Reykjavík'),
('105', '105 Reykjavík'),
('107', '107 Reykjavík'),
('108', '108 Reykjavík'),
('109', '109 Reykjavík'),
('110', '110 Reykjavík... | [
[
1,
0,
0.0132,
0.0066,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.5132,
0.9803,
0,
0.66,
1,
247,
0,
0,
0,
0,
0,
8,
0
]
] | [
"from __future__ import unicode_literals",
"IS_POSTALCODES = (\n ('101', '101 Reykjavík'),\n ('103', '103 Reykjavík'),\n ('104', '104 Reykjavík'),\n ('105', '105 Reykjavík'),\n ('107', '107 Reykjavík'),\n ('108', '108 Reykjavík'),\n ('109', '109 Reykjavík'),"
] |
# -*- coding: utf-8 -*-
"""
Swedish specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
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.se_counties import COUNTY... | [
[
8,
0,
0.0186,
0.0186,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0311,
0.0062,
0,
0.66,
0.0714,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0435,
0.0062,
0,
0.66... | [
"\"\"\"\nSwedish specific Form helpers\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"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.se_count... |
# -*- 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 __future__ import unicode_literals
from django.utils.translation import u... | [
[
8,
0,
0.1622,
0.2432,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2973,
0.027,
0,
0.66,
0.3333,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.3514,
0.027,
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 __future__ import unicode_literals",
"from django.utils.translation import ugettex... |
import datetime
from django.utils import six
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:
... | [
[
1,
0,
0.0119,
0.0119,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0238,
0.0119,
0,
0.66,
0.1667,
944,
0,
1,
0,
0,
944,
0,
0
],
[
2,
0,
0.1548,
0.2262,
0,
... | [
"import datetime",
"from django.utils import six",
"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)"... |
"""
IT-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.it.it_province import PROVINCE_CHOICES
from django.contrib.localflavor.it.it_region import REGION_CHOICES
from django.contrib.localflavor.it.util import ssn_check_digit, vat_number_chec... | [
[
8,
0,
0.0227,
0.0341,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0568,
0.0114,
0,
0.66,
0.0667,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0795,
0.0114,
0,
0.66... | [
"\"\"\"\nIT-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"import re",
"from django.contrib.localflavor.it.it_province import PROVINCE_CHOICES",
"from django.contrib.localflavor.it.it_region import REGION_CHOICES",
"from django.contrib.localflavor.it.util impo... |
# -*- coding: utf-8 -*
from __future__ import unicode_literals
REGION_CHOICES = (
('ABR', 'Abruzzo'),
('BAS', 'Basilicata'),
('CAL', 'Calabria'),
('CAM', 'Campania'),
('EMR', 'Emilia-Romagna'),
('FVG', 'Friuli-Venezia Giulia'),
('LAZ', 'Lazio'),
('LIG', 'Liguria'),
('LOM', 'Lombardi... | [
[
1,
0,
0.08,
0.04,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.58,
0.88,
0,
0.66,
1,
868,
0,
0,
0,
0,
0,
8,
0
]
] | [
"from __future__ import unicode_literals",
"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_text
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7,
... | [
[
1,
0,
0.0227,
0.0227,
0,
0.66,
0,
96,
0,
1,
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.88,
... | [
"from django.utils.encoding import smart_text",
"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, 'F': 5, 'G':... |
# -*- coding: utf-8 -*
from __future__ import unicode_literals
PROVINCE_CHOICES = (
('AG', 'Agrigento'),
('AL', 'Alessandria'),
('AN', 'Ancona'),
('AO', 'Aosta'),
('AR', 'Arezzo'),
('AP', 'Ascoli Piceno'),
('AT', 'Asti'),
('AV', 'Avellino'),
('BA', 'Bari'),
('BT', 'Barletta-Andr... | [
[
1,
0,
0.0174,
0.0087,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.5174,
0.9739,
0,
0.66,
1,
540,
0,
0,
0,
0,
0,
8,
0
]
] | [
"from __future__ import unicode_literals",
"PROVINCE_CHOICES = (\n ('AG', 'Agrigento'),\n ('AL', 'Alessandria'),\n ('AN', 'Ancona'),\n ('AO', 'Aosta'),\n ('AR', 'Arezzo'),\n ('AP', 'Ascoli Piceno'),\n ('AT', 'Asti'),"
] |
"""
GB-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.gb.gb_regions import GB_NATIONS_CHOICES, GB_REGION_CHOICES
from django.forms.fields import CharField, Select
from django.forms import ValidationError
from django.utils.translation impor... | [
[
8,
0,
0.0364,
0.0545,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0909,
0.0182,
0,
0.66,
0.1111,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.1273,
0.0182,
0,
0.66... | [
"\"\"\"\nGB-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"import re",
"from django.contrib.localflavor.gb.gb_regions import GB_NATIONS_CHOICES, GB_REGION_CHOICES",
"from django.forms.fields import CharField, Select",
"from django.forms import ValidationError"... |
"""
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... |
"""
JP-specific Form helpers
"""
from __future__ import absolute_import
from django.contrib.localflavor.jp.jp_prefectures import JP_PREFECTURES
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
class JPPostalCodeField(RegexField):
"""
A form field tha... | [
[
8,
0,
0.0513,
0.0769,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1282,
0.0256,
0,
0.66,
0.1667,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1795,
0.0256,
0,
0.66... | [
"\"\"\"\nJP-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import",
"from django.contrib.localflavor.jp.jp_prefectures import JP_PREFECTURES",
"from django.forms.fields import RegexField, Select",
"from django.utils.translation import ugettext_lazy as _",
"class JPPostalCodeField(RegexFi... |
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 __future__ import absolute_import, unicode_literals
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 i... | [
[
8,
0,
0.0206,
0.0309,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0515,
0.0103,
0,
0.66,
0.1111,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0722,
0.0103,
0,
0.66... | [
"\"\"\"\nChile specific form helpers.\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"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_la... |
# -*- 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.
"""
from __future__ import unicode_literals
REGION_CHOICES = (
('RM', 'Región Metropolitana de Santiago'),
('I', 'Región de T... | [
[
8,
0,
0.1731,
0.2308,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3077,
0.0385,
0,
0.66,
0.5,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.6923,
0.6538,
0,
0.66,
... | [
"\"\"\"\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\"\"\"",
"from __future__ import unicode_literals",
"REGION_CHOICES = (\n ('RM', 'Región Metropolitana de Santiago'),\n ('I', 'Región d... |
"""
AT-specific Form helpers
"""
from __future__ import unicode_literals
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{... | [
[
8,
0,
0.029,
0.0435,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.058,
0.0145,
0,
0.66,
0.1,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0725,
0.0145,
0,
0.66,
... | [
"\"\"\"\nAT-specific Form helpers\n\"\"\"",
"from __future__ import unicode_literals",
"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_l... |
# -*- 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 __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.de.de_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from... | [
[
8,
0,
0.0227,
0.0341,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0568,
0.0114,
0,
0.66,
0.0909,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0795,
0.0114,
0,
0.66... | [
"\"\"\"\nDE-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"import re",
"from django.contrib.localflavor.de.de_states import STATE_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fiel... |
# -*- 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 __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.au.au_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Sel... | [
[
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.0833,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.1167,
0.0167,
0,
0.66,
... | [
"\"\"\"\nAustralian-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"import re",
"from django.contrib.localflavor.au.au_states import STATE_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.fo... |
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from django.contrib.localflavor.au.au_states import STATE_CHOICES
from django.contrib.localflavor.au import forms
class AUStateField(CharField):
description = _("Australian State")
def __init__(self, *args,... | [
[
1,
0,
0.0233,
0.0233,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0465,
0.0233,
0,
0.66,
0.1667,
5,
0,
1,
0,
0,
5,
0,
0
],
[
1,
0,
0.093,
0.0233,
0,
0.66,... | [
"from django.utils.translation import ugettext_lazy as _",
"from django.db.models.fields import CharField",
"from django.contrib.localflavor.au.au_states import STATE_CHOICES",
"from django.contrib.localflavor.au import forms",
"class AUStateField(CharField):\n\n description = _(\"Australian State\")\n\n... |
"""
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 __future__ import unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy ... | [
[
8,
0,
0.04,
0.06,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.08,
0.02,
0,
0.66,
0.1,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.12,
0.02,
0,
0.66,
0.2,
... | [
"\"\"\"\nPT-specific Form helpers\n\"\"\"",
"from __future__ import unicode_literals",
"import re",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField",
"from django.utils.encoding import smart_text",
"from ... |
# -*- coding: utf-8 -*-
"""
HR-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import datetime
import re
from django.contrib.localflavor.hr.hr_choices import (
HR_LICENSE_PLATE_PREFIX_CHOICES, HR_COUNTY_CHOICES,
HR_PHONE_NUMBER_PREFIX_CHOICES)
from django.core.validators imp... | [
[
8,
0,
0.0106,
0.0106,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0177,
0.0035,
0,
0.66,
0.0417,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0248,
0.0035,
0,
0.66... | [
"\"\"\"\nHR-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"import datetime",
"import re",
"from django.contrib.localflavor.hr.hr_choices import (\n HR_LICENSE_PLATE_PREFIX_CHOICES, HR_COUNTY_CHOICES,\n HR_PHONE_NUMBER_PREFIX_CHOICES)",
"from django.core.... |
# -*- coding: utf-8 -*-
"""
Sources:
Croatian Counties: http://en.wikipedia.org/wiki/ISO_3166-2:HR
Croatia doesn't have official abbreviations for counties.
The ones provided are in common use.
"""
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
HR_COUNTY_C... | [
[
8,
0,
0.0446,
0.0625,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0804,
0.0089,
0,
0.66,
0.1429,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0982,
0.0089,
0,
0.66... | [
"\"\"\"\nSources:\n Croatian Counties: http://en.wikipedia.org/wiki/ISO_3166-2:HR\n\n Croatia doesn't have official abbreviations for counties.\n The ones provided are in common use.\n\"\"\"",
"from __future__ import unicode_literals",
"from django.utils.translation import ugettext_lazy as _",
"HR_CO... |
# -*- coding: utf-8 -*-
"""
AR-specific Form helpers.
"""
from __future__ import absolute_import, unicode_literals
from django.contrib.localflavor.ar.ar_provinces import PROVINCE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField... | [
[
8,
0,
0.0234,
0.0234,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0469,
0.0078,
0,
0.66,
0.1,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0625,
0.0078,
0,
0.66,
... | [
"\"\"\"\nAR-specific Form helpers.\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"from django.contrib.localflavor.ar.ar_provinces import PROVINCE_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields impor... |
# -*- 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.
"""
from __future__ import unicode... | [
[
8,
0,
0.1486,
0.2162,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2703,
0.027,
0,
0.66,
0.5,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.6622,
0.7027,
0,
0.66,
... | [
"\"\"\"\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\"\"\"",
"from __future__ import unicode_... |
# -*- coding: utf-8 -*-
"""
BR-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.br.br_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field,... | [
[
8,
0,
0.0181,
0.0181,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0361,
0.006,
0,
0.66,
0.0625,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0482,
0.006,
0,
0.66,
... | [
"\"\"\"\nBR-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"import re",
"from django.contrib.localflavor.br.br_states import STATE_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fiel... |
# -*- 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.
"""
from __future__ import unicode_literals
STATE_CHOICES = (
('AC', 'Acre'),
('AL', 'Alagoas'),
('AP... | [
[
8,
0,
0.1184,
0.1579,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2105,
0.0263,
0,
0.66,
0.5,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.6316,
0.7632,
0,
0.66,
... | [
"\"\"\"\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\"\"\"",
"from __future__ import unicode_literals",
"STATE_CHOICES = (\n ('AC', 'Acre'),\n ('AL', 'Alagoas'),\n ... |
"""
Slovak-specific form helpers
"""
from __future__ import absolute_import, unicode_literals
from django.contrib.localflavor.sk.sk_districts import DISTRICT_CHOICES
from django.contrib.localflavor.sk.sk_regions import REGION_CHOICES
from django.forms.fields import Select, RegexField
from django.utils.translation imp... | [
[
8,
0,
0.0435,
0.0652,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1087,
0.0217,
0,
0.66,
0.125,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.1522,
0.0217,
0,
0.66,... | [
"\"\"\"\nSlovak-specific form helpers\n\"\"\"",
"from __future__ import absolute_import, unicode_literals",
"from django.contrib.localflavor.sk.sk_districts import DISTRICT_CHOICES",
"from django.contrib.localflavor.sk.sk_regions import REGION_CHOICES",
"from django.forms.fields import Select, RegexField",
... |
"""
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')),\... |
# -*- coding: utf-8 -*-
"""
Mexican-specific form helpers.
"""
from __future__ import unicode_literals
import re
from django.forms import ValidationError
from django.forms.fields import Select, RegexField
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from django.core.validators i... | [
[
8,
0,
0.0132,
0.0132,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.022,
0.0044,
0,
0.66,
0.0588,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0264,
0.0044,
0,
0.66,... | [
"\"\"\"\nMexican-specific form helpers.\n\"\"\"",
"from __future__ import unicode_literals",
"import re",
"from django.forms import ValidationError",
"from django.forms.fields import Select, RegexField",
"from django.utils import six",
"from django.utils.translation import ugettext_lazy as _",
"from d... |
# -*- 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 __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
# All 31 states, plus the `D... | [
[
8,
0,
0.0978,
0.1304,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1739,
0.0217,
0,
0.66,
0.3333,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.2174,
0.0217,
0,
0.66... | [
"\"\"\"\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 __future__ import unicode_literals",
"from django.utils.translation import ugettext_lazy as _",
"STATE_CHOICES = (\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.