hash
stringlengths
64
64
content
stringlengths
0
1.51M
a827f9f66e337105fac17adb352c48402bd668585a29a81be88c4491dc7fe556
from functools import partial from django.db.models.utils import make_model_tuple from django.dispatch import Signal class_prepared = Signal() class ModelSignal(Signal): """ Signal subclass that allows the sender to be lazily specified as a string of the `app_label.ModelName` form. """ def _lazy...
e84b1d6336b35fcdb7787f889f3605b677956f091ff8dc11895d63c101de3531
""" 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 import warnings from collection...
a61af9fff236c72d9d5ca289e22d5d0313c2cf2856eaac2e2670ce4c3b7a11b8
import copy import datetime import inspect from decimal import Decimal from django.core.exceptions import EmptyResultSet, FieldError from django.db import NotSupportedError, connection from django.db.models import fields from django.db.models.constants import LOOKUP_SEP from django.db.models.query_utils import Q from ...
0cc95a388bc2a823831a9277ae6a8b201c7d90cd7279f830e22f88a438bba4e0
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): ...
5ed6efc638005d286bd4f1d464c5a15aad7441c7fd7df54a8379726863c585a3
import itertools import math import warnings from copy import copy from django.core.exceptions import EmptyResultSet from django.db.models.expressions import Case, Exists, Func, Value, When from django.db.models.fields import ( BooleanField, CharField, DateTimeField, Field, IntegerField, UUIDField, ) from django.d...
c29abd3e6da3fe31239764422b23d6c8af272f24507ce88a92139c9a3995987e
from enum import Enum from django.db.models.query_utils import Q from django.db.models.sql.query import Query __all__ = ['CheckConstraint', 'Deferrable', 'UniqueConstraint'] class BaseConstraint: def __init__(self, name): self.name = name def constraint_sql(self, model, schema_editor): rais...
cdeff7f43edc36fe9f5609d581ce460bce4f0eebc6134c5d11796e593b4e94fa
import datetime import decimal import functools import hashlib import logging import time from contextlib import contextmanager from django.db import NotSupportedError logger = logging.getLogger('django.db.backends') class CursorWrapper: def __init__(self, cursor, db): self.cursor = cursor self....
625d782a36098a34edd72a48662ae9f74952ed44c9f14a203c523f0f06dcb127
from django.dispatch import Signal connection_created = Signal()
ae4e8366d59ff252c86ac7e5c8d7c7c1ccbfa7773f99530ac434e1dd6161799a
from django.db import models from django.db.migrations.operations.base import Operation from django.db.migrations.state import ModelState from django.db.models.options import normalize_together from django.utils.functional import cached_property from .fields import ( AddField, AlterField, FieldOperation, RemoveFie...
cdec3ab0276eee543e3088d590d6c98ca5455b3fb8e8fe258543354ef05f0ccb
from django.db import router class Operation: """ Base class for migration operations. It's responsible for both mutating the in-memory model state (see db/migrations/state.py) to represent what it performs, as well as actually performing it against a live database. Note that some operations...
45837529511b0e1a4d6a7c4cbd2a9f68cdae134edb9fd5da0aaf3823fa291705
from django.core.exceptions import FieldDoesNotExist from django.db.models import NOT_PROVIDED from django.utils.functional import cached_property from .base import Operation from .utils import field_is_referenced, field_references, get_references class FieldOperation(Operation): def __init__(self, model_name, n...
4fec83cc6b91f873c74ee1dde703ab4ea74d3fb27d51000ac06e4b59903b2a58
from collections import namedtuple from django.db.models.fields.related import RECURSIVE_RELATIONSHIP_CONSTANT def resolve_relation(model, app_label=None, model_name=None): """ Turn a model class or model reference string and return a model tuple. app_label and model_name are used to resolve the scope o...
95bb621d601a5da786fa6f6c49d5ee6a563d8db59513b8fd0fedf768dc64a25c
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...
80bc264b44da1df28d5b1b1046f8a19f9569a974317ebba31ccc1d39b7cf8d35
import functools import inspect from functools import partial from django import forms from django.apps import apps from django.conf import SettingsReference, settings from django.core import checks, exceptions from django.db import connection, router from django.db.backends import utils from django.db.models import Q...
8dc8ad8f3fe55273e5e1b50973557b10726905aebfe8e9924ef7d825a90ae671
import json from django import forms from django.core import checks, exceptions from django.db import NotSupportedError, connections, router from django.db.models import lookups from django.db.models.lookups import PostgresOperatorLookup, Transform from django.utils.translation import gettext_lazy as _ from . import ...
e730065b62151d1d1ca095c7ec1438c2e5544407ab5cbb1c3fd8b195a1fd46be
import datetime import posixpath from django import forms from django.core import checks from django.core.files.base import File from django.core.files.images import ImageFile from django.core.files.storage import Storage, default_storage from django.db.models import signals from django.db.models.fields import Field f...
785694ba0c973cdfd3796d988b887abbd4ef4eaa685ea844c8a2b0a02186e0b4
""" Accessors for related objects. When a field defines a relation between two models, each model class provides an attribute to access related instances of the other model class (unless the reverse accessor has been disabled with related_name='+'). Accessors are implemented as descriptors in order to customize acces...
4d6b1283403d967ea5eddd71a913da66cd2cfd1d0e6fa41ed765dd1ab56b8e44
from django.db import NotSupportedError from django.db.models.expressions import Func, Value from django.db.models.fields import IntegerField from django.db.models.functions import Coalesce from django.db.models.lookups import Transform class BytesToCharFieldConversionMixin: """ Convert CharField results from...
6a170a9183807f74c93a475c21b7e3c663a4ef6691fda85363c7a604d8e20a98
"""Database functions that do comparisons or type conversions.""" from django.db.models.expressions import Func, Value class Cast(Func): """Coerce an expression to a new field type.""" function = 'CAST' template = '%(function)s(%(expressions)s AS %(db_type)s)' def __init__(self, expression, output_fi...
0ede1c6283b53827aaf5cc015a09f6b94390445a8f042d325014f80fcf0da2e1
""" 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 ...
d5fa6a0f7259ae4b3c04284c21c531d3189413934629e217cc11894f7f3971a7
import collections import re from functools import partial from itertools import chain from django.core.exceptions import EmptyResultSet, FieldError from django.db import DatabaseError, NotSupportedError from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import OrderBy, Random, RawSQL,...
d2dec86d2b14481fd123362e997386f2a044bfacbdf6229385502f168c23018d
""" Constants specific to the SQL storage portion of the ORM. """ # Size of each "chunk" for get_iterator calls. # Larger values are slightly faster at the expense of more storage space. GET_ITERATOR_CHUNK_SIZE = 100 # Namedtuples for sql.* internal use. # How many results to expect from a cursor.execute call MULTI ...
36d71cf7ecf77abc475a620e2967186a011093ec4f652eebdb45f9895ea082ee
""" Query subclasses which provide extra functionality beyond simple data retrieval. """ from django.core.exceptions import FieldError from django.db.models.query_utils import Q from django.db.models.sql.constants import ( CURSOR, GET_ITERATOR_CHUNK_SIZE, NO_RESULTS, ) from django.db.models.sql.query import Query ...
00c3e6e47842a13373ca0f1cfcc350b6d431e39c2c53b6703d86042c3b0443e2
from django.db import InterfaceError from django.db.backends.base.features import BaseDatabaseFeatures class DatabaseFeatures(BaseDatabaseFeatures): interprets_empty_strings_as_nulls = True has_select_for_update = True has_select_for_update_nowait = True has_select_for_update_skip_locked = True ha...
d51ac09b91e6b414656999d1da135dd68affbda0e4cf98c94dbee953989f11d9
from collections import namedtuple import cx_Oracle from django.db import models from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) FieldInfo = namedtuple('FieldInfo', BaseFieldInfo._fields + ('is_autofield', 'is_json')) class DatabaseIntrosp...
07b8e36bb37073a51b816120276da7c02b2429b2c47a621dc38d17a76aa7d625
""" Oracle database backend for Django. Requires cx_Oracle: https://oracle.github.io/python-cx_Oracle/ """ import datetime import decimal import os import platform from contextlib import contextmanager from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import Integ...
86c1a9c84247e83e1975cfc94a4bdffd36cfe71b9dc3f2980d81cc0a3c34376c
import datetime import uuid from functools import lru_cache from django.conf import settings from django.db import DatabaseError, NotSupportedError from django.db.backends.base.operations import BaseDatabaseOperations from django.db.backends.utils import strip_quotes, truncate_name from django.db.models import AutoFie...
2d4fa579f797f7b4143c226fcc9f36aed17fd55804494a511e3a9be3bc671f44
import copy import datetime import re from django.db import DatabaseError from django.db.backends.base.schema import BaseDatabaseSchemaEditor class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_column = "ALTER TABLE %(table)s ADD %(column)s %(definition)s" sql_alter_column_type = "MODIFY %(colu...
564e004e00cb738c50cdbd3a3053be370e8e03cd6c4a9a932461d111dbcd16f9
import shutil import subprocess from django.db.backends.base.client import BaseDatabaseClient class DatabaseClient(BaseDatabaseClient): executable_name = 'sqlplus' wrapper_name = 'rlwrap' def runshell(self, parameters): conn_string = self.connection._connect_string() args = [self.executa...
e176a7ec60f0a3a607e8498aafbcc8dd7ae2bff34d7fa6f0f5cc49650334569b
import datetime from .base import Database class InsertVar: """ A late-binding cursor variable that can be passed to Cursor.execute as a parameter, in order to receive the id of the row created by an insert statement. """ types = { 'AutoField': int, 'BigAutoField': int, ...
3c82b668a48bec84d63d5f8778fbb48e9d2169bdf86fd8985d92a14277442688
import sys from django.conf import settings from django.db import DatabaseError from django.db.backends.base.creation import BaseDatabaseCreation from django.utils.crypto import get_random_string from django.utils.functional import cached_property TEST_DATABASE_PREFIX = 'test_' class DatabaseCreation(BaseDatabaseCr...
db3f3e9061a29f22ee8729d8273a1abb9bdbf9f2bd117a9db4e3aa55da1c0131
from django.db import ProgrammingError from django.utils.functional import cached_property class BaseDatabaseFeatures: gis_enabled = False allows_group_by_pk = False allows_group_by_selected_pks = False empty_fetchmany_value = [] update_can_self_select = True # Does the backend distinguish be...
8e6c06155e654eeb27ffdf7485e81037f2cc45d0a4a47c0e4507d05cd01bf7b6
from collections import namedtuple # Structure returned by DatabaseIntrospection.get_table_list() TableInfo = namedtuple('TableInfo', ['name', 'type']) # Structure returned by the DB-API cursor.description interface (PEP 249) FieldInfo = namedtuple('FieldInfo', 'name type_code display_size internal_size precision sca...
c9570ce8c5d5f060f224162e16a4acce72685c9ba5ec72e4b0ca3db6607450e1
import copy import threading import time import warnings from collections import deque from contextlib import contextmanager import _thread import pytz from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import DEFAULT_DB_ALIAS, DatabaseError from django.db.backends...
eb9bea832a5f9406948e75f8d95ec570c707046deef86606592254ad68bbbac5
import datetime import decimal from importlib import import_module import sqlparse from django.conf import settings from django.db import NotSupportedError, transaction from django.db.backends import utils from django.utils import timezone from django.utils.encoding import force_str class BaseDatabaseOperations: ...
08b66978aefb5d826f2b3e44d71f2919c3ff4b710dc7092e1546c06fc5d5f4b9
import logging from datetime import datetime from django.db.backends.ddl_references import ( Columns, ForeignKeyName, IndexName, Statement, Table, ) from django.db.backends.utils import names_digest, split_identifier from django.db.models import Deferrable, Index from django.db.transaction import TransactionManage...
3fe2a2bab52acdcf9526905fb93041a506403f24c83f2b422667fa65866a713e
class BaseDatabaseClient: """Encapsulate backend-specific methods for opening a client shell.""" # This should be a string representing the name of the executable # (e.g., "psql"). Subclasses must override this. executable_name = None def __init__(self, connection): # connection is an insta...
878114b14a08357a15b39b115a15281f994ff64da13ff9e1bafde5983821bb00
import os import sys from io import StringIO from django.apps import apps from django.conf import settings from django.core import serializers from django.db import router from django.db.transaction import atomic # The prefix to put on the default database name when creating # the test database. TEST_DATABASE_PREFIX ...
535d526c1f7595c5b369964fc58f7a0a293db3dc0eeb5726fdf3b19d7f82bf3a
from django.core import checks from django.db.backends.base.validation import BaseDatabaseValidation from django.utils.version import get_docs_version class DatabaseValidation(BaseDatabaseValidation): def check(self, **kwargs): issues = super().check(**kwargs) issues.extend(self._check_sql_mode(**...
439a0ee6bec0701f6157a8404443117abab9367c80395306505d55f77851bc39
import operator from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value = () allows_group_by_pk = True related_fields_match_type = True # MySQL doesn't support sliced subq...
dd044604e34fe42783071852119d8ed0b8fb1e041e82c0023a821e2fc6228b6a
from collections import namedtuple import sqlparse from MySQLdb.constants import FIELD_TYPE from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) from django.db.models import Index from django.utils.datastructures import OrderedSet FieldInfo = nam...
8e7b4b64746570cd40a93f6fcf63f902dde00a4e093d7ebc65043663407a4f29
""" MySQL database backend for Django. Requires mysqlclient: https://pypi.org/project/mysqlclient/ """ from django.core.exceptions import ImproperlyConfigured from django.db import IntegrityError from django.db.backends import utils as backend_utils from django.db.backends.base.base import BaseDatabaseWrapper from dja...
49675a148bf64a0c213411dc7cc729291e947b0736f38e55964735122277749a
import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.utils import timezone from django.utils.duration import duration_microseconds from django.utils.encoding import force_str class DatabaseOperations(BaseDatabaseOperations): compiler_modul...
f23125d1e1f3eaee2a794bec26413d8d1a39f21d5afc6b8b2b6ee7cbb844b7af
from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.models import NOT_PROVIDED class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_rename_table = "RENAME TABLE %(old_table)s TO %(new_table)s" sql_alter_column_null = "MODIFY %(column)s %(type)s NULL" sql_alter_column_...
08cef97070d7abd9b0e38022800406368b2bcd15daebcbfe8a4a963df4e49550
import subprocess from django.db.backends.base.client import BaseDatabaseClient class DatabaseClient(BaseDatabaseClient): executable_name = 'mysql' @classmethod def settings_to_cmd_args(cls, settings_dict, parameters): args = [cls.executable_name] db = settings_dict['OPTIONS'].get('db', ...
da21f8528f4a254689b35d99216117407797666c64a73908bd8fb1fdd1893996
import subprocess import sys from django.db.backends.base.creation import BaseDatabaseCreation from .client import DatabaseClient class DatabaseCreation(BaseDatabaseCreation): def sql_table_creation_suffix(self): suffix = [] test_settings = self.connection.settings_dict['TEST'] if test_...
f94d538998a74bd5fdadc8b929b835e77f7e7dff749bea9f80d20b896be85bdf
import operator from django.db import InterfaceError from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property class DatabaseFeatures(BaseDatabaseFeatures): allows_group_by_selected_pks = True can_return_columns_from_insert = True can_return_row...
f9c32ecf00429bd3fdf97ef071a5abe54904c632850512dcce0ca082eae52ab8
from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo, TableInfo, ) from django.db.models import Index class DatabaseIntrospection(BaseDatabaseIntrospection): # Maps type codes to Django Field types. data_types_reverse = { 16: 'BooleanField', 17: 'BinaryF...
b8dc5d2853541c1c241b29bb4b5c9b53ceee2c531d18b07b5904c6f504fa375c
""" PostgreSQL database backend for Django. Requires psycopg 2: https://www.psycopg.org/ """ import asyncio import threading import warnings from contextlib import contextmanager from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import DatabaseError as WrappedDat...
f02b3f493e82f648aead9c4bee309aaf9bcb8c062cc4f26b0a53eb455e218909
from psycopg2.extras import Inet from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations class DatabaseOperations(BaseDatabaseOperations): cast_char_field_without_max_length = 'varchar' explain_prefix = 'EXPLAIN' cast_data_types = { 'AutoField': 'int...
1f087384a7cda45955f1c1cd7b5ed2143655a59b86568949bd18fca37be8ab28
import os import signal import subprocess from django.db.backends.base.client import BaseDatabaseClient class DatabaseClient(BaseDatabaseClient): executable_name = 'psql' @classmethod def runshell_db(cls, conn_params, parameters): args = [cls.executable_name] host = conn_params.get('hos...
62dcd3a8a075e34eb16612643dde1ab8a4684e9c7263be19bc3221c15198196f
import sys from psycopg2 import errorcodes from django.db.backends.base.creation import BaseDatabaseCreation from django.db.backends.utils import strip_quotes class DatabaseCreation(BaseDatabaseCreation): def _quote_name(self, name): return self.connection.ops.quote_name(name) def _get_database_cr...
457c981084ba01e048195a9cf500a5f37d3b26ae4861d31315a7ba80a8e42306
import operator from django.db import transaction from django.db.backends.base.features import BaseDatabaseFeatures from django.db.utils import OperationalError from django.utils.functional import cached_property from .base import Database class DatabaseFeatures(BaseDatabaseFeatures): # SQLite can read from a c...
892da0c46406051fd2214b1b6993f0fa4c7c349141182ba9db0356eb5dc9d7e0
import re from collections import namedtuple import sqlparse from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) from django.db.models import Index from django.utils.regex_helper import _lazy_re_compile FieldInfo = namedtuple('FieldInfo', BaseFi...
bb6be84c619bd443bdd82e8cda80ea0e8b3c7cb5d1d244a94b5609bca6ad7859
""" SQLite backend for the sqlite3 module in the standard library. """ import datetime import decimal import functools import hashlib import json 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.exce...
b59a391fbce56e7d0f3b9351ad900215c16e2aa21a8baf7593054f37d57881f2
import datetime import decimal import uuid from functools import lru_cache from itertools import chain from django.conf import settings from django.core.exceptions import FieldError from django.db import DatabaseError, NotSupportedError, models from django.db.backends.base.operations import BaseDatabaseOperations from...
b0afd37a5b3ba6973495d2fb3fb39a1540053886ebdde41a6c6c5c6d4ee8c7f4
import copy from decimal import Decimal from django.apps.registry import Apps from django.db import NotSupportedError from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.ddl_references import Statement from django.db.backends.utils import strip_quotes from django.db.models impor...
e76d1bb2b6bab9db5c8f3e85024b069dfe68082b544b517c341482af70b98cd7
import subprocess from django.db.backends.base.client import BaseDatabaseClient class DatabaseClient(BaseDatabaseClient): executable_name = 'sqlite3' def runshell(self, parameters): # TODO: Remove str() when dropping support for PY37. # args parameter accepts path-like objects on Windows sin...
7faa406b1d80e6177b761016097ba1bbe5cb35b22d74cddf5dd666a310d956ec
from itertools import chain from django.utils.itercompat import is_iterable class Tags: """ Built-in tags for internal checks. """ admin = 'admin' async_support = 'async_support' caches = 'caches' compatibility = 'compatibility' database = 'database' models = 'models' security...
04f9d2b581d87e106f48838d1b120a3f65e3fb4d678857270a3b5518bd0f1b60
from .messages import ( CRITICAL, DEBUG, ERROR, INFO, WARNING, CheckMessage, Critical, Debug, Error, Info, Warning, ) from .registry import Tags, register, run_checks, tag_exists # Import these to force registration of checks import django.core.checks.async_checks # NOQA isort:skip import django.core.checks.c...
b018fef28e039a91b940fcb5297817b59d056744fdc5d953e1704873bd309844
from django.db import connections from . import Tags, register @register(Tags.database) def check_database_backends(databases=None, **kwargs): if databases is None: return [] issues = [] for alias in databases: conn = connections[alias] issues.extend(conn.validation.check(**kwargs...
aed60f6ef0336546c1db739375f26002b3615460ab7a972d07cd8f2da15367d9
import os from . import Error, Tags, register E001 = Error( 'You should not set the DJANGO_ALLOW_ASYNC_UNSAFE environment variable in ' 'deployment. This disables async safety protection.', id='async.E001', ) @register(Tags.async_support, deploy=True) def check_async_unsafe(app_configs, **kwargs): i...
1ef4766527861cf19bf3d33f621741c100e941ef6dcb917152f1a07390908ab3
""" Base classes for writing management commands (named commands which can be executed through ``django-admin`` or ``manage.py``). """ import os import sys from argparse import ArgumentParser, HelpFormatter from io import TextIOBase import django from django.core import checks from django.core.exceptions import Improp...
8d6c8570dd1e0cc1444fe846b0967416974a00d8bf146f9e9f676fc512ff9afc
import cgi import mimetypes import os import posixpath import shutil import stat import tempfile from importlib import import_module from urllib.request import urlretrieve import django from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.core.management.utils ...
79a7c8766edd30fe2e3f0ba3706b4d640e799a70741fd5f80191f853b42a7fe4
from django.apps import apps from django.db import models def sql_flush(style, connection, only_django=False, reset_sequences=True, allow_cascade=False): """ Return a list of the SQL statements used to flush the database. If only_django is True, only include the table names that have associated Djang...
34c72b5e73db8c6d3a0456d283bb9ab804a2192e3854ed0576a04365fdbbb724
""" Sets up the terminal color scheme. """ import functools import os import sys from django.utils import termcolors def supports_color(): """ Return True if the running system's terminal supports color, and False otherwise. """ supported_platform = sys.platform != 'win32' or 'ANSICON' in os.env...
098740283d0632dfbdfbb455d9ed2cdaf299c0fb0f8f0d6fcb2598f1527aba8c
""" Caching framework. This package defines set of cache backends that all conform to a simple API. In a nutshell, a cache is a set of values -- which can be any object that may be pickled -- identified by string keys. For the complete API, see the abstract BaseCache class in django.core.cache.backends.base. Client ...
2d81617a6fa5609228d178385e0ba76df369e944d6ee2ae3580527d1fb16c011
""" Interfaces for serializing Django objects. Usage:: from django.core import serializers json = serializers.serialize("json", some_queryset) objects = list(serializers.deserialize("json", json)) To add your own serializers, use the SERIALIZATION_MODULES setting:: SERIALIZATION_MODULES = { ...
a5e59151bbe3173acc2a5ef0745e60b9cc86ebc7a7f03bccaca29df58faa341f
""" Serialize data to/from JSON """ import datetime import decimal import json import uuid from django.core.serializers.base import DeserializationError from django.core.serializers.python import ( Deserializer as PythonDeserializer, Serializer as PythonSerializer, ) from django.utils.duration import duration_iso...
5f521beb5764302d4abf469836cefa8cd703ca6df84be405934e1db3a7690257
""" YAML serializer. Requires PyYaml (https://pyyaml.org/), but that's checked for in __init__. """ import collections import decimal from io import StringIO import yaml from django.core.serializers.base import DeserializationError from django.core.serializers.python import ( Deserializer as PythonDeserializer,...
4bb4938be778ffeda7a7f8ea8dd659a58b94ff67a7adf3e71824d9bec4ee61da
import logging import sys import tempfile import traceback from asgiref.sync import sync_to_async from django.conf import settings from django.core import signals from django.core.exceptions import RequestAborted, RequestDataTooBig from django.core.handlers import base from django.http import ( FileResponse, Http...
a887e2788c996a97e9211d469ae21a05e8ee23d6ebaeffcfa3749ecc077e8254
from io import BytesIO from django.conf import settings from django.core import signals from django.core.handlers import base from django.http import HttpRequest, QueryDict, parse_cookie from django.urls import set_script_prefix from django.utils.encoding import repercent_broken_unicode from django.utils.functional im...
af94ae12b20349a41e2cc2674db796ce9b099e27d68272ebd3e2211b9d657432
import asyncio import logging import sys from functools import wraps from asgiref.sync import sync_to_async from django.conf import settings from django.core import signals from django.core.exceptions import ( PermissionDenied, RequestDataTooBig, SuspiciousOperation, TooManyFieldsSent, ) from django.http impo...
97f87282c5d645448c4a11273424626a9bf34473512d6b965533d0e45d469a97
import asyncio import logging import types from asgiref.sync import async_to_sync, sync_to_async from django.conf import settings from django.core.exceptions import ImproperlyConfigured, MiddlewareNotUsed from django.core.signals import request_finished from django.db import connections, transaction from django.urls ...
2d2e7da09d02d6f1ac36d55c0281322e06250c80075671cc2dfaa23036ae41f1
""" Tools for sending email. """ from django.conf import settings # Imported for backwards compatibility and for the sake # of a cleaner namespace. These symbols used to be in # django/core/mail.py before the introduction of email # backends and the subsequent reorganization (See #10355) from django.core.mail.message i...
035014899ca50471ab2f015a54fae3828583e770ae59d5815f1c5743c4b6d406
import sys import time from importlib import import_module from django.apps import apps from django.core.management.base import ( BaseCommand, CommandError, no_translations, ) from django.core.management.sql import ( emit_post_migrate_signal, emit_pre_migrate_signal, ) from django.db import DEFAULT_DB_ALIAS, c...
430f8f2d7c9b06e5d23a77353cbbb622dd620d2bf1320e2d7dba596489fe9427
from django.apps import apps from django.core import checks from django.core.checks.registry import registry from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = "Checks the entire Django project for potential problems." requires_system_checks = False def ...
ddd7dc0aa1a7a592967f1f3f30c02ac78eeca0c46a8e1c971df805a5bc9b5e17
from importlib import import_module from django.apps import apps from django.core.management.base import BaseCommand, CommandError from django.core.management.color import no_style from django.core.management.sql import emit_post_migrate_signal, sql_flush from django.db import DEFAULT_DB_ALIAS, connections class Com...
5dd49d32e0e1472b29c135f766da30e4671596539a96aefa5e7089f3e6dd6a26
import warnings from django.apps import apps from django.core import serializers from django.core.management.base import BaseCommand, CommandError from django.core.management.utils import parse_apps_and_model_labels from django.db import DEFAULT_DB_ALIAS, router class ProxyModelWarning(Warning): pass class Com...
75ea755e299279dd563fa7ac499274e2ab6eae73b3bc360a780acabec16d500b
import errno import os import re import socket import sys from datetime import datetime from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.core.servers.basehttp import ( WSGIServer, get_internal_wsgi_application, run, ) from django.utils import autoreload...
4e329f462e5ffe85c926c4d2e5ad33e52f513fe3de6f4d03a9ffee6a225d1478
from django.apps import apps from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections, migrations from django.db.migrations.loader import AmbiguityError, MigrationLoader from django.db.migrations.migration import SwappableTupl...
a6a1cff9f44586730dd800021dd2420a4fcbe97c157277acb2098769fd34909f
import codecs import concurrent.futures import glob import os from django.core.management.base import BaseCommand, CommandError from django.core.management.utils import ( find_command, is_ignored_path, popen_wrapper, ) def has_bom(fn): with open(fn, 'rb') as f: sample = f.read(4) return sample.st...
56d5d42a2d7da4b9cf5d66644830ab9829d229f5007c9650d8c13ea0ce3ae416
import functools import glob import gzip import os import sys import warnings import zipfile from itertools import product from django.apps import apps from django.conf import settings from django.core import serializers from django.core.exceptions import ImproperlyConfigured from django.core.management.base import Ba...
a07fea28c86c11c9de8a6d3226005e347ab8eb1537996716a5e71e2b67289179
from django.conf import settings from django.core.cache import caches from django.core.cache.backends.db import BaseDatabaseCache from django.core.management.base import BaseCommand, CommandError from django.db import ( DEFAULT_DB_ALIAS, DatabaseError, connections, models, router, transaction, ) class Command(Bas...
c1c49f41a9bcdf8828df55b3ec19b3afb67717e879a004f1f1935a7b7c4ea28c
import subprocess from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections class Command(BaseCommand): help = ( "Runs the command-line client for specified database, or the " "default database if none is provided." ) requires_s...
a8150f9c2b2a662bbe2f187ed549f729f4f99150db3621f35e07527698cd64aa
import glob import os import re import sys from functools import total_ordering from itertools import dropwhile import django from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.files.temp import NamedTemporaryFile from django.core.management.base import BaseComman...
892685d773a83b98d2796e262bef1696751a62491bd90d6624eff87513e81cf7
from django.apps import apps from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections from django.db.migrations.loader import AmbiguityError, MigrationLoader class Command(BaseCommand): help = "Prints the SQL statements for the named migration." ou...
fb6264c20337fcfe3f3386490b9eed8ecc2f4985178ab9bde29889633211a69e
import keyword import re from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections from django.db.models.constants import LOOKUP_SEP class Command(BaseCommand): help = "Introspects the database tables in the given database and outputs a Django model mod...
7bd9cc7f7d870ea5b6f339bf8764c43d052e0dd585b3941b86dcdef28c6f6eec
import os import sys from itertools import takewhile from django.apps import apps from django.conf import settings from django.core.management.base import ( BaseCommand, CommandError, no_translations, ) from django.db import DEFAULT_DB_ALIAS, connections, router from django.db.migrations import Migration from djan...
8a1b6c72ce4c9db99ed5d065de95dd0d73437ba0b6581cea00df86bae8a1482c
import inspect from importlib import import_module from inspect import cleandoc from pathlib import Path from django.apps import apps from django.conf import settings from django.contrib import admin from django.contrib.admin.views.decorators import staff_member_required from django.contrib.admindocs import utils from...
927756a4c6c9874a0c01ac4a9e4bfc27b4a1911498e00266c6ab448205020a96
from django.db import NotSupportedError from django.db.models import Index from django.utils.functional import cached_property __all__ = [ 'BloomIndex', 'BrinIndex', 'BTreeIndex', 'GinIndex', 'GistIndex', 'HashIndex', 'SpGistIndex', ] class PostgresIndex(Index): @cached_property def max_name_length(...
f0cb5453adbbf11a2fd6a40bb9b65a9f1dced43293ed184a46b9b86d64ba9dfd
import psycopg2 from django.db.models import ( CharField, Expression, Field, FloatField, Func, Lookup, TextField, Value, ) from django.db.models.expressions import CombinedExpression from django.db.models.functions import Cast, Coalesce class SearchVectorExact(Lookup): lookup_name = 'exact' def process_...
7b040bdb8fb360a3eeda1d308d4f2b26bf5ab280d281ba441257fb6f8a6a6bdd
from psycopg2.extras import ( DateRange, DateTimeRange, DateTimeTZRange, NumericRange, ) from django.apps import AppConfig from django.db import connections from django.db.backends.signals import connection_created from django.db.migrations.writer import MigrationWriter from django.db.models import CharField, Text...
7bb97d063faa51c685a0b97b2fef60b160ce25f80ea272dbf79286e4d7dd3cd0
from django.contrib.postgres.signals import ( get_citext_oids, get_hstore_oids, register_type_handlers, ) from django.db import NotSupportedError, router from django.db.migrations import AddIndex, RemoveIndex from django.db.migrations.operations.base import Operation class CreateExtension(Operation): reversib...
3f35a8a5493187925192a028cc937e45a2ecee0c1a2a15f31e4204ef9c90fa0e
from django.db.models import Transform from django.db.models.lookups import PostgresOperatorLookup from .search import SearchVector, SearchVectorExact, SearchVectorField class DataContains(PostgresOperatorLookup): lookup_name = 'contains' postgres_operator = '@>' class ContainedBy(PostgresOperatorLookup): ...
f40971d33831e4d6e15944d21022678880c88878a511d7f5c0bf8f5d8cfa2605
from django.db.backends.ddl_references import Statement, Table from django.db.models import Deferrable, F, Q from django.db.models.constraints import BaseConstraint from django.db.models.sql import Query __all__ = ['ExclusionConstraint'] class ExclusionConstraint(BaseConstraint): template = 'CONSTRAINT %(name)s ...
6736df24c5426830f5ca9c93e8450f657d108853ee5017d909fff00a701ddad4
import inspect import re from django.apps import apps as django_apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.middleware.csrf import rotate_token from django.utils.crypto import constant_time_compare from django.utils.module_loading import i...
6df3c47cc7753c7f8ae87d5a308cd704359a5910beed89e7a1e17c205e17b2f7
from itertools import chain from types import MethodType from django.apps import apps from django.conf import settings from django.core import checks from .management import _get_builtin_permissions def check_user_model(app_configs=None, **kwargs): if app_configs is None: cls = apps.get_model(settings.A...
de040690c10f1f0193368d9a3982c0cd049f9a7676c135a8db4250e227652f3f
from django.contrib import auth from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.core.mail import send_mail from django.db import models from django.db.models.manager imp...
21a05e5e4ab36ddb853dcb3bf6cf3d7a13d6eef9299ec1ede9e89821b6b67d6b
from datetime import datetime from django.conf import settings from django.utils.crypto import constant_time_compare, salted_hmac from django.utils.http import base36_to_int, int_to_base36 class PasswordResetTokenGenerator: """ Strategy object used to generate and check tokens for the password reset mech...