code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
import re
from django.utils.text import compress_sequence, compress_string
from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accor... | [
[
1,
0,
0.0192,
0.0192,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0577,
0.0192,
0,
0.66,
0.25,
590,
0,
2,
0,
0,
590,
0,
0
],
[
1,
0,
0.0769,
0.0192,
0,
0.... | [
"import re",
"from django.utils.text import compress_sequence, compress_string",
"from django.utils.cache import patch_vary_headers",
"re_accepts_gzip = re.compile(r'\\bgzip\\b')",
"class GZipMiddleware(object):\n \"\"\"\n This middleware compresses content if the browser allows gzip compression.\n ... |
from django.conf import settings
from django import http
class XViewMiddleware(object):
"""
Adds an X-View header to internal HEAD requests -- used by the documentation system.
"""
def process_view(self, request, view_func, view_args, view_kwargs):
"""
If the request method is HEAD and ... | [
[
1,
0,
0.0435,
0.0435,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.087,
0.0435,
0,
0.66,
0.5,
294,
0,
1,
0,
0,
294,
0,
0
],
[
3,
0,
0.587,
0.8696,
0,
0.66,... | [
"from django.conf import settings",
"from django import http",
"class XViewMiddleware(object):\n \"\"\"\n Adds an X-View header to internal HEAD requests -- used by the documentation system.\n \"\"\"\n def process_view(self, request, view_func, view_args, view_kwargs):\n \"\"\"\n If th... |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
from __future__ import unicode_literals
import hashlib
import logging
import re
import random
from django.conf import settings
from django.core.urlresolvers import g... | [
[
8,
0,
0.0153,
0.0262,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0306,
0.0044,
0,
0.66,
0.0435,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0393,
0.0044,
0,
0.66... | [
"\"\"\"\nCross Site Request Forgery Middleware.\n\nThis module provides a middleware that implements protection\nagainst request forgeries from other sites.\n\"\"\"",
"from __future__ import unicode_literals",
"import hashlib",
"import logging",
"import re",
"import random",
"from django.conf import set... |
import hashlib
import logging
import re
from django.conf import settings
from django import http
from django.core.mail import mail_managers
from django.utils.http import urlquote
from django.utils import six
from django.core import urlresolvers
logger = logging.getLogger('django.request')
class CommonMiddleware(ob... | [
[
1,
0,
0.006,
0.006,
0,
0.66,
0,
154,
0,
1,
0,
0,
154,
0,
0
],
[
1,
0,
0.012,
0.006,
0,
0.66,
0.0833,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.018,
0.006,
0,
0.66,
... | [
"import hashlib",
"import logging",
"import re",
"from django.conf import settings",
"from django import http",
"from django.core.mail import mail_managers",
"from django.utils.http import urlquote",
"from django.utils import six",
"from django.core import urlresolvers",
"logger = logging.getLogge... |
from django.db import transaction
class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_on_response activated - that way a save() doesn't do a direct
commit, the commit is done when a successful response is created. If an
exc... | [
[
1,
0,
0.0217,
0.0217,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
3,
0,
0.5326,
0.9565,
0,
0.66,
1,
538,
0,
3,
0,
0,
186,
0,
11
],
[
8,
1,
0.1413,
0.1304,
1,
0.57,
... | [
"from django.db import transaction",
"class TransactionMiddleware(object):\n \"\"\"\n Transaction middleware. If this is enabled, each view function will be run\n with commit_on_response activated - that way a save() doesn't do a direct\n commit, the commit is done when a successful response is create... |
"""
Clickjacking Protection Middleware.
This module provides a middleware that implements protection against a
malicious site loading resources from your site in a hidden frame.
"""
from django.conf import settings
class XFrameOptionsMiddleware(object):
"""
Middleware that sets the X-Frame-Options HTTP heade... | [
[
8,
0,
0.0686,
0.1176,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1569,
0.0196,
0,
0.66,
0.5,
128,
0,
1,
0,
0,
128,
0,
0
],
[
3,
0,
0.598,
0.8235,
0,
0.66,
... | [
"\"\"\"\nClickjacking Protection Middleware.\n\nThis module provides a middleware that implements protection against a\nmalicious site loading resources from your site in a hidden frame.\n\"\"\"",
"from django.conf import settings",
"class XFrameOptionsMiddleware(object):\n \"\"\"\n Middleware that sets t... |
"""
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE_CLASSES = [
'django.middleware.cache.UpdateCa... | [
[
8,
0,
0.1174,
0.23,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2394,
0.0047,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.2441,
0.0047,
0,
0.66,
... | [
"\"\"\"\nCache middleware. If enabled, each Django-powered page will be cached based on\nURL. The canonical way to enable cache middleware is to set\n``UpdateCacheMiddleware`` as your first piece of middleware, and\n``FetchFromCacheMiddleware`` as the last::\n\n MIDDLEWARE_CLASSES = [\n 'django.middleware... |
from django.template import Library
from django.template.defaulttags import url as default_url, ssi as default_ssi
register = Library()
@register.tag
def ssi(parser, token):
# Used for deprecation path during 1.3/1.4, will be removed in 2.0
return default_ssi(parser, token)
@register.tag
def url(parser, toke... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0.25,
629,
0,
2,
0,
0,
629,
0,
0
],
[
14,
0,
0.2857,
0.0714,
0,
0... | [
"from django.template import Library",
"from django.template.defaulttags import url as default_url, ssi as default_ssi",
"register = Library()",
"def ssi(parser, token):\n # Used for deprecation path during 1.3/1.4, will be removed in 2.0\n return default_ssi(parser, token)",
" return default_ssi(p... |
from django.template import Node
from django.template import TemplateSyntaxError, Library
from django.utils import formats
from django.utils.encoding import force_text
register = Library()
@register.filter(is_safe=False)
def localize(value):
"""
Forces a value to be rendered as a localized value,
regardle... | [
[
1,
0,
0.0161,
0.0161,
0,
0.66,
0,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.0323,
0.0161,
0,
0.66,
0.125,
213,
0,
2,
0,
0,
213,
0,
0
],
[
1,
0,
0.0484,
0.0161,
0,
0... | [
"from django.template import Node",
"from django.template import TemplateSyntaxError, Library",
"from django.utils import formats",
"from django.utils.encoding import force_text",
"register = Library()",
"def localize(value):\n \"\"\"\n Forces a value to be rendered as a localized value,\n regard... |
try:
from urllib.parse import urljoin
except ImportError: # Python 2
from urlparse import urljoin
from django import template
from django.template.base import Node
from django.utils.encoding import iri_to_uri
register = template.Library()
class PrefixNode(template.Node):
def __repr__(self):
... | [
[
7,
0,
0.0155,
0.0248,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0124,
0.0062,
1,
0.36,
0,
630,
0,
1,
0,
0,
630,
0,
0
],
[
1,
1,
0.0248,
0.0062,
1,
0.36,
... | [
"try:\n from urllib.parse import urljoin\nexcept ImportError: # Python 2\n from urlparse import urljoin",
" from urllib.parse import urljoin",
" from urlparse import urljoin",
"from django import template",
"from django.template.base import Node",
"from django.utils.encoding import iri_to_... |
from datetime import datetime, tzinfo
try:
import pytz
except ImportError:
pytz = None
from django.template import Node
from django.template import TemplateSyntaxError, Library
from django.utils import six
from django.utils import timezone
register = Library()
# HACK: datetime is an old-style class, create... | [
[
1,
0,
0.0051,
0.0051,
0,
0.66,
0,
426,
0,
2,
0,
0,
426,
0,
0
],
[
7,
0,
0.0228,
0.0203,
0,
0.66,
0.0625,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0203,
0.0051,
1,
0.48... | [
"from datetime import datetime, tzinfo",
"try:\n import pytz\nexcept ImportError:\n pytz = None",
" import pytz",
" pytz = None",
"from django.template import Node",
"from django.template import TemplateSyntaxError, Library",
"from django.utils import six",
"from django.utils import timezo... |
from __future__ import unicode_literals
import re
from django.template import (Node, Variable, TemplateSyntaxError,
TokenParser, Library, TOKEN_TEXT, TOKEN_VAR)
from django.template.base import _render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import six
from django.ut... | [
[
1,
0,
0.0021,
0.0021,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0042,
0.0021,
0,
0.66,
0.0385,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0094,
0.0042,
0,
... | [
"from __future__ import unicode_literals",
"import re",
"from django.template import (Node, Variable, TemplateSyntaxError,\n TokenParser, Library, TOKEN_TEXT, TOKEN_VAR)",
"from django.template.base import _render_value_in_context",
"from django.template.defaulttags import token_kwargs",
"from django.u... |
from __future__ import unicode_literals
import hashlib
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_bytes
from django.utils.http import urlquote
re... | [
[
1,
0,
0.0154,
0.0154,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0462,
0.0154,
0,
0.66,
0.1111,
154,
0,
1,
0,
0,
154,
0,
0
],
[
1,
0,
0.0615,
0.0154,
0,
... | [
"from __future__ import unicode_literals",
"import hashlib",
"from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist",
"from django.template import resolve_variable",
"from django.core.cache import cache",
"from django.utils.encoding import force_bytes",
"from dja... |
"""
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
import decimal
import yaml
from io import StringIO
from django.db import models
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import Serializer as PythonSerializer
fr... | [
[
8,
0,
0.0448,
0.0746,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1045,
0.0149,
0,
0.66,
0.0833,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.1194,
0.0149,
0,
0.66... | [
"\"\"\"\nYAML serializer.\n\nRequires PyYaml (http://pyyaml.org/), but that's checked for in __init__.\n\"\"\"",
"import decimal",
"import yaml",
"from io import StringIO",
"from django.db import models",
"from django.core.serializers.base import DeserializationError",
"from django.core.serializers.pyth... |
"""
Serialize data to/from JSON
"""
# Avoid shadowing the standard library json module
from __future__ import absolute_import
import datetime
import decimal
import json
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import Serializer as PythonSerializer
from django.... | [
[
8,
0,
0.0187,
0.028,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0561,
0.0093,
0,
0.66,
0.0769,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0748,
0.0093,
0,
0.66,... | [
"\"\"\"\nSerialize data to/from JSON\n\"\"\"",
"from __future__ import absolute_import",
"import datetime",
"import decimal",
"import json",
"from django.core.serializers.base import DeserializationError",
"from django.core.serializers.python import Serializer as PythonSerializer",
"from django.core.s... |
"""
XML serializer.
"""
from __future__ import unicode_literals
from django.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.encoding import smart_text
from xml.dom import pulldom
from x... | [
[
8,
0,
0.0052,
0.0078,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0129,
0.0026,
0,
0.66,
0.0588,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0181,
0.0026,
0,
0.66... | [
"\"\"\"\nXML serializer.\n\"\"\"",
"from __future__ import unicode_literals",
"from django.conf import settings",
"from django.core.serializers import base",
"from django.db import models, DEFAULT_DB_ALIAS",
"from django.utils.xmlutils import SimplerXMLGenerator",
"from django.utils.encoding import smar... |
"""
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from __future__ import unicode_literals
from django.conf import settings
from django.core.serializers import base
from django.db... | [
[
8,
0,
0.0195,
0.0325,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.039,
0.0065,
0,
0.66,
0.1111,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0519,
0.0065,
0,
0.66,... | [
"\"\"\"\nA Python \"serializer\". Doesn't do much serializing per se -- just converts to\nand from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for\nother serializers.\n\"\"\"",
"from __future__ import unicode_literals",
"from django.conf import settings",
"from django.core.seriali... |
"""
Module for abstract serializer/unserializer base classes.
"""
from django.db import models
from django.utils.encoding import smart_text
from django.utils import six
class SerializerDoesNotExist(KeyError):
"""The requested serializer was not found."""
pass
class SerializationError(Exception):
"""Somet... | [
[
8,
0,
0.0116,
0.0174,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0291,
0.0058,
0,
0.66,
0.1111,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0349,
0.0058,
0,
0.66,
... | [
"\"\"\"\nModule for abstract serializer/unserializer base classes.\n\"\"\"",
"from django.db import models",
"from django.utils.encoding import smart_text",
"from django.utils import six",
"class SerializerDoesNotExist(KeyError):\n \"\"\"The requested serializer was not found.\"\"\"\n pass",
" \"... |
"""
Interfaces for serializing Django objects.
Usage::
from django.core import serializers
json = serializers.serialize("json", some_query_set)
objects = list(serializers.deserialize("json", json))
To add your own serializers, use the SERIALIZATION_MODULES setting::
SERIALIZATION_MODULES = {
... | [
[
8,
0,
0.072,
0.136,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.152,
0.008,
0,
0.66,
0.0625,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.16,
0.008,
0,
0.66,
0... | [
"\"\"\"\nInterfaces for serializing Django objects.\n\nUsage::\n\n from django.core import serializers\n json = serializers.serialize(\"json\", some_query_set)\n objects = list(serializers.deserialize(\"json\", json))",
"from django.conf import settings",
"from django.utils import importlib",
"from d... |
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
from __future__ i... | [
[
8,
0,
0.06,
0.1067,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.12,
0.0133,
0,
0.66,
0.0769,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1467,
0.0133,
0,
0.66,
... | [
"\"\"\"\nA set of request processors that return dictionaries to be merged into a\ntemplate context. Each function takes the request object as its only parameter\nand returns a dictionary to add to the context.\n\nThese are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by\nRequestContext.\n\"\"\"... |
from __future__ import unicode_literals
import mimetypes
import os
import random
import sys
import time
from email import charset as Charset, encoders as Encoders
from email.generator import Generator
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBa... | [
[
1,
0,
0.0027,
0.0027,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.008,
0.0027,
0,
0.66,
0.037,
583,
0,
1,
0,
0,
583,
0,
0
],
[
1,
0,
0.0107,
0.0027,
0,
0.... | [
"from __future__ import unicode_literals",
"import mimetypes",
"import os",
"import random",
"import sys",
"import time",
"from email import charset as Charset, encoders as Encoders",
"from email.generator import Generator",
"from email.mime.text import MIMEText",
"from email.mime.multipart import... |
"""
Email message and email sending related helper functions.
"""
import socket
# Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of
# seconds, which slows down the restart of the server.
class CachedDnsName(object):
def __str__(self):
return self.get_fqdn()
def get_fqdn(sel... | [
[
8,
0,
0.1053,
0.1579,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2632,
0.0526,
0,
0.66,
0.3333,
687,
0,
1,
0,
0,
687,
0,
0
],
[
3,
0,
0.7105,
0.4211,
0,
0.66... | [
"\"\"\"\nEmail message and email sending related helper functions.\n\"\"\"",
"import socket",
"class CachedDnsName(object):\n def __str__(self):\n return self.get_fqdn()\n\n def get_fqdn(self):\n if not hasattr(self, '_fqdn'):\n self._fqdn = socket.getfqdn()\n return self._... |
"""
Dummy email backend that does nothing.
"""
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def send_messages(self, email_messages):
return len(email_messages)
| [
[
8,
0,
0.2222,
0.3333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.5556,
0.1111,
0,
0.66,
0.5,
502,
0,
1,
0,
0,
502,
0,
0
],
[
3,
0,
0.8889,
0.3333,
0,
0.66,
... | [
"\"\"\"\nDummy email backend that does nothing.\n\"\"\"",
"from django.core.mail.backends.base import BaseEmailBackend",
"class EmailBackend(BaseEmailBackend):\n def send_messages(self, email_messages):\n return len(email_messages)",
" def send_messages(self, email_messages):\n return len(... |
"""
Email backend that writes messages to console instead of sending them.
"""
import sys
import threading
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
self.stream = kwargs.pop('stream', sys.stdout)
self._loc... | [
[
8,
0,
0.0625,
0.0938,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.125,
0.0312,
0,
0.66,
0.25,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.1562,
0.0312,
0,
0.66,
... | [
"\"\"\"\nEmail backend that writes messages to console instead of sending them.\n\"\"\"",
"import sys",
"import threading",
"from django.core.mail.backends.base import BaseEmailBackend",
"class EmailBackend(BaseEmailBackend):\n def __init__(self, *args, **kwargs):\n self.stream = kwargs.pop('strea... |
"""SMTP email backend class."""
import smtplib
import ssl
import threading
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
from django.core.mail.utils import DNS_NAME
from django.core.mail.message import sanitize_address
from django.utils.encoding import force_bytes
class... | [
[
8,
0,
0.0085,
0.0085,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0169,
0.0085,
0,
0.66,
0.1111,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0254,
0.0085,
0,
0.66... | [
"\"\"\"SMTP email backend class.\"\"\"",
"import smtplib",
"import ssl",
"import threading",
"from django.conf import settings",
"from django.core.mail.backends.base import BaseEmailBackend",
"from django.core.mail.utils import DNS_NAME",
"from django.core.mail.message import sanitize_address",
"fro... |
"""Base email backend class."""
class BaseEmailBackend(object):
"""
Base class for email backend implementations.
Subclasses must at least overwrite send_messages().
"""
def __init__(self, fail_silently=False, **kwargs):
self.fail_silently = fail_silently
def open(self):
"""Op... | [
[
8,
0,
0.0256,
0.0256,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.5385,
0.9487,
0,
0.66,
1,
507,
0,
4,
0,
0,
186,
0,
0
],
[
8,
1,
0.1538,
0.1282,
1,
0.32,
... | [
"\"\"\"Base email backend class.\"\"\"",
"class BaseEmailBackend(object):\n \"\"\"\n Base class for email backend implementations.\n\n Subclasses must at least overwrite send_messages().\n \"\"\"\n def __init__(self, fail_silently=False, **kwargs):\n self.fail_silently = fail_silently",
" ... |
# Mail backends shipped with Django.
| [] | [] |
"""
Backend for test environment.
"""
from django.core import mail
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
"""A email backend for use during test sessions.
The test connection stores email messages in a dummy outbox,
rather than sending them out o... | [
[
8,
0,
0.0769,
0.1154,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1923,
0.0385,
0,
0.66,
0.3333,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.2308,
0.0385,
0,
0.66... | [
"\"\"\"\nBackend for test environment.\n\"\"\"",
"from django.core import mail",
"from django.core.mail.backends.base import BaseEmailBackend",
"class EmailBackend(BaseEmailBackend):\n \"\"\"A email backend for use during test sessions.\n\n The test connection stores email messages in a dummy outbox,\n ... |
"""Email backend that writes messages to a file."""
import datetime
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.mail.backends.console import EmailBackend as ConsoleEmailBackend
from django.utils import six
class EmailBackend(ConsoleEmailBackend)... | [
[
8,
0,
0.0167,
0.0167,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.05,
0.0167,
0,
0.66,
0.1429,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0667,
0.0167,
0,
0.66,
... | [
"\"\"\"Email backend that writes messages to a file.\"\"\"",
"import datetime",
"import os",
"from django.conf import settings",
"from django.core.exceptions import ImproperlyConfigured",
"from django.core.mail.backends.console import EmailBackend as ConsoleEmailBackend",
"from django.utils import six",... |
"""
Tools for sending email.
"""
from __future__ import unicode_literals
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
# Imported for backwards compatibility, and for the sake
# of a cleaner namespace. These symbols used to be... | [
[
8,
0,
0.018,
0.027,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.036,
0.009,
0,
0.66,
0.0909,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0541,
0.009,
0,
0.66,
... | [
"\"\"\"\nTools for sending email.\n\"\"\"",
"from __future__ import unicode_literals",
"from django.conf import settings",
"from django.core.exceptions import ImproperlyConfigured",
"from django.utils.importlib import import_module",
"from django.core.mail.utils import CachedDnsName, DNS_NAME",
"from dj... |
from __future__ import unicode_literals
import logging
import sys
import types
from django import http
from django.conf import settings
from django.core import exceptions
from django.core import urlresolvers
from django.core import signals
from django.utils.encoding import force_text
from django.utils.importlib impor... | [
[
1,
0,
0.0036,
0.0036,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0109,
0.0036,
0,
0.66,
0.0625,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0146,
0.0036,
0,
... | [
"from __future__ import unicode_literals",
"import logging",
"import sys",
"import types",
"from django import http",
"from django.conf import settings",
"from django.core import exceptions",
"from django.core import urlresolvers",
"from django.core import signals",
"from django.utils.encoding imp... |
from __future__ import unicode_literals
import codecs
import logging
import sys
from io import BytesIO
from threading import Lock
from django import http
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures... | [
[
1,
0,
0.0037,
0.0037,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0112,
0.0037,
0,
0.66,
0.0625,
220,
0,
1,
0,
0,
220,
0,
0
],
[
1,
0,
0.0149,
0.0037,
0,
... | [
"from __future__ import unicode_literals",
"import codecs",
"import logging",
"import sys",
"from io import BytesIO",
"from threading import Lock",
"from django import http",
"from django.core import signals",
"from django.core.handlers import base",
"from django.core.urlresolvers import set_scrip... |
"""
This module converts requested URLs to callback view functions.
RegexURLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a tuple in this format:
(view_function, function_args, function_kwargs)
"""
from __future__ import unicode_literals
import functools
import re
fr... | [
[
8,
0,
0.0078,
0.0138,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0156,
0.0017,
0,
0.66,
0.0233,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.019,
0.0017,
0,
0.66,... | [
"\"\"\"\nThis module converts requested URLs to callback view functions.\n\nRegexURLResolver is the main class here. Its resolve() method takes a URL (as\na string) and returns a tuple in this format:\n\n (view_function, function_args, function_kwargs)\n\"\"\"",
"from __future__ import unicode_literals",
"im... |
from django.dispatch import Signal
request_started = Signal()
request_finished = Signal()
got_request_exception = Signal(providing_args=["request"])
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
548,
0,
1,
0,
0,
548,
0,
0
],
[
14,
0,
0.6,
0.2,
0,
0.66,
0.3333,
176,
3,
0,
0,
0,
592,
10,
1
],
[
14,
0,
0.8,
0.2,
0,
0.66,
0.666... | [
"from django.dispatch import Signal",
"request_started = Signal()",
"request_finished = Signal()",
"got_request_exception = Signal(providing_args=[\"request\"])"
] |
from math import ceil
from django.utils import six
class InvalidPage(Exception):
pass
class PageNotAnInteger(InvalidPage):
pass
class EmptyPage(InvalidPage):
pass
class Paginator(object):
def __init__(self, object_list, per_page, orphans=0, allow_empty_first_page=True):
self.object_list = ... | [
[
1,
0,
0.0061,
0.0061,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0184,
0.0061,
0,
0.66,
0.1429,
944,
0,
1,
0,
0,
944,
0,
0
],
[
3,
0,
0.0399,
0.0123,
0,
... | [
"from math import ceil",
"from django.utils import six",
"class InvalidPage(Exception):\n pass",
"class PageNotAnInteger(InvalidPage):\n pass",
"class EmptyPage(InvalidPage):\n pass",
"class Paginator(object):\n def __init__(self, object_list, per_page, orphans=0, allow_empty_first_page=True):... |
"""
FastCGI (or SCGI, or AJP1.3 ...) server that implements the WSGI protocol.
Uses the flup python package: http://www.saddi.com/software/flup/
This is a adaptation of the flup package to add FastCGI server support
to run Django apps from Web servers that support the FastCGI protocol.
This module can be run standalo... | [
[
8,
0,
0.0378,
0.0703,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0811,
0.0054,
0,
0.66,
0.1,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0865,
0.0054,
0,
0.66,
... | [
"\"\"\"\nFastCGI (or SCGI, or AJP1.3 ...) server that implements the WSGI protocol.\n\nUses the flup python package: http://www.saddi.com/software/flup/\n\nThis is a adaptation of the flup package to add FastCGI server support\nto run Django apps from Web servers that support the FastCGI protocol.\nThis module can ... |
"""
HTTP server that implements the Python WSGI protocol (PEP 333, rev 1.21).
Based on wsgiref.simple_server which is part of the standard library since 2.5.
This is a simple server for use in testing or debugging Django apps. It hasn't
been reviewed for security issues. DON'T USE IT FOR PRODUCTION USE!
"""
from __f... | [
[
8,
0,
0.0242,
0.043,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0538,
0.0054,
0,
0.66,
0.05,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0645,
0.0054,
0,
0.66,
... | [
"\"\"\"\nHTTP server that implements the Python WSGI protocol (PEP 333, rev 1.21).\n\nBased on wsgiref.simple_server which is part of the standard library since 2.5.\n\nThis is a simple server for use in testing or debugging Django apps. It hasn't\nbeen reviewed for security issues. DON'T USE IT FOR PRODUCTION USE!... |
"""
Functions for creating and restoring url-safe signed JSON objects.
The format used looks like this:
>>> signing.dumps("hello")
'ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk'
There are two components here, separated by a ':'. The first component is a
URLsafe base64 encoded JSON of the object passed to dumps(). T... | [
[
8,
0,
0.0829,
0.1611,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1706,
0.0047,
0,
0.66,
0.0455,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1801,
0.0047,
0,
0.66... | [
"\"\"\"\nFunctions for creating and restoring url-safe signed JSON objects.\n\nThe format used looks like this:\n\n>>> signing.dumps(\"hello\")\n'ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk'",
"from __future__ import unicode_literals",
"import base64",
"import json",
"import time",
"import zlib",
"fro... |
"""
Pages in Django can are served up with custom HTTP headers containing useful
information about those pages -- namely, the content type and object ID.
This module contains utility functions for retrieving and doing interesting
things with these special "X-Headers" (so called because the HTTP spec demands
that custo... | [
[
8,
0,
0.2292,
0.4167,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.75,
0.5417,
0,
0.66,
1,
146,
0,
4,
0,
0,
0,
0,
4
],
[
8,
1,
0.6458,
0.25,
1,
0.51,
0,
... | [
"\"\"\"\nPages in Django can are served up with custom HTTP headers containing useful\ninformation about those pages -- namely, the content type and object ID.\n\nThis module contains utility functions for retrieving and doing interesting\nthings with these special \"X-Headers\" (so called because the HTTP spec dem... |
from __future__ import unicode_literals
import re
try:
from urllib.parse import urlsplit, urlunsplit
except ImportError: # Python 2
from urlparse import urlsplit, urlunsplit
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.encodin... | [
[
1,
0,
0.0051,
0.0051,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0152,
0.0051,
0,
0.66,
0.0345,
540,
0,
1,
0,
0,
540,
0,
0
],
[
7,
0,
0.0279,
0.0203,
0,
... | [
"from __future__ import unicode_literals",
"import re",
"try:\n from urllib.parse import urlsplit, urlunsplit\nexcept ImportError: # Python 2\n from urlparse import urlsplit, urlunsplit",
" from urllib.parse import urlsplit, urlunsplit",
" from urlparse import urlsplit, urlunsplit",
"from ... |
"""
Global Django exception and warning classes.
"""
from functools import reduce
class DjangoRuntimeWarning(RuntimeWarning):
pass
class ObjectDoesNotExist(Exception):
"The requested object does not exist"
silent_variable_failure = True
class MultipleObjectsReturned(Exception):
"The query returned... | [
[
8,
0,
0.0202,
0.0303,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0404,
0.0101,
0,
0.66,
0.0833,
711,
0,
1,
0,
0,
711,
0,
0
],
[
3,
0,
0.0758,
0.0202,
0,
0.66... | [
"\"\"\"\nGlobal Django exception and warning classes.\n\"\"\"",
"from functools import reduce",
"class DjangoRuntimeWarning(RuntimeWarning):\n pass",
"class ObjectDoesNotExist(Exception):\n \"The requested object does not exist\"\n silent_variable_failure = True",
" \"The requested object does n... |
import cgi
import errno
import mimetypes
import os
import posixpath
import re
import shutil
import stat
import sys
import tempfile
try:
from urllib.request import urlretrieve
except ImportError: # Python 2
from urllib import urlretrieve
from optparse import make_option
from os import path
import django
fr... | [
[
1,
0,
0.0032,
0.0032,
0,
0.66,
0,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.0063,
0.0032,
0,
0.66,
0.0476,
546,
0,
1,
0,
0,
546,
0,
0
],
[
1,
0,
0.0095,
0.0032,
0,
... | [
"import cgi",
"import errno",
"import mimetypes",
"import os",
"import posixpath",
"import re",
"import shutil",
"import stat",
"import sys",
"import tempfile",
"try:\n from urllib.request import urlretrieve\nexcept ImportError: # Python 2\n from urllib import urlretrieve",
" from... |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_all
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the CREATE TABLE, custom SQL and CREATE INDEX S... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1364,
0.0455,
0,
0.66,
0.2,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.2273,
0.0455,
0,
0.6... | [
"from __future__ import unicode_literals",
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.core.management.sql import sql_all",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the CREATE TABLE, c... |
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError
from django.core import serializers
from django.db import router, DEFAULT_DB_ALIAS
from django.utils.datastructures import SortedDict
from optparse import make_option
class Command(BaseCommand):
... | [
[
1,
0,
0.0051,
0.0051,
0,
0.66,
0,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0102,
0.0051,
0,
0.66,
0.1429,
931,
0,
2,
0,
0,
931,
0,
0
],
[
1,
0,
0.0153,
0.0051,
0,
... | [
"from django.core.exceptions import ImproperlyConfigured",
"from django.core.management.base import BaseCommand, CommandError",
"from django.core import serializers",
"from django.db import router, DEFAULT_DB_ALIAS",
"from django.utils.datastructures import SortedDict",
"from optparse import make_option",... |
import os
from django.core.management.base import NoArgsCommand
from optparse import make_option
class Command(NoArgsCommand):
shells = ['ipython', 'bpython']
option_list = NoArgsCommand.option_list + (
make_option('--plain', action='store_true', dest='plain',
help='Tells Django to use pl... | [
[
1,
0,
0.0108,
0.0108,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0215,
0.0108,
0,
0.66,
0.3333,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.0323,
0.0108,
0,
... | [
"import os",
"from django.core.management.base import NoArgsCommand",
"from optparse import make_option",
"class Command(NoArgsCommand):\n shells = ['ipython', 'bpython']\n\n option_list = NoArgsCommand.option_list + (\n make_option('--plain', action='store_true', dest='plain',\n help=... |
from __future__ import unicode_literals
import codecs
import os
import sys
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.utils._os import npath
def has_bom(fn):
with open(fn, 'rb') as f:
sample = f.read(4)
return sample[:3] == b'\xef\xbb... | [
[
1,
0,
0.0152,
0.0152,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0455,
0.0152,
0,
0.66,
0.1111,
220,
0,
1,
0,
0,
220,
0,
0
],
[
1,
0,
0.0606,
0.0152,
0,
... | [
"from __future__ import unicode_literals",
"import codecs",
"import os",
"import sys",
"from optparse import make_option",
"from django.core.management.base import BaseCommand, CommandError",
"from django.utils._os import npath",
"def has_bom(fn):\n with open(fn, 'rb') as f:\n sample = f.rea... |
from django.core.management.base import NoArgsCommand
def module_to_dict(module, omittable=lambda k: k.startswith('_')):
"Converts a module namespace to a Python dictionary. Used by get_settings_diff."
return dict([(k, repr(v)) for k, v in module.__dict__.items() if not omittable(k)])
class Command(NoArgsComm... | [
[
1,
0,
0.0333,
0.0333,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
2,
0,
0.1333,
0.1,
0,
0.66,
0.5,
736,
0,
2,
1,
0,
0,
0,
5
],
[
8,
1,
0.1333,
0.0333,
1,
0.46,
... | [
"from django.core.management.base import NoArgsCommand",
"def module_to_dict(module, omittable=lambda k: k.startswith('_')):\n \"Converts a module namespace to a Python dictionary. Used by get_settings_diff.\"\n return dict([(k, repr(v)) for k, v in module.__dict__.items() if not omittable(k)])",
" \"C... |
from __future__ import unicode_literals
import keyword
import re
from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
from django.utils import six
class Command(NoArgsCommand):
help = "Introspects the database tab... | [
[
1,
0,
0.0045,
0.0045,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0134,
0.0045,
0,
0.66,
0.1429,
454,
0,
1,
0,
0,
454,
0,
0
],
[
1,
0,
0.0179,
0.0045,
0,
... | [
"from __future__ import unicode_literals",
"import keyword",
"import re",
"from optparse import make_option",
"from django.core.management.base import NoArgsCommand, CommandError",
"from django.db import connections, DEFAULT_DB_ALIAS",
"from django.utils import six",
"class Command(NoArgsCommand):\n ... |
from optparse import make_option
from django.conf import settings
from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS
from django.core.management import call_command
from django.core.management.base import NoArgsCommand, CommandError
from django.core.management.color import no_style
from d... | [
[
1,
0,
0.0109,
0.0109,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0326,
0.0109,
0,
0.66,
0.1111,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0435,
0.0109,
0,
... | [
"from optparse import make_option",
"from django.conf import settings",
"from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS",
"from django.core.management import call_command",
"from django.core.management.base import NoArgsCommand, CommandError",
"from django.core.management... |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
class Command(BaseCommand):
help = ("Runs the command-line client for specified database, or the "
"default database if none is provided.")
option_lis... | [
[
1,
0,
0.0357,
0.0357,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.1071,
0.0357,
0,
0.66,
0.3333,
931,
0,
2,
0,
0,
931,
0,
0
],
[
1,
0,
0.1429,
0.0357,
0,
... | [
"from optparse import make_option",
"from django.core.management.base import BaseCommand, CommandError",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(BaseCommand):\n help = (\"Runs the command-line client for specified database, or the \"\n \"default database if none is prov... |
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = "Validates all installed models."
requires_model_validation = False
def handle_noargs(self, **options):
self.validate(display_num_errors=True)
| [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
3,
0,
0.7,
0.7,
0,
0.66,
1,
73,
0,
1,
0,
0,
795,
0,
1
],
[
14,
1,
0.5,
0.1,
1,
0.87,
0,
868,
... | [
"from django.core.management.base import NoArgsCommand",
"class Command(NoArgsCommand):\n help = \"Validates all installed models.\"\n\n requires_model_validation = False\n\n def handle_noargs(self, **options):\n self.validate(display_num_errors=True)",
" help = \"Validates all installed mode... |
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Runs this project as a FastCGI application. Requires flup."
args = '[various KEY=val options, use `runfcgi help` for help]'
def handle(self, *args, **options):
from django.conf import settings
from djan... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
3,
0,
0.575,
0.9,
0,
0.66,
1,
73,
0,
2,
0,
0,
564,
0,
2
],
[
14,
1,
0.2,
0.05,
1,
0.98,
0,
8... | [
"from django.core.management.base import BaseCommand",
"class Command(BaseCommand):\n help = \"Runs this project as a FastCGI application. Requires flup.\"\n args = '[various KEY=val options, use `runfcgi help` for help]'\n\n def handle(self, *args, **options):\n from django.conf import settings\n... |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_indexes
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the CREATE INDEX SQL statements for the give... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1364,
0.0455,
0,
0.66,
0.2,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.2273,
0.0455,
0,
0.6... | [
"from __future__ import unicode_literals",
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.core.management.sql import sql_indexes",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the CREATE INDE... |
import fnmatch
import glob
import os
import re
import sys
from itertools import dropwhile
from optparse import make_option
from subprocess import PIPE, Popen
import django
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.text import get_text_list
from django.utils.jslex import prep... | [
[
1,
0,
0.0025,
0.0025,
0,
0.66,
0,
626,
0,
1,
0,
0,
626,
0,
0
],
[
1,
0,
0.0051,
0.0025,
0,
0.66,
0.0435,
958,
0,
1,
0,
0,
958,
0,
0
],
[
1,
0,
0.0076,
0.0025,
0,
... | [
"import fnmatch",
"import glob",
"import os",
"import re",
"import sys",
"from itertools import dropwhile",
"from optparse import make_option",
"from subprocess import PIPE, Popen",
"import django",
"from django.core.management.base import CommandError, NoArgsCommand",
"from django.utils.text im... |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_create
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the CREATE TABLE SQL statements for the given... | [
[
1,
0,
0.0476,
0.0476,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.2,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.2381,
0.0476,
0,
0.6... | [
"from __future__ import unicode_literals",
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.core.management.sql import sql_create",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the CREATE TABLE... |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import NoArgsCommand
from django.core.management.sql import sql_flush
from django.db import connections, DEFAULT_DB_ALIAS
class Command(NoArgsCommand):
help = "Returns a list of the SQL statements required t... | [
[
1,
0,
0.0476,
0.0476,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.2,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.2381,
0.0476,
0,
0.6... | [
"from __future__ import unicode_literals",
"from optparse import make_option",
"from django.core.management.base import NoArgsCommand",
"from django.core.management.sql import sql_flush",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(NoArgsCommand):\n help = \"Returns a list of ... |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import AppCommand
from django.db import connections, models, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = 'Prints the SQL statements for resetting sequences for the given app name(s).'
option_list... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1364,
0.0455,
0,
0.66,
0.25,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.2273,
0.0455,
0,
0.... | [
"from __future__ import unicode_literals",
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.db import connections, models, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = 'Prints the SQL statements for resetting sequences for the given app nam... |
import logging
import sys
import os
from optparse import make_option, OptionParser
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test.utils import get_runner
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput',
... | [
[
1,
0,
0.0109,
0.0109,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0217,
0.0109,
0,
0.66,
0.1429,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0326,
0.0109,
0,
... | [
"import logging",
"import sys",
"import os",
"from optparse import make_option, OptionParser",
"from django.conf import settings",
"from django.core.management.base import BaseCommand",
"from django.test.utils import get_runner",
"class Command(BaseCommand):\n option_list = BaseCommand.option_list ... |
from __future__ import unicode_literals
import sys
import os
import gzip
import zipfile
from optparse import make_option
import traceback
from django.conf import settings
from django.core import serializers
from django.core.management.base import BaseCommand, CommandError
from django.core.management.color import no_s... | [
[
1,
0,
0.0038,
0.0038,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0114,
0.0038,
0,
0.66,
0.0588,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0152,
0.0038,
0,
... | [
"from __future__ import unicode_literals",
"import sys",
"import os",
"import gzip",
"import zipfile",
"from optparse import make_option",
"import traceback",
"from django.conf import settings",
"from django.core import serializers",
"from django.core.management.base import BaseCommand, CommandErr... |
from optparse import make_option
from django.core.cache.backends.db import BaseDatabaseCache
from django.core.management.base import LabelCommand, CommandError
from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS
from django.db.utils import DatabaseError
from django.utils.encoding import fo... | [
[
1,
0,
0.0152,
0.0152,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0455,
0.0152,
0,
0.66,
0.1667,
62,
0,
1,
0,
0,
62,
0,
0
],
[
1,
0,
0.0606,
0.0152,
0,
0.... | [
"from optparse import make_option",
"from django.core.cache.backends.db import BaseDatabaseCache",
"from django.core.management.base import LabelCommand, CommandError",
"from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS",
"from django.db.utils import DatabaseError",
"from dj... |
from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
from django.utils.crypto import get_random_string
from django.utils.importlib import import_module
class Command(TemplateCommand):
help = ("Creates a Django project directory structure for the given "... | [
[
1,
0,
0.0323,
0.0323,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.0645,
0.0323,
0,
0.66,
0.25,
111,
0,
1,
0,
0,
111,
0,
0
],
[
1,
0,
0.0968,
0.0323,
0,
0.... | [
"from django.core.management.base import CommandError",
"from django.core.management.templates import TemplateCommand",
"from django.utils.crypto import get_random_string",
"from django.utils.importlib import import_module",
"class Command(TemplateCommand):\n help = (\"Creates a Django project directory ... |
from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
from django.utils.importlib import import_module
class Command(TemplateCommand):
help = ("Creates a Django app directory structure for the given app "
"name in the current directory or opt... | [
[
1,
0,
0.04,
0.04,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.08,
0.04,
0,
0.66,
0.3333,
111,
0,
1,
0,
0,
111,
0,
0
],
[
1,
0,
0.12,
0.04,
0,
0.66,
0.... | [
"from django.core.management.base import CommandError",
"from django.core.management.templates import TemplateCommand",
"from django.utils.importlib import import_module",
"class Command(TemplateCommand):\n help = (\"Creates a Django app directory structure for the given app \"\n \"name in the c... |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_delete
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the DROP TABLE SQL statements for the given a... | [
[
1,
0,
0.0476,
0.0476,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.2,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.2381,
0.0476,
0,
0.6... | [
"from __future__ import unicode_literals",
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.core.management.sql import sql_delete",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the DROP TABLE S... |
from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput', action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input of any... | [
[
1,
0,
0.0222,
0.0222,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.0667,
0.0222,
0,
0.66,
0.5,
323,
0,
1,
0,
0,
323,
0,
0
],
[
3,
0,
0.5556,
0.9111,
0,
0.6... | [
"from django.core.management.base import BaseCommand",
"from optparse import make_option",
"class Command(BaseCommand):\n option_list = BaseCommand.option_list + (\n make_option('--noinput', action='store_false', dest='interactive', default=True,\n help='Tells Django to NOT prompt the user ... |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_custom
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the custom table modifying SQL statements for... | [
[
1,
0,
0.0476,
0.0476,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.2,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.2381,
0.0476,
0,
0.6... | [
"from __future__ import unicode_literals",
"from optparse import make_option",
"from django.core.management.base import AppCommand",
"from django.core.management.sql import sql_custom",
"from django.db import connections, DEFAULT_DB_ALIAS",
"class Command(AppCommand):\n help = \"Prints the custom table... |
from optparse import make_option
import traceback
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import NoArgsCommand
from django.core.management.color import no_style
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
f... | [
[
1,
0,
0.0061,
0.0061,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0123,
0.0061,
0,
0.66,
0.1,
423,
0,
1,
0,
0,
423,
0,
0
],
[
1,
0,
0.0245,
0.0061,
0,
0.6... | [
"from optparse import make_option",
"import traceback",
"from django.conf import settings",
"from django.core.management import call_command",
"from django.core.management.base import NoArgsCommand",
"from django.core.management.color import no_style",
"from django.core.management.sql import custom_sql_... |
from django.core.management.base import AppCommand, CommandError
class Command(AppCommand):
help = "RENAMED: see 'sqlcustom'"
def handle(self, *apps, **options):
raise CommandError("This command has been renamed. Use the 'sqlcustom' command instead.")
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
931,
0,
2,
0,
0,
931,
0,
0
],
[
3,
0,
0.7143,
0.7143,
0,
0.66,
1,
73,
0,
1,
0,
0,
369,
0,
1
],
[
14,
1,
0.5714,
0.1429,
1,
0.53,... | [
"from django.core.management.base import AppCommand, CommandError",
"class Command(AppCommand):\n help = \"RENAMED: see 'sqlcustom'\"\n\n def handle(self, *apps, **options):\n raise CommandError(\"This command has been renamed. Use the 'sqlcustom' command instead.\")",
" help = \"RENAMED: see 's... |
from optparse import make_option
from datetime import datetime
import errno
import os
import re
import sys
import socket
from django.core.management.base import BaseCommand, CommandError
from django.core.servers.basehttp import run, get_internal_wsgi_application
from django.utils import autoreload
naiveip_re = re.com... | [
[
1,
0,
0.0073,
0.0073,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0146,
0.0073,
0,
0.66,
0.0769,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0219,
0.0073,
0,
... | [
"from optparse import make_option",
"from datetime import datetime",
"import errno",
"import os",
"import re",
"import sys",
"import socket",
"from django.core.management.base import BaseCommand, CommandError",
"from django.core.servers.basehttp import run, get_internal_wsgi_application",
"from dj... |
import warnings
from django.contrib.sessions.management.commands import clearsessions
class Command(clearsessions.Command):
def handle_noargs(self, **options):
warnings.warn(
"The `cleanup` command has been deprecated in favor of `clearsessions`.",
PendingDeprecationWarning)
... | [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.2727,
0.0909,
0,
0.66,
0.5,
578,
0,
1,
0,
0,
578,
0,
0
],
[
3,
0,
0.7727,
0.5455,
0,
0.6... | [
"import warnings",
"from django.contrib.sessions.management.commands import clearsessions",
"class Command(clearsessions.Command):\n def handle_noargs(self, **options):\n warnings.warn(\n \"The `cleanup` command has been deprecated in favor of `clearsessions`.\",\n PendingDepreca... |
from __future__ import unicode_literals
import codecs
import os
import re
from django.conf import settings
from django.core.management.base import CommandError
from django.db import models
from django.db.models import get_models
from django.utils._os import upath
def sql_create(app, style, connection):
"Returns... | [
[
1,
0,
0.0051,
0.0051,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0154,
0.0051,
0,
0.66,
0.0588,
220,
0,
1,
0,
0,
220,
0,
0
],
[
1,
0,
0.0205,
0.0051,
0,
... | [
"from __future__ import unicode_literals",
"import codecs",
"import os",
"import re",
"from django.conf import settings",
"from django.core.management.base import CommandError",
"from django.db import models",
"from django.db.models import get_models",
"from django.utils._os import upath",
"def sq... |
"""
Sets up the terminal color scheme.
"""
import os
import sys
from django.utils import termcolors
def supports_color():
"""
Returns True if the running system's terminal supports color, and False
otherwise.
"""
unsupported_platform = (sys.platform in ('win32', 'Pocket PC'))
# isatty is not ... | [
[
8,
0,
0.04,
0.06,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1,
0.02,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.12,
0.02,
0,
0.66,
0.3333,... | [
"\"\"\"\nSets up the terminal color scheme.\n\"\"\"",
"import os",
"import sys",
"from django.utils import termcolors",
"def supports_color():\n \"\"\"\n Returns True if the running system's terminal supports color, and False\n otherwise.\n \"\"\"\n unsupported_platform = (sys.platform in ('w... |
import collections
import sys
from django.conf import settings
from django.core.management.color import color_style
from django.utils.encoding import force_str
from django.utils.itercompat import is_iterable
from django.utils import six
class ModelErrorCollection:
def __init__(self, outfile=sys.stdout):
... | [
[
1,
0,
0.0028,
0.0028,
0,
0.66,
0,
193,
0,
1,
0,
0,
193,
0,
0
],
[
1,
0,
0.0055,
0.0028,
0,
0.66,
0.1111,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.011,
0.0028,
0,
0... | [
"import collections",
"import sys",
"from django.conf import settings",
"from django.core.management.color import color_style",
"from django.utils.encoding import force_str",
"from django.utils.itercompat import is_iterable",
"from django.utils import six",
"class ModelErrorCollection:\n def __init... |
"""
Base classes for writing management commands (named commands which can
be executed through ``django-admin.py`` or ``manage.py``).
"""
import os
import sys
from optparse import make_option, OptionParser
import traceback
import django
from django.core.exceptions import ImproperlyConfigured
from django.core.managem... | [
[
8,
0,
0.0077,
0.0128,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0153,
0.0026,
0,
0.66,
0.0625,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0179,
0.0026,
0,
0.66... | [
"\"\"\"\nBase classes for writing management commands (named commands which can\nbe executed through ``django-admin.py`` or ``manage.py``).\n\n\"\"\"",
"import os",
"import sys",
"from optparse import make_option, OptionParser",
"import traceback",
"import django",
"from django.core.exceptions import Im... |
import collections
import os
import sys
from optparse import OptionParser, NO_DEFAULT
import imp
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError, handle_default_options
from django.core.management.color import color_style
from dj... | [
[
1,
0,
0.0021,
0.0021,
0,
0.66,
0,
193,
0,
1,
0,
0,
193,
0,
0
],
[
1,
0,
0.0043,
0.0021,
0,
0.66,
0.0435,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0064,
0.0021,
0,
... | [
"import collections",
"import os",
"import sys",
"from optparse import OptionParser, NO_DEFAULT",
"import imp",
"import warnings",
"from django.core.exceptions import ImproperlyConfigured",
"from django.core.management.base import BaseCommand, CommandError, handle_default_options",
"from django.core... |
from django.core.handlers.wsgi import WSGIHandler
def get_wsgi_application():
"""
The public interface to Django's WSGI support. Should return a WSGI
callable.
Allows us to avoid making django.core.handlers.WSGIHandler public API, in
case the internal WSGI implementation changes or moves in the f... | [
[
1,
0,
0.0769,
0.0769,
0,
0.66,
0,
643,
0,
1,
0,
0,
643,
0,
0
],
[
2,
0,
0.6538,
0.7692,
0,
0.66,
1,
387,
0,
0,
1,
0,
0,
0,
1
],
[
8,
1,
0.6538,
0.6154,
1,
0.82,
... | [
"from django.core.handlers.wsgi import WSGIHandler",
"def get_wsgi_application():\n \"\"\"\n The public interface to Django's WSGI support. Should return a WSGI\n callable.\n\n Allows us to avoid making django.core.handlers.WSGIHandler public API, in\n case the internal WSGI implementation changes ... |
import os
import errno
try:
from urllib.parse import urljoin
except ImportError: # Python 2
from urlparse import urljoin
import itertools
from datetime import datetime
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
from django.core.files import... | [
[
1,
0,
0.0033,
0.0033,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0067,
0.0033,
0,
0.66,
0.0526,
546,
0,
1,
0,
0,
546,
0,
0
],
[
7,
0,
0.015,
0.0133,
0,
0... | [
"import os",
"import errno",
"try:\n from urllib.parse import urljoin\nexcept ImportError: # Python 2\n from urlparse import urljoin",
" from urllib.parse import urljoin",
" from urlparse import urljoin",
"import itertools",
"from datetime import datetime",
"from django.conf import set... |
"""
Classes representing uploaded files.
"""
import os
from io import BytesIO
from django.conf import settings
from django.core.files.base import File
from django.core.files import temp as tempfile
from django.utils.encoding import force_str
__all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryUploadedFile',... | [
[
8,
0,
0.016,
0.024,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.04,
0.008,
0,
0.66,
0.0909,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.048,
0.008,
0,
0.66,
0... | [
"\"\"\"\nClasses representing uploaded files.\n\"\"\"",
"import os",
"from io import BytesIO",
"from django.conf import settings",
"from django.core.files.base import File",
"from django.core.files import temp as tempfile",
"from django.utils.encoding import force_str",
"__all__ = ('UploadedFile', 'Te... |
"""
Utility functions for handling images.
Requires PIL, as you might imagine.
"""
from django.core.files import File
class ImageFile(File):
"""
A mixin for use alongside django.core.files.base.File, which provides
additional features for dealing with images.
"""
def _get_width(self):
ret... | [
[
8,
0,
0.0448,
0.0746,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1045,
0.0149,
0,
0.66,
0.3333,
659,
0,
1,
0,
0,
659,
0,
0
],
[
3,
0,
0.2687,
0.2836,
0,
0.66... | [
"\"\"\"\nUtility functions for handling images.\n\nRequires PIL, as you might imagine.\n\"\"\"",
"from django.core.files import File",
"class ImageFile(File):\n \"\"\"\n A mixin for use alongside django.core.files.base.File, which provides\n additional features for dealing with images.\n \"\"\"\n ... |
"""
Base file upload handler classes, and the built-in concrete subclasses
"""
from __future__ import unicode_literals
from io import BytesIO
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.uploadedfile import TemporaryUploadedFile, InMemoryUploadedFile... | [
[
8,
0,
0.009,
0.0136,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0226,
0.0045,
0,
0.66,
0.0625,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0317,
0.0045,
0,
0.66,... | [
"\"\"\"\nBase file upload handler classes, and the built-in concrete subclasses\n\"\"\"",
"from __future__ import unicode_literals",
"from io import BytesIO",
"from django.conf import settings",
"from django.core.exceptions import ImproperlyConfigured",
"from django.core.files.uploadedfile import Temporar... |
"""
The temp module provides a NamedTemporaryFile that can be re-opened on any
platform. Most platforms use the standard Python tempfile.TemporaryFile class,
but MS Windows users are given a custom class.
This is needed because in Windows NT, the default implementation of
NamedTemporaryFile uses the O_TEMPORARY flag, ... | [
[
8,
0,
0.0982,
0.1786,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2143,
0.0179,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2321,
0.0179,
0,
0.66... | [
"\"\"\"\nThe temp module provides a NamedTemporaryFile that can be re-opened on any\nplatform. Most platforms use the standard Python tempfile.TemporaryFile class,\nbut MS Windows users are given a custom class.\n\nThis is needed because in Windows NT, the default implementation of\nNamedTemporaryFile uses the O_TE... |
class FileProxyMixin(object):
"""
A mixin class used to forward file methods to an underlaying file
object. The internal file object has to be called "file"::
class FileProxy(FileProxyMixin):
def __init__(self, file):
self.file = file
"""
encoding = property(la... | [
[
3,
0,
0.5172,
1,
0,
0.66,
0,
369,
0,
1,
0,
0,
186,
0,
17
],
[
8,
1,
0.1897,
0.2759,
1,
0.82,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.3793,
0.0345,
1,
0.82,
0.... | [
"class FileProxyMixin(object):\n \"\"\"\n A mixin class used to forward file methods to an underlaying file\n object. The internal file object has to be called \"file\"::\n\n class FileProxy(FileProxyMixin):\n def __init__(self, file):\n self.file = file",
" \"\"\"\n ... |
"""
Move a file in the safest way possible::
>>> from django.core.files.move import file_move_safe
>>> file_move_safe("/tmp/old_file", "/tmp/new_file")
"""
import os
from django.core.files import locks
try:
from shutil import copystat
except ImportError:
import stat
def copystat(src, dst):
... | [
[
8,
0,
0.0412,
0.0706,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0941,
0.0118,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1059,
0.0118,
0,
0.66... | [
"\"\"\"\nMove a file in the safest way possible::\n\n >>> from django.core.files.move import file_move_safe\n >>> file_move_safe(\"/tmp/old_file\", \"/tmp/new_file\")\n\"\"\"",
"import os",
"from django.core.files import locks",
"try:\n from shutil import copystat\nexcept ImportError:\n import sta... |
from __future__ import unicode_literals
import os
from io import BytesIO, StringIO, UnsupportedOperation
from django.utils.encoding import smart_text
from django.core.files.utils import FileProxyMixin
from django.utils import six
from django.utils.encoding import force_bytes, python_2_unicode_compatible
@python_2_un... | [
[
1,
0,
0.0063,
0.0063,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.019,
0.0063,
0,
0.66,
0.125,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0253,
0.0063,
0,
0.... | [
"from __future__ import unicode_literals",
"import os",
"from io import BytesIO, StringIO, UnsupportedOperation",
"from django.utils.encoding import smart_text",
"from django.core.files.utils import FileProxyMixin",
"from django.utils import six",
"from django.utils.encoding import force_bytes, python_2... |
from django.core.files.base import File
| [
[
1,
0,
1,
1,
0,
0.66,
0,
293,
0,
1,
0,
0,
293,
0,
0
]
] | [
"from django.core.files.base import File"
] |
"""
Portable file locking utilities.
Based partially on example by Jonathan Feignberg <jdf@pobox.com> in the Python
Cookbook, licensed under the Python Software License.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
Example Usage::
>>> from django.core.files import locks
>>> with open('.... | [
[
8,
0,
0.1159,
0.2174,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2464,
0.0145,
0,
0.66,
0.1667,
272,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.2754,
0.0145,
0,
0.66... | [
"\"\"\"\nPortable file locking utilities.\n\nBased partially on example by Jonathan Feignberg <jdf@pobox.com> in the Python\nCookbook, licensed under the Python Software License.\n\n http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203",
"__all__ = ('LOCK_EX','LOCK_SH','LOCK_NB','lock','unlock')",
"... |
from __future__ import absolute_import, unicode_literals
from django.utils.encoding import force_str
from django.utils import six
from django.utils.six.moves import http_cookies
# Some versions of Python 2.7 and later won't need this encoding bug fix:
_cookie_encodes_correctly = http_cookies.SimpleCookie().value_enc... | [
[
1,
0,
0.0116,
0.0116,
0,
0.66,
0,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0349,
0.0116,
0,
0.66,
0.125,
96,
0,
1,
0,
0,
96,
0,
0
],
[
1,
0,
0.0465,
0.0116,
0,
0.6... | [
"from __future__ import absolute_import, unicode_literals",
"from django.utils.encoding import force_str",
"from django.utils import six",
"from django.utils.six.moves import http_cookies",
"_cookie_encodes_correctly = http_cookies.SimpleCookie().value_encode(';') == (';', '\"\\\\073\"')",
"_tc = http_coo... |
"""
Multi-part parsing for file uploads.
Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to
file upload handlers for processing.
"""
from __future__ import unicode_literals
import base64
import cgi
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
fro... | [
[
8,
0,
0.0055,
0.0094,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.011,
0.0016,
0,
0.66,
0.0385,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0141,
0.0016,
0,
0.66,... | [
"\"\"\"\nMulti-part parsing for file uploads.\n\nExposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to\nfile upload handlers for processing.\n\"\"\"",
"from __future__ import unicode_literals",
"import base64",
"import cgi",
"from django.conf import settings",
"from django.core.ex... |
from __future__ import absolute_import, unicode_literals
import copy
import os
import re
import sys
import warnings
from io import BytesIO
from pprint import pformat
try:
from urllib.parse import parse_qsl, urlencode, quote, urljoin
except ImportError:
from urllib import urlencode, quote
from urlparse impo... | [
[
1,
0,
0.002,
0.002,
0,
0.66,
0,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.006,
0.002,
0,
0.66,
0.04,
739,
0,
1,
0,
0,
739,
0,
0
],
[
1,
0,
0.008,
0.002,
0,
0.66,
... | [
"from __future__ import absolute_import, unicode_literals",
"import copy",
"import os",
"import re",
"import sys",
"import warnings",
"from io import BytesIO",
"from pprint import pformat",
"try:\n from urllib.parse import parse_qsl, urlencode, quote, urljoin\nexcept ImportError:\n from urllib... |
from __future__ import absolute_import, unicode_literals
import datetime
import time
import warnings
from email.header import Header
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from django.conf import settings
from django.core import signals
from django.core import... | [
[
1,
0,
0.0022,
0.0022,
0,
0.66,
0,
777,
0,
2,
0,
0,
777,
0,
0
],
[
1,
0,
0.0067,
0.0022,
0,
0.66,
0.0333,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0089,
0.0022,
0,
... | [
"from __future__ import absolute_import, unicode_literals",
"import datetime",
"import time",
"import warnings",
"from email.header import Header",
"try:\n from urllib.parse import urlparse\nexcept ImportError:\n from urlparse import urlparse",
" from urllib.parse import urlparse",
" from ... |
"""
Functions that modify an HTTP request or response in some way.
"""
# This group of functions are run as part of the response handling, after
# everything else, including all response middleware. Think of them as
# "compulsory response middleware". Be careful about what goes here, because
# it's a little fiddly to ... | [
[
8,
0,
0.0488,
0.0732,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.4146,
0.2683,
0,
0.66,
0.5,
687,
0,
2,
1,
0,
0,
0,
2
],
[
8,
1,
0.3902,
0.1707,
1,
0.61,
... | [
"\"\"\"\nFunctions that modify an HTTP request or response in some way.\n\"\"\"",
"def fix_location_header(request, response):\n \"\"\"\n Ensures that we always use an absolute URI in any location header in the\n response. This is required by RFC 2616, section 14.30.\n\n Code constructing response obj... |
from django.http.cookie import SimpleCookie, parse_cookie
from django.http.request import (HttpRequest, QueryDict, UnreadablePostError,
build_request_repr)
from django.http.response import (HttpResponse, StreamingHttpResponse,
CompatibleStreamingHttpResponse, HttpResponsePermanentRedirect,
HttpResponseRedir... | [
[
1,
0,
0.1111,
0.1111,
0,
0.66,
0,
470,
0,
2,
0,
0,
470,
0,
0
],
[
1,
0,
0.2778,
0.2222,
0,
0.66,
0.3333,
771,
0,
4,
0,
0,
771,
0,
0
],
[
1,
0,
0.6667,
0.5556,
0,
... | [
"from django.http.cookie import SimpleCookie, parse_cookie",
"from django.http.request import (HttpRequest, QueryDict, UnreadablePostError,\n build_request_repr)",
"from django.http.response import (HttpResponse, StreamingHttpResponse,\n CompatibleStreamingHttpResponse, HttpResponsePermanentRedirect,\n ... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
from __future__ import unicode_literals
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i:s'
DA... | [
[
1,
0,
0.1892,
0.027,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.2432,
0.027,
0,
0.66,
0.0769,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2703,
0.027,
0,
0.6... | [
"from __future__ import unicode_literals",
"DATE_FORMAT = 'j. F Y'",
"TIME_FORMAT = 'H:i:s'",
"DATETIME_FORMAT = 'j. F Y H:i:s'",
"YEAR_MONTH_FORMAT = 'F Y'",
"MONTH_DAY_FORMAT = 'j. F'",
"SHORT_DATE_FORMAT = 'd.m.Y'",
"SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s'",
"FIRST_DAY_OF_WEEK = 1 # Monday",
"DAT... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y. F j.'
TIME_FORMAT = 'G.i.s'
DA... | [
[
1,
0,
0.1212,
0.0303,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.2424,
0.0303,
0,
0.66,
0.0714,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2727,
0.0303,
0,
... | [
"from __future__ import unicode_literals",
"DATE_FORMAT = 'Y. F j.'",
"TIME_FORMAT = 'G.i.s'",
"DATETIME_FORMAT = 'Y. F j. G.i.s'",
"YEAR_MONTH_FORMAT = 'Y. F'",
"MONTH_DAY_FORMAT = 'F j.'",
"SHORT_DATE_FORMAT = 'Y.m.d.'",
"SHORT_DATETIME_FORMAT = 'Y.m.d. G.i.s'",
"FIRST_DAY_OF_WEEK = 1 # Monday",
... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y' # '20 januari 2009'
TIME_FORMAT = 'H:i' ... | [
[
14,
0,
0.1296,
0.0185,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1481,
0.0185,
0,
0.66,
0.0769,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1667,
0.0185,
0,
0... | [
"DATE_FORMAT = 'j F Y' # '20 januari 2009'",
"TIME_FORMAT = 'H:i' # '15:23'",
"DATETIME_FORMAT = 'j F Y H:i' # '20 januari 2009 15:23'",
"YEAR_MONTH_FORMAT = 'F Y' # 'januari 2009'",
"MONTH_DAY_FORMAT = 'j F' # '20 januari'",
"SH... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j. F Y. H:i'
YEAR_MONTH_F... | [
[
14,
0,
0.175,
0.025,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2,
0.025,
0,
0.66,
0.0833,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.225,
0.025,
0,
0.66,
... | [
"DATE_FORMAT = 'd F Y'",
"TIME_FORMAT = 'H:i:s'",
"DATETIME_FORMAT = 'j. F Y. H:i'",
"YEAR_MONTH_FORMAT = 'F Y.'",
"MONTH_DAY_FORMAT = 'j. F'",
"SHORT_DATE_FORMAT = 'j.m.Y.'",
"SHORT_DATETIME_FORMAT = 'j.m.Y. H:i'",
"FIRST_DAY_OF_WEEK = 1",
"DATE_INPUT_FORMATS = (\n '%d.%m.%Y.', '%d.%m.%y.', ... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y' # 25 Ottobre 2006
TIME_FORMAT = 'H:i:s' # 14:30:59
DATETIME_FORMAT... | [
[
14,
0,
0.1667,
0.0238,
0,
0.66,
0,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1905,
0.0238,
0,
0.66,
0.0833,
662,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2143,
0.0238,
0,
0... | [
"DATE_FORMAT = 'd F Y' # 25 Ottobre 2006",
"TIME_FORMAT = 'H:i:s' # 14:30:59",
"DATETIME_FORMAT = 'l d F Y H:i:s' # Mercoledì 25 Ottobre 2006 14:30:59",
"YEAR_MONTH_FORMAT = 'F Y' # Ottobre 2006",
"MONTH_DAY_FORMAT = 'j/F' # 10/2006",
"SHORT_DATE_FORMAT = 'd/m/Y' # 25/12/2009",
"SHORT_DATETIME_FORMAT = ... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
# DATE_FORMAT =
# TIME_FORMAT =
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
# MONTH_DA... | [] | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
# DA... | [
[
1,
0,
0.1667,
0.0417,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.3333,
0.0417,
0,
0.66,
0.1667,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.375,
0.0417,
0,
0... | [
"from __future__ import unicode_literals",
"DATE_FORMAT = 'd F Y'",
"TIME_FORMAT = 'H:i:s'",
"MONTH_DAY_FORMAT = 'j F'",
"SHORT_DATE_FORMAT = 'd.m.Y'",
"DECIMAL_SEPARATOR = ','",
"THOUSAND_SEPARATOR = ' ' # Non-breaking space"
] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. E Y'
TIME_FORMAT = 'G:i:s'
DAT... | [
[
1,
0,
0.093,
0.0233,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.186,
0.0233,
0,
0.66,
0.0714,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.2093,
0.0233,
0,
0.... | [
"from __future__ import unicode_literals",
"DATE_FORMAT = 'j. E Y'",
"TIME_FORMAT = 'G:i:s'",
"DATETIME_FORMAT = 'j. E Y G:i:s'",
"YEAR_MONTH_FORMAT = 'F Y'",
"MONTH_DAY_FORMAT = 'j. F'",
"SHORT_DATE_FORMAT = 'd.m.Y'",
"SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s'",
"FIRST_DAY_OF_WEEK = 1 # Monday",
"DAT... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'G:i:s'
# DA... | [
[
1,
0,
0.1667,
0.0417,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.3333,
0.0417,
0,
0.66,
0.1667,
843,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.375,
0.0417,
0,
0... | [
"from __future__ import unicode_literals",
"DATE_FORMAT = 'j F Y'",
"TIME_FORMAT = 'G:i:s'",
"MONTH_DAY_FORMAT = 'j F'",
"SHORT_DATE_FORMAT = 'd.m.Y'",
"DECIMAL_SEPARATOR = ','",
"THOUSAND_SEPARATOR = ' ' # Non-breaking space"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.