hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
f755fbe374feb302c5308b5472a3122c4f58f0406d7a4e2a9633fd916a5daa86 | import copy
import json
import operator
import re
from functools import partial, reduce, update_wrapper
from urllib.parse import quote as urlquote
from django import forms
from django.conf import settings
from django.contrib import messages
from django.contrib.admin import helpers, widgets
from django.contrib.admin.ch... |
ed7ffd4552cec72b4bf9ac72466cb1ce826ccd26617107824f03eb623bef121e | from django.contrib import admin
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.contrib.contenttypes.admin import GenericTabularInline
from django.contrib.contenttypes.models import ContentType
from django.forms.formsets import DEFAULT_MAX_NUM
from django.forms.... |
ca3a5d96e9ecfb946d3d72c3748f53eae78c3ced4dca5e58aea818bac4fa89fe | import copy
import inspect
import warnings
from functools import partialmethod
from itertools import chain
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.core.exceptions import (
NON_FIELD_ERRORS, FieldDoesNotExist, FieldError, MultipleObjectsReturned,
... |
0f945f3cb3e3b0a0ac14bbd5bcc13ae48674e2d73fab4d2e33c346cb03254380 | import copy
import datetime
import inspect
from decimal import Decimal
from django.core.exceptions import EmptyResultSet, FieldError
from django.db import connection
from django.db.models import fields
from django.db.models.query_utils import Q
from django.db.utils import NotSupportedError
from django.utils.deconstruc... |
39323f4ea0631335d7a42ed487e85bdc1123c72b936e20effc3ec5bc11dc896c | import collections.abc
import copy
import datetime
import decimal
import operator
import uuid
import warnings
from base64 import b64decode, b64encode
from functools import partialmethod, total_ordering
from django import forms
from django.apps import apps
from django.conf import settings
from django.core import checks... |
3b5e26979a5edfca817afebb98970cbb8f0e6cd07c01ebe1a3af1ce20f4c57fd | """
Create SQL statements for QuerySets.
The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get ... |
0c641d757f7fae287159e5b29057522686e043ad828c568cd38b77e757d0ef42 | import datetime
import re
import uuid
from functools import lru_cache
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.utils import strip_quotes, truncate_name
from django.db.utils import DatabaseError
from django.utils import timezone
from ... |
7267c7500194f0dcf02557ccbbb15af40906d7230e0867e52eea5c9b49955e65 | import psycopg2
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.ddl_references import IndexColumns
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_alter_column_type = "ALTER COLUMN %(column)s TYPE %(type)s USING %(column)s::%(type)s"
sql_create_sequence... |
e743a90faf64c7ee76e66963331ffa611a25245520d3044c92137aa803d3b68b | """
SQLite backend for the sqlite3 module in the standard library.
"""
import datetime
import decimal
import functools
import hashlib
import math
import operator
import re
import statistics
import warnings
from itertools import chain
from sqlite3 import dbapi2 as Database
import pytz
from django.core.exceptions impor... |
7ffca0144d4957f3c9998a30d0cb43f5431b6faabfad913c228afa9847448e1f | import copy
import json
import operator
import re
from functools import partial, reduce, update_wrapper
from urllib.parse import quote as urlquote
from django import forms
from django.conf import settings
from django.contrib import messages
from django.contrib.admin import helpers, widgets
from django.contrib.admin.ch... |
f72125e771c4fb577e9bfc0b154fc252a1ad5453c2fb7706d87d9449e3de10da | import datetime
import os
import re
import unittest
from unittest import mock
from urllib.parse import parse_qsl, urljoin, urlparse
import pytz
from django.contrib.admin import AdminSite, ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import ADDITION, DELETIO... |
6cc6004184f855e2727538d5d0d24c2f2ece192f1c56cb4c51fe2dc512af104c | from unittest import mock
from django.db import connection, transaction
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import CaptureQueriesContext
from .models import (
Article, InheritedArticleA, InheritedArticleB, NullablePublicationThrough,
NullableTargetArticle, Publication,... |
d0799e7bf7298ee6297cd2e29e4dd937bb67839bc6702836080383215fffb776 | import datetime
import pickle
import unittest
from operator import attrgetter
from django.core.exceptions import EmptyResultSet, FieldError
from django.db import DEFAULT_DB_ALIAS, connection
from django.db.models import Count, F, Q
from django.db.models.sql.constants import LOUTER
from django.db.models.sql.where impor... |
a8c6a50bf8ad74efa23cb60f9530712472afb17d1df9ac659c5dec6187f0738c | import datetime
import itertools
import unittest
from copy import copy
from unittest import mock
from django.db import (
DatabaseError, IntegrityError, OperationalError, connection,
)
from django.db.models import Model, Q
from django.db.models.constraints import CheckConstraint, UniqueConstraint
from django.db.mod... |
f969ebb19bb96b1223563e9aaf017c0c056026ea7de96829c2993c9d7a1f11e5 | from django.contrib.admin import ModelAdmin, TabularInline
from django.contrib.admin.helpers import InlineAdminForm
from django.contrib.admin.tests import AdminSeleniumTestCase
from django.contrib.auth.models import Permission, User
from django.contrib.contenttypes.models import ContentType
from django.test import Requ... |
64f12f1eaf04dba6cc88fbbbd8df6f4df2929b6bbb04a26ba94091868c175edd | from django.core.checks.translation import E001, check_setting_language_code
from django.test import SimpleTestCase, override_settings
class TranslationCheckTests(SimpleTestCase):
def test_valid_language_code(self):
tags = (
'en', # language
'mas', # langu... |
db37b03ceb727dae007a18fbe9d5153a03a017cb4b8d0cd89bd7a1668c6eff94 | """
A series of tests to establish that the command-line management tools work as
advertised - especially with regards to the handling of the
DJANGO_SETTINGS_MODULE and default settings.py files.
"""
import os
import re
import shutil
import socket
import subprocess
import sys
import tempfile
import unittest
from io imp... |
0bfc8017fc8e3cf2aba7fdf547bffdaf2a11eb606045f5feeff831313c6441f6 | import os
import tempfile
import uuid
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.core.files.storage import FileSystemStorage
from django.db import models
from django.db.models.fields.files import Imag... |
4a0479901fe95aba7e3d420e2eb073d9474807714c99322d6dae91c9824b698f | import datetime
import re
import sys
from contextlib import contextmanager
from unittest import SkipTest, skipIf
from xml.dom.minidom import parseString
import pytz
from django.contrib.auth.models import User
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured
from django.db im... |
240c1a59d936fa8357df59dbe7867310eabf34ddd2365cf7ea731601337116a8 | import collections.abc
import copy
import datetime
import decimal
import operator
import uuid
import warnings
from base64 import b64decode, b64encode
from functools import partialmethod, total_ordering
from django import forms
from django.apps import apps
from django.conf import settings
from django.core import checks... |
aa6cc53ad75533d672c563608caa0e0ba91748342644b9b0a27a16bc35c58e5a | """
Create SQL statements for QuerySets.
The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get ... |
17ec96cffa953924d2212d3103a7b3cbf31940cfe85be411d646d97a46ec2d75 | import datetime
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.utils import (
display_for_field, display_for_value, label_for_field, lookup_field,
)
from django.contrib.admin.views.main import (
ALL_VAR, ORDER_VAR, PAGE_VAR, SEARCH_VAR,
)
from django.co... |
f86025bb2c96ee7389925f8062f2c27047ea8f4203fb146ee09b45dd1126dedc | import datetime
import os
import tempfile
import uuid
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.core.fil... |
c30fe152e10c811174c77e545a89e7dc4a1c113032bd89bce701ab8bf453e43c | import datetime
import os
import tempfile
from io import StringIO
from wsgiref.util import FileWrapper
from django import forms
from django.contrib import admin
from django.contrib.admin import BooleanFieldListFilter
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.admin import GroupAdmi... |
e54caf2735d5d31690485d266ac1051be6f24ba7636e5965cbee429c4767956e | import datetime
import pickle
import unittest
from operator import attrgetter
from django.core.exceptions import EmptyResultSet, FieldError
from django.db import DEFAULT_DB_ALIAS, connection
from django.db.models import Count, F, Q
from django.db.models.sql.constants import LOUTER
from django.db.models.sql.where impor... |
8712c9a0825fb74d0be4c196e4dd7a74c7eeafc1757bb6a872412ea73a9bd4cc | import datetime
import pickle
import unittest
import uuid
from copy import deepcopy
from django.core.exceptions import FieldError
from django.db import DatabaseError, connection, models
from django.db.models import CharField, Q, TimeField, UUIDField
from django.db.models.aggregates import (
Avg, Count, Max, Min, S... |
e30ff01a793f54f023949412a980d52fe9238e4e70c63f5ba120a9595df6ea6f | """
Default Django settings. Override these with settings in the module pointed to
by the DJANGO_SETTINGS_MODULE environment variable.
"""
# This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module depends on the settings.
def gettext_noop(s):
return s
####... |
5d8cd6d836e694d70965c361a0dc00011671e485b0244f4f49786bdacd7eac32 | import psycopg2
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.ddl_references import IndexColumns
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_alter_column_type = "ALTER COLUMN %(column)s TYPE %(type)s USING %(column)s::%(type)s"
sql_create_sequence... |
0f7102453ae2c05845540c6d7356490253fb052d144c054b76f50ab9dd0d122e | import datetime
import pickle
import unittest
from operator import attrgetter
from django.core.exceptions import EmptyResultSet, FieldError
from django.db import DEFAULT_DB_ALIAS, connection
from django.db.models import Count, F, Q
from django.db.models.sql.constants import LOUTER
from django.db.models.sql.where impor... |
44456bcf9a288c3e71e4245975f944cbc9fe2f04f528502fe945760f28c28a9f | import datetime
import re
import uuid
from functools import lru_cache
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.utils import strip_quotes, truncate_name
from django.db.utils import DatabaseError
from django.utils import timezone
from ... |
47d9b70612c89d8679d61c5497107d846b4eae589206683793a6463ad06f5116 | import datetime
import pickle
import unittest
from operator import attrgetter
from django.core.exceptions import EmptyResultSet, FieldError
from django.db import DEFAULT_DB_ALIAS, connection
from django.db.models import Count, F, Q
from django.db.models.sql.constants import LOUTER
from django.db.models.sql.where impor... |
2c2a5f9a3e556c6b3a48b79cd47a45fdda5688c7a0ed476e450f77673686b524 | import os
import sys
from distutils.sysconfig import get_python_lib
from setuptools import find_packages, setup
CURRENT_PYTHON = sys.version_info[:2]
REQUIRED_PYTHON = (3, 6)
# This check and everything above must remain compatible with Python 2.7.
if CURRENT_PYTHON < REQUIRED_PYTHON:
sys.stderr.write("""
======... |
29087a8a23f81156a2d47592f5ca360cba53ab65847b9d016f1117d4ddc3ccd3 | #!/usr/bin/env python
#
# This Python file contains utility scripts to manage Django translations.
# It has to be run inside the django git root directory.
#
# The following commands are available:
#
# * update_catalogs: check for new strings in core and contrib catalogs, and
# output how much string... |
7a147eeae70b87f866851434819740add39f1deef0e541e6e1d3030d21a34496 | from django.utils.version import get_version
VERSION = (3, 1, 0, 'alpha', 0)
__version__ = get_version(VERSION)
def setup(set_prefix=True):
"""
Configure the settings (this happens as a side effect of accessing the
first setting), configure logging and populate the app registry.
Set the thread-local... |
24635919b9379b671056c86c88cdf049bb7bff8023779582e1689c84e3e711c7 | #!/usr/bin/env python
import argparse
import atexit
import copy
import os
import shutil
import socket
import subprocess
import sys
import tempfile
import warnings
try:
import django
except ImportError as e:
raise RuntimeError(
'Django module not found, reference tests/README.rst for instructions.'
... |
49b9d99c718d8a5dec2ae1f5f8150dc02ddfff70b978dccd5bc5cdf23f4a8e91 | # Django documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 27 09:06:53 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't picklable (module imports are okay... |
86c1983c8711f30440ae2637ac9ceb9d649289eab360c04ad36d8a6b2b5fd5d3 | import ctypes
import itertools
import logging
import multiprocessing
import os
import pickle
import textwrap
import unittest
from importlib import import_module
from io import StringIO
from django.core.management import call_command
from django.db import connections
from django.test import SimpleTestCase, TestCase
fro... |
2dde8fab86594471353d76112817efb5551c145e02b7a5c2b5a4ca120207f07b | import json
import mimetypes
import os
import re
import sys
from copy import copy
from functools import partial
from http import HTTPStatus
from importlib import import_module
from io import BytesIO
from urllib.parse import unquote_to_bytes, urljoin, urlparse, urlsplit
from django.conf import settings
from django.core... |
79d9cd68145e32a3b057d5f4b9685e3f150d4601b32b000736159e6dd9217f15 | import difflib
import json
import posixpath
import sys
import threading
import unittest
from collections import Counter
from contextlib import contextmanager
from copy import copy
from difflib import get_close_matches
from functools import wraps
from unittest.util import safe_repr
from urllib.parse import (
parse_q... |
7f00c21fabdc89632afac737fa1455f002b2b09b067c3c0df2795f50056dc903 | import os
import time
import warnings
from asgiref.local import Local
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.core.signals import setting_changed
from django.db import connections, router
from django.db.utils import ConnectionRouter
from django.dispatch import ... |
56b71540f095425432b2a9809efb74675c65f2913c742fce3e9e9264e3adbf84 | """
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
import mimetypes
import posixpath
import re
from pathlib import Path
from django.http import (
FileResponse, Http404, HttpResponse, HttpResponseNotModified,
)
from dja... |
4d351c3ff61c056ae3d82bdbec988be7f2cdea32bc96a5599b5e2ad1fadb020c | import itertools
import json
import os
import re
from urllib.parse import unquote
from django.apps import apps
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.template import Context, Engine
from django.urls import translate_url
from django.utils.fo... |
d275a79e3c7c63310bfaaa9c42924f65fa396ddbde0bc7ead8b6d6fe053c7794 | import functools
import re
import sys
import types
from pathlib import Path
from django.conf import settings
from django.http import Http404, HttpResponse, HttpResponseNotFound
from django.template import Context, Engine, TemplateDoesNotExist
from django.template.defaultfilters import pprint
from django.urls import re... |
1727c0e9df2b5a87aec9c5f046db51aff8dc7d9b7b0a28edf5520cd2e578e5fe | from django.conf import settings
from django.http import HttpResponseForbidden
from django.template import Context, Engine, TemplateDoesNotExist, loader
from django.utils.translation import gettext as _
from django.utils.version import get_docs_version
# We include the template inline since we need to be able to relia... |
f9f0bda1e85a77c8f0e566762dae66f2ca1dd6a94787728c345bb87d90a53ef5 | """
Settings and configuration for Django.
Read values from the module specified by the DJANGO_SETTINGS_MODULE environment
variable, and then from django.conf.global_settings; see the global_settings.py
for a list of all possible variables.
"""
import importlib
import os
import time
import traceback
import warnings
f... |
b9170b6a269b2656d02364217d021943823943cda0b3e9e656309bbd506c71ba | """
Default Django settings. Override these with settings in the module pointed to
by the DJANGO_SETTINGS_MODULE environment variable.
"""
# This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module depends on the settings.
def gettext_noop(s):
return s
####... |
2b575b39bc418199e81bd96947b158444c1249ec26be62c1c662f7eeb05dcdae | import functools
import itertools
import logging
import os
import signal
import subprocess
import sys
import threading
import time
import traceback
import weakref
from collections import defaultdict
from pathlib import Path
from types import ModuleType
from zipimport import zipimporter
from django.apps import apps
fro... |
6c0be95dcb6e1bed8b812ecef804003822558512966d088025c74f6710e9ea56 | import html.entities
import re
import unicodedata
import warnings
from gzip import GzipFile
from io import BytesIO
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.functional import SimpleLazyObject, keep_lazy_text, lazy
from django.utils.translation import gettext as _, gettext_lazy, pg... |
95fe06de03a610187c3bc9a65a5deee99a048104796eaa9f9a687422f4c94ffd | import datetime
import functools
import os
import subprocess
import sys
from distutils.version import LooseVersion
# Private, stable API for detecting the Python version. PYXY means "Python X.Y
# or later". So that third-party apps can use these values, each constant
# should remain as long as the oldest supported Dja... |
1357ab0a275fb97d3c3f639fd7346cb070b357b4730e56db2f7b1576d5bb9749 | """
Timezone-related classes and functions.
"""
import functools
from contextlib import ContextDecorator
from datetime import datetime, timedelta, timezone, tzinfo
import pytz
from asgiref.local import Local
from django.conf import settings
__all__ = [
'utc', 'get_fixed_timezone',
'get_default_timezone', 'g... |
e9faecb4cbc56dc43a17cb94cd806bb149780fd5ceba2822bad2a4ab2637c521 | import inspect
import warnings
class RemovedInNextVersionWarning(DeprecationWarning):
pass
class RemovedInDjango40Warning(PendingDeprecationWarning):
pass
class warn_about_renamed_method:
def __init__(self, class_name, old_method_name, new_method_name, deprecation_warning):
self.class_name = c... |
8830f2058bc5968905d0875a0322b71cf28eb8c37ed272d3c1eefe4b95fbaa9a | import codecs
import datetime
import locale
import warnings
from decimal import Decimal
from urllib.parse import quote
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.functional import Promise
class DjangoUnicodeDecodeError(UnicodeDecodeError):
def __init__(self, obj, *args):
... |
0fefa559bd1e867cb3cc5d4ffc455566ce09bd2eda296f95652569550c0d1166 | """HTML utilities suitable for global use."""
import html
import json
import re
from html.parser import HTMLParser
from urllib.parse import (
parse_qsl, quote, unquote, urlencode, urlsplit, urlunsplit,
)
from django.utils.encoding import punycode
from django.utils.functional import Promise, keep_lazy, keep_lazy_t... |
0afcee6cef7545ece9643d53f0d8f5c50e0cd6b1a13dc5769867b7ab839d3eaa | import logging
import logging.config # needed when logging_config doesn't start with logging.config
from copy import copy
from django.conf import settings
from django.core import mail
from django.core.mail import get_connection
from django.core.management.color import color_style
from django.utils.module_loading impo... |
ae4c1f5b5c779990b981b5ba87c3b461ee5c0cb4cd2ddfddbd587bd11565cb1e | """
Based on "python-archive" -- https://pypi.org/project/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 Softw... |
b4e20e4ce6e3d565f384f6424f6c560496950315ad1867429a188b532017993f | import asyncio
import functools
from django.core.exceptions import SynchronousOnlyOperation
def async_unsafe(message):
"""
Decorator to mark functions as async-unsafe. Someone trying to access
the function while in an async context will get an error message.
"""
def decorator(func):
@func... |
c80206b78a36f3e4bbf24788a6e3c1f9381681551be29b427f4a4bd0fb19574c | import base64
import calendar
import datetime
import re
import unicodedata
import warnings
from binascii import Error as BinasciiError
from email.utils import formatdate
from urllib.parse import (
ParseResult, SplitResult, _coerce_args, _splitnetloc, _splitparams, quote,
quote_plus, scheme_chars, unquote, unquo... |
0abcb13a31646c792fd80a3e6a3cd5c7232b964408a21ad6a8a1fea4b11a8d8b | """
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... |
fc2fefeca6e88d3f820f77e7db224615b8c26d5e47909af7301a99ae38f12beb | import os
import tempfile
from os.path import abspath, dirname, join, normcase, sep
from pathlib import Path
from django.core.exceptions import SuspiciousFileOperation
def safe_join(base, *paths):
"""
Join one or more path components to the base path component intelligently.
Return a normalized, absolute... |
4a9c9afcc083d9401a18c0f340a1427a11914d8703e86b1e488df8e645714208 | """
Django's support for templates.
The django.template namespace contains two independent subsystems:
1. Multiple Template Engines: support for pluggable template backends,
built-in backends and backend-independent APIs
2. Django Template Language: Django's own template engine, including its
built-in loaders, ... |
b3cc9cb25570be5e94e496e0ab0d8582cdd46ad0ed9538c60243519cc2bfffac | """
This is the Django template system.
How it works:
The Lexer.tokenize() method converts a template string (i.e., a string
containing markup with custom template tags) to tokens, which can be either
plain text (TokenType.TEXT), variables (TokenType.VAR), or block statements
(TokenType.BLOCK).
The Parser() class ta... |
1cf5784ebbc1beaffefb09a72732a19e75184e3d69475f8049181d9b122139e5 | import functools
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
from .base import Template
from .context import Context, _builtin_context_processors
from .exceptions import TemplateDoesNotExist
from .lib... |
f69bc8608763b422667416dffba14149e158755fed1818a54d2a3d84e1dd20ad | """Default tags used by the template system, available to all templates."""
import re
import sys
import warnings
from collections import namedtuple
from datetime import datetime
from itertools import cycle as itertools_cycle, groupby
from django.conf import settings
from django.utils import timezone
from django.utils.... |
e1982691ae81ee77cdb282170fa3be7fa1659c21f6232090c715c8f2a7ac3915 | from contextlib import contextmanager
from copy import copy
# Hard-coded processor for easier use of CSRF protection.
_builtin_context_processors = ('django.template.context_processors.csrf',)
class ContextPopException(Exception):
"pop() has been called more times than push()"
pass
class ContextDict(dict):... |
6bea604fbaa1c96970b3d11d227f96fed3d660706d1f5d571d7e372ece9b08d7 | import re
from django.conf import settings
from django.http import HttpResponsePermanentRedirect
from django.utils.deprecation import MiddlewareMixin
class SecurityMiddleware(MiddlewareMixin):
def __init__(self, get_response=None):
self.sts_seconds = settings.SECURE_HSTS_SECONDS
self.sts_include_... |
d0065d7b4a76393cbf87aec66648adeb4046276989efd5c5a317265abb4717a5 | """
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
from django.utils.deprecation import MiddlewareMixin
class XFrameOptionsMiddleware(MiddlewareMixin):
... |
3986d36561006fbb731241bb23259932556804ba498361888d9d459565a804fb | import pkgutil
from importlib import import_module
from pathlib import Path
from asgiref.local import Local
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
DEFAULT_DB_ALI... |
62564020b8637181ab9a957bd6d933047e9639b4c944d4fa90e57a3e8ca3d890 | from urllib.parse import urlsplit, urlunsplit
from asgiref.local import Local
from django.utils.encoding import iri_to_uri
from django.utils.functional import lazy
from django.utils.translation import override
from .exceptions import NoReverseMatch, Resolver404
from .resolvers import _get_cached_resolver, get_ns_res... |
5d0b54b6c40681060d8320c7bcf87819d254fad0824afbd6a7b5f8788499d867 | """
This module converts requested URLs to callback view functions.
URLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a ResolverMatch object which provides access to all
attributes of the resolved URL match.
"""
import functools
import inspect
import re
import string
from i... |
9d33da9374d6fa04ddcda91b6c704dc6bc1f6485fa838d01bb5b83f2dd798499 | """
Helper functions for creating Form classes from Django models
and database field objects.
"""
from itertools import chain
from django.core.exceptions import (
NON_FIELD_ERRORS, FieldError, ImproperlyConfigured, ValidationError,
)
from django.forms.fields import ChoiceField, Field
from django.forms.forms impor... |
8c32ff2f502b1fea93478ffa506005590a9a1d331daadf16223ce871414ddbdd | """
HTML Widget classes
"""
import copy
import datetime
import re
import warnings
from collections import defaultdict
from itertools import chain
from django.conf import settings
from django.forms.utils import to_current_timezone
from django.templatetags.static import static
from django.utils import datetime_safe, fo... |
8fac3d3ecb2499b8fac5818983d9d19b06871120ff4504d4ed50584c1fabe599 | import datetime
from django.forms.utils import flatatt, pretty_name
from django.forms.widgets import Textarea, TextInput
from django.utils.functional import cached_property
from django.utils.html import conditional_escape, format_html, html_safe
from django.utils.safestring import mark_safe
from django.utils.translati... |
d8ed7c709b3c80d0e8295547add82c39cf443e883b1ab96324e747b02baf5a32 | """
Field classes.
"""
import copy
import datetime
import math
import operator
import os
import re
import uuid
from decimal import Decimal, DecimalException
from io import BytesIO
from urllib.parse import urlsplit, urlunsplit
from django.core import validators
from django.core.exceptions import ValidationError
from d... |
d0a9780fddb55a027ae314a01e507283297a7c0e152e7a2ce27de940f9a04786 | import json
from collections import UserList
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils import timezone
from django.utils.html import escape, format_html, format_html_join, html_safe
from django.utils.translation import gettext_lazy as _
def pretty_name(name... |
9c1da4854e5e0315184c49eb1e12df8f04104eb7495e87a3bacebeb5de0505fd | """
Form classes
"""
import copy
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
from django.forms.fields import Field, FileField
from django.forms.utils import ErrorDict, ErrorList
from django.forms.widgets import Media, MediaDefiningClass
from django.utils.datastructures import MultiValueDict
f... |
3762f7192e85ea82fec83f53bb6a2db290a2d9485b450f742c4c7713138fd66d | import django
from django.core.handlers.asgi import ASGIHandler
def get_asgi_application():
"""
The public interface to Django's ASGI support. Return an ASGI 3 callable.
Avoids making django.core.handlers.ASGIHandler a public API, in case the
internal implementation changes or moves in the future.
... |
7d5392f3a9a646471bcb94061c8fea9507808622de3c89e3797c2d04c2a7e23f | import collections.abc
import inspect
import warnings
from math import ceil
from django.utils.functional import cached_property
from django.utils.inspect import method_has_no_args
from django.utils.translation import gettext_lazy as _
class UnorderedObjectListWarning(RuntimeWarning):
pass
class InvalidPage(Exc... |
d769615d353f272614405c92a322ef250bb43a4601dac69996201f64b8f247a2 | """
Global Django exception and warning classes.
"""
class FieldDoesNotExist(Exception):
"""The requested model field does not exist"""
pass
class AppRegistryNotReady(Exception):
"""The django.apps registry is not populated yet"""
pass
class ObjectDoesNotExist(Exception):
"""The requested obje... |
a81f10d6206b77df6a8333ba5a0637197d28488033afdb0c1fa96c14dcda28e3 | from django.dispatch import Signal
request_started = Signal(providing_args=["environ", "scope"])
request_finished = Signal()
got_request_exception = Signal(providing_args=["request"])
setting_changed = Signal(providing_args=["setting", "value", "enter"])
|
c6a151043f1b3cfd23c08f28ca03698fb21b01fe5f4f61a4554d6087dfc28351 | import ipaddress
import re
from pathlib import Path
from urllib.parse import urlsplit, urlunsplit
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
from django.utils.encoding import punycode
from django.utils.functional import SimpleLazyObject
from django.utils.ipv... |
8f15396b31f4636f552105640e19eae82f467ee0a60f1638309fc51f344a4085 | import datetime
import json
import mimetypes
import os
import re
import sys
import time
from email.header import Header
from http.client import responses
from urllib.parse import quote, urlparse
from django.conf import settings
from django.core import signals, signing
from django.core.exceptions import DisallowedRedir... |
35ccb145e3554892994481b03e672ed4c68331fd4fe3a9538408cb12637309ff | import cgi
import codecs
import copy
import re
from io import BytesIO
from itertools import chain
from urllib.parse import quote, urlencode, urljoin, urlsplit
from django.conf import settings
from django.core import signing
from django.core.exceptions import (
DisallowedHost, ImproperlyConfigured, RequestDataTooBi... |
82d06dcb580c7f6c2e5742ccbecca1f0ebc25dff0071e2f25110547ba323999c | import datetime
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.http import Http404
from django.utils import timezone
from django.utils.functional import cached_property
from django.utils.translation import gettext as _
from django.views... |
40497efcb1847ac4e220fc47071f7278e1fbb4ef9c126637da13ab6a03c9a826 | from django.core.exceptions import ImproperlyConfigured
from django.core.paginator import InvalidPage, Paginator
from django.db.models.query import QuerySet
from django.http import Http404
from django.utils.translation import gettext as _
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
... |
6965d2036dfd59db512ddd631eca1a95161fe01aeb5c3e8eb72d5b526e2f214b | """Translation helper functions."""
import functools
import gettext as gettext_module
import os
import re
import sys
import warnings
from asgiref.local import Local
from django.apps import apps
from django.conf import settings
from django.conf.locale import LANG_INFO
from django.core.exceptions import AppRegistryNotR... |
3361ea94c93541fa42ad4067de5335db5390e2d5d9f3e0e059bca8d5af5a69be | from pathlib import Path
from asgiref.local import Local
from django.apps import apps
def watch_for_translation_changes(sender, **kwargs):
"""Register file watchers for .mo files in potential locale paths."""
from django.conf import settings
if settings.USE_I18N:
directories = [Path('locale')]
... |
1917ab282207554d0b8dc8a84fd0a663c35a3f4c887900385abbfa971758f4d3 | import string
from django.core.exceptions import ImproperlyConfigured
from django.template import Origin, TemplateDoesNotExist
from django.utils.html import conditional_escape
from .base import BaseEngine
from .utils import csrf_input_lazy, csrf_token_lazy
class TemplateStrings(BaseEngine):
app_dirname = 'temp... |
7aff60276d47c2293a658444be8fd632c1e46701254946850c50239683b6b270 | from importlib import import_module
from pkgutil import walk_packages
from django.apps import apps
from django.conf import settings
from django.template import TemplateDoesNotExist
from django.template.context import make_context
from django.template.engine import Engine
from django.template.library import InvalidTemp... |
68040cd54e1cd7272dfa23d1863384d7445dc0c72f4895ea25adb7ca39c63a84 | import functools
import re
from itertools import chain
from django.conf import settings
from django.db import models
from django.db.migrations import operations
from django.db.migrations.migration import Migration
from django.db.migrations.operations.models import AlterModelOptions
from django.db.migrations.optimizer ... |
cb8780044644e1e0a2b01c74370a671bd7e4b5d119a4e9e3fd9ad30a8b0e02a0 | import builtins
import collections.abc
import datetime
import decimal
import enum
import functools
import math
import re
import types
import uuid
from django.conf import SettingsReference
from django.db import models
from django.db.migrations.operations.base import Operation
from django.db.migrations.utils import COMP... |
73a26717515f235fa1f74cd7d3e4ecda5a43c2c979ada368382f5217f2dfbe41 | """
Classes to represent the definitions of aggregate functions.
"""
from django.core.exceptions import FieldError
from django.db.models.expressions import Case, Func, Star, When
from django.db.models.fields import IntegerField
from django.db.models.functions.mixins import (
FixDurationInputMixin, NumericOutputFiel... |
9a101962be79dc9a06012af9b54a69222ab4e426421968809909f3f6b2825f7c | from django.db.backends.utils import names_digest, split_identifier
from django.db.models.query_utils import Q
from django.db.models.sql import Query
__all__ = ['Index']
class Index:
suffix = 'idx'
# The max length of the name of the index (restricted to 30 for
# cross-database compatibility with Oracle)... |
c30350f51ac9b3b625cf3ac6dc28c317cefb545eb0860f85e2bc839fadad54b7 | """
The main QuerySet implementation. This provides the public API for the ORM.
"""
import copy
import operator
import warnings
from collections import namedtuple
from functools import lru_cache
from itertools import chain
from django.conf import settings
from django.core import exceptions
from django.db import (
... |
c50fe7303c336b9b2d3cfd4349db382d830e7db5572583995771acf769ebeb99 | from django.core.exceptions import ObjectDoesNotExist
from django.db.models import signals
from django.db.models.aggregates import * # NOQA
from django.db.models.aggregates import __all__ as aggregates_all
from django.db.models.constraints import * # NOQA
from django.db.models.constraints import __all__ as constraint... |
d4d823144d282693659da8a0eb73e9295afa6e3eab6dd2db0241b404bb72c1f2 | import copy
import inspect
from bisect import bisect
from collections import defaultdict
from django.apps import apps
from django.conf import settings
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
from django.db import connections
from django.db.models import Manager
from django.db.models.... |
f6cdfb57102ad1ee977af08c8242defdc317066ff6da149b660654f893ff123f | import enum
from django.utils.functional import Promise
__all__ = ['Choices', 'IntegerChoices', 'TextChoices']
class ChoicesMeta(enum.EnumMeta):
"""A metaclass for creating a enum choices."""
def __new__(metacls, classname, bases, classdict):
labels = []
for key in classdict._member_names:
... |
67f6ed5e0851c3c91b58ad58602a0800b23350a7012b91cc6789aa9aefae2b1f | import copy
import inspect
import warnings
from functools import partialmethod
from itertools import chain
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.core.exceptions import (
NON_FIELD_ERRORS, FieldDoesNotExist, FieldError, MultipleObjectsReturned,
... |
b16133e79e3966e98d0f13a34a660a1ae88f0de5214226df31a190e3d3e6dff3 | """
Various data structures used in query construction.
Factored out from django.db.models.query to avoid making the main module very
large and/or so that they can be used by other modules without getting into
circular import difficulties.
"""
import copy
import functools
import inspect
from collections import namedtu... |
63c24befd161bfb7832a7c3532b983ab1c463f8f65f4ca92f70025eaba3dcac3 | import copy
import datetime
import inspect
from decimal import Decimal
from django.core.exceptions import EmptyResultSet, FieldError
from django.db import connection
from django.db.models import fields
from django.db.models.query_utils import Q
from django.db.utils import NotSupportedError
from django.utils.deconstruc... |
38cac198f58ee232c92cb40e52ebad2886c44f39222b05d1657281b0688cac00 | import operator
from collections import Counter, defaultdict
from functools import partial, reduce
from itertools import chain
from operator import attrgetter
from django.db import IntegrityError, connections, transaction
from django.db.models import query_utils, signals, sql
class ProtectedError(IntegrityError):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.