hash
stringlengths
64
64
content
stringlengths
0
1.51M
a51b484af19b57f15279d3c0f1ce948c4ce9c786eda86d959008c905076e80d4
import warnings from io import StringIO from django.template.base import Lexer, TokenType from django.utils.regex_helper import _lazy_re_compile from . import TranslatorCommentWarning, trim_whitespace TRANSLATOR_COMMENT_MARK = 'Translators' dot_re = _lazy_re_compile(r'\S') def blankout(src, char): """ Cha...
901aa9fa17e226bcd9a4b16176fc7fcf4d1abbbd969b058724a557fd4641f4bb
from pathlib import Path import jinja2 from django.conf import settings from django.template import TemplateDoesNotExist, TemplateSyntaxError from django.utils.functional import cached_property from django.utils.module_loading import import_string from .base import BaseEngine class Jinja2(BaseEngine): app_dir...
e3d4d9275552a924fdec3545d4f1830768fc5b4a95ec70e7ca18cb727256ffa4
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...
94b903119af2cbaa3ed516bf748cc9c343a9196ff41c729d63ff128a9d1315f9
from django.apps.registry import apps as global_apps from django.db import migrations, router from .exceptions import InvalidMigrationPlan from .loader import MigrationLoader from .recorder import MigrationRecorder from .state import ProjectState class MigrationExecutor: """ End-to-end migration execution - ...
a055f90fc990dfcbf9a273beba4a665cc50418dfe4bec61e1d1ce8fcbf7a8972
import copy from collections import defaultdict from contextlib import contextmanager from functools import partial from django.apps import AppConfig from django.apps.registry import Apps, apps as global_apps from django.conf import settings from django.core.exceptions import FieldDoesNotExist from django.db import mo...
796e73262dbccb0d4ab1c743cd4d89af11bdbc4864910d05b019fc8f06658dd7
import pkgutil import sys from importlib import import_module, reload from django.apps import apps from django.conf import settings from django.db.migrations.graph import MigrationGraph from django.db.migrations.recorder import MigrationRecorder from .exceptions import ( AmbiguityError, BadMigrationError, Inconsi...
49b347bb84db713014c57717b81776eaae68adb4f2bb0a14fe007b4f79c52bad
import datetime import importlib import os import sys from django.apps import apps from django.core.management.base import OutputWrapper from django.db.models import NOT_PROVIDED from django.utils import timezone from django.utils.version import get_docs_version from .loader import MigrationLoader class MigrationQu...
334273ebb68f6fc80c7e80b08edcb585616ed5a7c49a91a85045a1a8254998e2
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 ...
eddef60894636ce41464d8e3440d197857a9b5fff114fa3134341593ff7f54a2
import builtins import collections.abc import datetime import decimal import enum import functools import math import os import pathlib 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.mig...
583b39b3766441140194b0c7e8674f0b9730ecd36df74a11ce64c2d23303f394
""" 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.comparison import Coalesce from django.db.models.functions.m...
379072da612377509209dbfd83b519d68b7d41ffd822c0b697435d839debba22
""" The main QuerySet implementation. This provides the public API for the ORM. """ import copy import operator import warnings from itertools import chain, islice import django from django.conf import settings from django.core import exceptions from django.db import ( DJANGO_VERSION_PICKLE_KEY, IntegrityError, N...
fc8aa5fe5f6485f4e3aa080f42ad19862302fba603083a680c92cb99f4cb0f63
import bisect import copy import inspect 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 AutoField, Manager, OrderWrt, UniqueConstr...
5217c5976fa8ee17c8439fbe5a7115538307c73dc7f011f5f754e2783eb336af
import copy import inspect import warnings from functools import partialmethod from itertools import chain import django 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, MultipleObjects...
55597b919c7af3c7a3e9269ed25902f5e8bcaffe0b48c922121658462a120ad8
import functools from collections import namedtuple def make_model_tuple(model): """ Take a model or a string of the form "app_label.ModelName" and return a corresponding ("app_label", "modelname") tuple. If a tuple is passed in, assume it's a valid model tuple already and return it unchanged. """...
f97c6ed500f25b12c6f14146892db7b8953fbddce20402046b3e6e440c9e48c1
""" Constants used across the ORM in general. """ from enum import Enum # Separator used to split filter strings apart. LOOKUP_SEP = '__' class OnConflict(Enum): IGNORE = 'ignore' UPDATE = 'update'
035429fae18709c2a841cf060ed4fa4bd28a3bc26c5a40929ccca6b63c905024
import copy import datetime import functools import inspect from decimal import Decimal from uuid import UUID from django.core.exceptions import EmptyResultSet, FieldError from django.db import DatabaseError, NotSupportedError, connection from django.db.models import fields from django.db.models.constants import LOOKU...
740e4ebc3401153afe0283966bd4557283ca251bbd3ca7c1a887189604359800
from collections import Counter, defaultdict from functools import partial 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): def __init__(self, msg...
0c461f93b54d2d711e9c6fce8c1278b8e3d2cf17a8d9ae3fe7363e5b9c3a1862
import itertools import math from django.core.exceptions import EmptyResultSet from django.db.models.expressions import Case, Expression, Func, Value, When from django.db.models.fields import ( BooleanField, CharField, DateTimeField, Field, IntegerField, UUIDField, ) from django.db.models.query_utils import Regist...
56199aa348c10e8f1fbcee280bd60fd6c279b58b2672b83df3c59c4c0a9b58ca
""" Helpers to manipulate deferred DDL statements that might need to be adjusted or discarded within when executing a migration. """ from copy import deepcopy class Reference: """Base class that defines the reference interface.""" def references_table(self, table): """ Return whether or not t...
c3885f6beae9670a800fde9a6940cd889f22d80628e32b1b63a784c63b8727b7
import datetime import decimal import functools import logging import time from contextlib import contextmanager from django.db import NotSupportedError from django.utils.crypto import md5 from django.utils.dateparse import parse_time logger = logging.getLogger('django.db.backends') class CursorWrapper: def __i...
f1c69e047761188cebed0ebeaa7484c032c951c2294f661f39ea784c71cbbceb
from django.db import models from django.db.migrations.operations.base import Operation from django.db.migrations.state import ModelState from django.db.migrations.utils import field_references, resolve_relation from django.db.models.options import normalize_together from django.utils.functional import cached_property ...
54cd33fccde4e61666c6b01feb83b06f59a4515a7b6c4a10a5df4fa7dd6a481e
from django.db.migrations.utils import field_references from django.db.models import NOT_PROVIDED from django.utils.functional import cached_property from .base import Operation class FieldOperation(Operation): def __init__(self, model_name, name, field=None): self.model_name = model_name self.na...
14435641b15cf2e2872957f0fd76b0266f0bd46d3c77608e335ddb0bf3498d52
from django.db.models.lookups import ( Exact, GreaterThan, GreaterThanOrEqual, In, IsNull, LessThan, LessThanOrEqual, ) class MultiColSource: contains_aggregate = False def __init__(self, alias, targets, sources, field): self.targets, self.sources, self.field, self.alias = targets, sources, f...
db106dbf5f222248c44885c58d2145838055dbcd1a6e202721769f870c252ecc
import collections.abc import copy import datetime import decimal import math 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 i...
da7113308f6eea83d75d30c4cd5e10a231e135c70eee8817e468aa93cf04e800
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...
cdd584883b9002f5087e5b8acc54a57ed4f6415f463d7c8410f33f1078fe71c3
""" 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...
1b8271089954e7b17027babaff137dcd4d179cf5f78d891e72e9bc0fe0ba453b
""" "Rel objects" for related fields. "Rel objects" (for lack of a better name) carry information about the relation modeled by a related field and provide some utility functions. They're stored in the ``remote_field`` attribute of the field. They also act as reverse fields for the purposes of the Meta API because th...
a901a4db9d5853ea8e0f028e00945e1605d119ae24ea5ccfce4451ac9950d88c
"""Database functions that do comparisons or type conversions.""" from django.db import NotSupportedError from django.db.models.expressions import Func, Value from django.db.models.fields.json import JSONField from django.utils.regex_helper import _lazy_re_compile class Cast(Func): """Coerce an expression to a ne...
8b8e019f527c539c0cfa28fb9699f3992b62febe87858a6d383f810abec1cce3
from datetime import datetime from django.conf import settings from django.db.models.expressions import Func from django.db.models.fields import ( DateField, DateTimeField, DurationField, Field, IntegerField, TimeField, ) from django.db.models.lookups import ( Transform, YearExact, YearGt, YearGte, YearLt, Yea...
6dc6d9dfc9a6ad65b28cf6ac435c7c5f281d0644c91b5cf32ec1ea18e3496c71
""" 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 ...
c29b0b1d81289f2b467f9dc08399a20a8fb97ea9dd9287b0c5f5a37857a36963
import collections import json 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 F, OrderBy, ...
b8c7dd2d81b8d144aa931a99eb7fce8f34cb1fe1845c6a3dba938ff38a1d5f41
""" Code to manage the creation and SQL rendering of 'where' constraints. """ from django.core.exceptions import EmptyResultSet from django.utils import tree from django.utils.functional import cached_property # Connection types AND = 'AND' OR = 'OR' class WhereNode(tree.Node): """ An SQL WHERE clause. ...
f4855f322f7baa241ea5a9df05c6cfcfbb629216e8277e151502219d4f809ac1
""" Query subclasses which provide extra functionality beyond simple data retrieval. """ from django.core.exceptions import FieldError from django.db.models.sql.constants import ( CURSOR, GET_ITERATOR_CHUNK_SIZE, NO_RESULTS, ) from django.db.models.sql.query import Query __all__ = ['DeleteQuery', 'UpdateQuery', '...
e214e8ac2f90607efbfbdad7e64a89075974279b1ac00f599ffdd5a43a00d837
from django.db import DatabaseError, InterfaceError from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property class DatabaseFeatures(BaseDatabaseFeatures): # Oracle crashes with "ORA-00932: inconsistent datatypes: expected - got # BLOB" when grouping...
01c2fcadf1160c391a19e106a6b44aec5e4f0a145ed69c63a80a70c84ef71bca
from collections import namedtuple import cx_Oracle from django.db import models from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) from django.utils.functional import cached_property FieldInfo = namedtuple('FieldInfo', BaseFieldInfo._fields + ...
1bac3fca285d88c6ae74a7c6f0b1e7f0938d5cfa3dbc3bcd6aa9f4f70614ae3e
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 ( split_tzname_delta, strip_quotes, truncate_name, ) from dj...
523d31207cace63567bd02d91139f3efc57eaca0e758d7fc0a077e142caa7f54
import copy import datetime import re from django.db import DatabaseError from django.db.backends.base.schema import ( BaseDatabaseSchemaEditor, _related_non_m2m_objects, ) from django.utils.duration import duration_iso_string class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_column = "ALTER ...
10b2af0475172d50932f4723d61294c0bd9a15a94f8e69932ab718b4f62e667a
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, ...
526a800e778b5707559d354e24de2a24b2293b8dc1e498cef9f361e7b6953e90
from django.db import ProgrammingError from django.utils.functional import cached_property class BaseDatabaseFeatures: gis_enabled = False # Oracle can't group by LOB (large object) data types. allows_group_by_lob = True allows_group_by_pk = False allows_group_by_selected_pks = False empty_fet...
4c9614343fa7a86f8c7693c19af1ce4cc6a183aad62f8ab0f3a8413744367f88
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 prec...
09063a72cf877d53d586019412fc7e17bdcd95e4197b65cf108273037fe344d2
import _thread import copy import threading import time import warnings from collections import deque from contextlib import contextmanager try: import zoneinfo except ImportError: from backports import zoneinfo from django.conf import settings from django.core.exceptions import ImproperlyConfigured from djan...
0e969aae4a7d5bb9277d44364c77103558bd89479af49740af572ac72181ecd0
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: ...
8c23310998a90b1986e9c962dc967c211e46a36ec01e4c4e3eaba6576c6e6b74
import logging from datetime import datetime from django.db.backends.ddl_references import ( Columns, Expressions, ForeignKeyName, IndexName, Statement, Table, ) from django.db.backends.utils import names_digest, split_identifier from django.db.models import Deferrable, Index from django.db.models.sql import Query...
bbcaeb798b48a39b62837cb8cb150892c8b4929fde03aa40b10e378fc4b57b46
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 from django.utils.module_loading import import_string # The prefix to put on the default database name wh...
3540d716bb06583551c03195e048dcabfd139af44068dd5e359c3a3e28121416
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...
e26deb61e3c364886d36be3be64ec0c1afdbeb0f83d7492668378218b7bbb705
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...
acd2f9229e97155cd54f9ff573540e62d67f0b7c1ac9d646dd84a797534c29a7
""" 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...
b73544cfdb59cd9d4e174a1c145faa620265f6c934751fd91f2009737c691abc
import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.db.backends.utils import split_tzname_delta from django.db.models import Exists, ExpressionWrapper, Lookup from django.db.models.constants import OnConflict from django.utils import timezone f...
a299f1c5427dd6dbe1a4e9fc596aa9033d8ff97cea508b1422e7603e48845ce4
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_...
e676049ebd0f40626352935c4c14e9a5239d5141ad067f6a61c708ee9badff9e
""" Dummy database backend for Django. Django uses this if the database ENGINE setting is empty (None or empty string). Each of these API functions, except connection.close(), raise ImproperlyConfigured. """ from django.core.exceptions import ImproperlyConfigured from django.db.backends.base.base import BaseDatabase...
41a5bf67f8879bec17b9699d37f829c83be0e3c03a38b3651730d521f4e80fbe
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...
ce7a85c424240418585ba12b7167689ef7e2fc04d4e94eb91a941dd065884073
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...
4df0d9ffb05af91678b66bcf8d1edb592b72669ab0b4d1005068158f367b9f48
""" 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...
e8e8a0b3339a7b20ac49cf29f07b0c276261f6517b52da7e9981045865dfe014
from psycopg2.extras import Inet from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.db.backends.utils import split_tzname_delta from django.db.models.constants import OnConflict class DatabaseOperations(BaseDatabaseOperations): cast_char_field_witho...
a11dbdb959e6b5eaab88ed3949749cdb2c310fef8f3e726b933c82363eea2c5f
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): test_db_allows_multiple_co...
0445a97c256d575ca80de7548937e1a2231886aa6cfc55c0c770a4016e897de2
from collections import namedtuple import sqlparse from django.db import DatabaseError 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 = name...
b73bc1e9c90d56025c7dd416c20405bbb48b7d9147dd421cdaef5e4d263c247b
""" SQLite backend for the sqlite3 module in the standard library. """ import decimal import warnings from itertools import chain from sqlite3 import dbapi2 as Database from django.core.exceptions import ImproperlyConfigured from django.db import IntegrityError from django.db.backends.base.base import BaseDatabaseWrap...
5e09a72472278a98361c0823b26aee54495e059b26029fc3aac5e62a9d60cd50
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...
70e0ea0441005cf5b4615ea636d6bc071b67855745098ad0183ba45190f9bf97
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...
4796d82ed63ffdd34f3f83bfbab7213eb809563a7bc80bedd1c2aea1d6a68982
""" Implementations of SQL functions for SQLite. """ import functools import random import statistics from datetime import timedelta from hashlib import sha1, sha224, sha256, sha384, sha512 from math import ( acos, asin, atan, atan2, ceil, cos, degrees, exp, floor, fmod, log, pi, radians, sin, sqrt, tan, ) from...
d10064d63b76983bfeeb0ba0bce6e04a32d57be68c7de8eaba5b722cf45c7006
""" Utility functions for handling images. Requires Pillow as you might imagine. """ import struct import zlib 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. """ @pro...
a85a4ef25d9e5baf385cf93c70d4607192e11cc3fc09a012ab5520497e091c43
import os import pathlib from datetime import datetime from urllib.parse import urljoin from django.conf import settings from django.core.exceptions import SuspiciousFileOperation from django.core.files import File, locks from django.core.files.move import file_move_safe from django.core.files.utils import validate_fi...
9004d7e7823e07ec6cd318b4f1eb6a28d76447daf89ab0ae0480efcfb5de8602
""" Portable file locking utilities. Based partially on an example by Jonathan Feignberg in the Python Cookbook [1] (licensed under the Python Software License) and a ctypes port by Anatoly Techtonik for Roundup [2] (license [3]). [1] https://code.activestate.com/recipes/65203/ [2] https://sourceforge.net/p/roundup/c...
5da6f12bd5b1a4980892649d4e372c9eabb474604190c39b6bf1cb658fd57d2d
import copy from collections import defaultdict from django.conf import settings from django.template.backends.django import get_template_tag_modules from . import Error, Tags, register E001 = Error( "You have 'APP_DIRS': True in your TEMPLATES but also specify 'loaders' " "in OPTIONS. Either remove APP_DIRS...
c87a5c0ba25d0fa237968dd0dfd3dc8106ae9d6e6d451e938f7055b067501f67
import functools import os import pkgutil import sys from argparse import ( _AppendConstAction, _CountAction, _StoreConstAction, _SubParsersAction, ) from collections import defaultdict from difflib import get_close_matches from importlib import import_module import django from django.apps import apps from django....
f03314d11e474df183bf5ec8d8ae5c415704e7002628e27e8184f6dfef44b47e
""" Base classes for writing management commands (named commands which can be executed through ``django-admin`` or ``manage.py``). """ import argparse import os import sys from argparse import ArgumentParser, HelpFormatter from io import TextIOBase import django from django.core import checks from django.core.exceptio...
7ff76883682e9331f392cb92b17bf9d2278031b6a3de59658b2f065de3aeb82d
import fnmatch import os from pathlib import Path from subprocess import run from django.apps import apps as installed_apps from django.utils.crypto import get_random_string from django.utils.encoding import DEFAULT_LOCALE_ENCODING from .base import CommandError, CommandParser def popen_wrapper(args, stdout_encodin...
4848bf8d6d412be13e9bb2d4148811abf0cd9614c0b31fdd0b9f464bd46ab12d
import argparse import cgi import mimetypes import os import posixpath import shutil import stat import tempfile from importlib import import_module from urllib.request import build_opener import django from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.core....
5adf6cfe23d8fdc76214df1fc74964e204daa2005fd9fd0bfa52fafc531df0bf
from django.utils.crypto import md5 TEMPLATE_FRAGMENT_KEY_TEMPLATE = 'template.cache.%s.%s' def make_template_fragment_key(fragment_name, vary_on=None): hasher = md5(usedforsecurity=False) if vary_on is not None: for arg in vary_on: hasher.update(str(arg).encode()) hasher.upda...
557b99859bf553a53ead971ab4996bba34e8ff5a599869018e045895dafd0833
""" Module for abstract serializer/unserializer base classes. """ import pickle import warnings from io import StringIO from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.utils.deprecation import RemovedInDjango50Warning DEFER_FIELD = object() class PickleSerializer: ...
d58cfcf8b39b0d0f6b09bb913864bc2cb24d2e028663441cf69c96363efe0107
import logging import sys import tempfile import traceback from asgiref.sync import ThreadSensitiveContext, 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 ...
cfb771227664a69e4476e89be2ccb86b77ba123d8d1a1c320e9890cbd1f82597
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...
6a6bb38ed814349575ef0041e52fca630bbb6da22ef1e2ff14d3ee010451350e
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 ( BadRequest, PermissionDenied, RequestDataTooBig, SuspiciousOperation, TooManyFieldsSent, ) from djan...
d7c40b6b2ade98c93837996de0e2c8f13f98e6af36c93724b262a803af137ca7
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...
7e3e471cfd39186620a47124ee8e54fcd59b9387f008f5bd9c6da83e2d8bffc9
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...
5597cb62f79e797d2f58ee62156a293ffe53acd669cbed2c8ff0c3979e4cebaf
import os 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 Sw...
504068a178ba8855e5fe5dd6997a6b59f8238f9df0aee36e3ea8432e3f5eeaae
import sys from django.conf import settings from django.core.management.base import BaseCommand from django.core.management.utils import get_command_line_option from django.test.runner import get_max_test_processes from django.test.utils import NullTimeKeeper, TimeKeeper, get_runner class Command(BaseCommand): h...
b0d55e0c1990d6a8bdf2e0701c78dbebb08cfa9412d2de5f168741dc7deee565
import glob import os import re import sys from functools import total_ordering from itertools import dropwhile from pathlib import Path import django from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.files.temp import NamedTemporaryFile from django.core.manageme...
7c2859df2784edbf06fd0e3780dbe441d2172b138fccfd23d5f6b1d5dc03047e
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...
4c12ba2e88279a83af8c55db6ddb7c85c5f19d95f67c0689a2de801d566340bd
import os import sys import warnings 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, OperationalError, connections, router from django.db.mig...
181025f572892699dd3b4cf7f034153af81f5693203983672526da1654ed4c6d
import os import select import sys import traceback from django.core.management import BaseCommand, CommandError from django.utils.datastructures import OrderedSet class Command(BaseCommand): help = ( "Runs a Python interactive interpreter. Tries to use IPython or " "bpython, if one of them is av...
cc5b96b06fbb3db8d60c2bb929321f9b7fc4ddf1482140960027ac74b4282982
"File-based cache backend" import glob import os import pickle import random import tempfile import time import zlib from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.core.files import locks from django.core.files.move import file_move_safe from django.utils.crypto import md5 class F...
a3812eed37283a426bc5dfd15ef14fd5942ea839bc4a54dc0cdbe78137c2a06f
"Memcached cache backend" import re import time from django.core.cache.backends.base import ( DEFAULT_TIMEOUT, BaseCache, InvalidCacheKey, memcache_key_warnings, ) from django.utils.functional import cached_property class BaseMemcachedCache(BaseCache): def __init__(self, server, params, library, value_not_f...
7a68b0a7b7160032a9bfc2072c3d953444346c2a221902486530ec775dfe95cb
"Database cache backend." import base64 import pickle from datetime import datetime from django.conf import settings from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.db import DatabaseError, connections, models, router, transaction from django.utils import timezone class Options: ...
610652b0476df3ed775a7ee3d5c57c8547dc1ff0b49bc0a21726089d4200d68b
"""Redis cache backend.""" import pickle import random import re from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.utils.functional import cached_property from django.utils.module_loading import import_string class RedisSerializer: def __init__(self, protocol=None): self...
0eeb6ebe93856a89a510c6ca676e3005df91d9ee01af5441172b5a7241dda1e6
"Base Cache class." import time import warnings from asgiref.sync import sync_to_async from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import import_string class InvalidCacheBackendError(ImproperlyConfigured): pass class CacheKeyWarning(RuntimeWarning): pass clas...
7d06c588bef60e754a3fd514e160ec6586b160ac7b16530e261b4ff1a932da27
"Dummy cache backend" from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache class DummyCache(BaseCache): def __init__(self, host, *args, **kwargs): super().__init__(*args, **kwargs) def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): self.make_and_validate_key(...
72a74580fc58adf10a0ef291d88622155efe33084cd022073f12d307124c0d34
"Thread-safe in-memory cache backend." import pickle import time from collections import OrderedDict from threading import Lock from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache # Global in-memory store of cache data. Keyed by name, to provide # multiple named local memory caches. _caches = {} _e...
5e6c2524544033b0050d1d396a329c8510681d6b3763179956e1f33251a8ae15
import warnings from urllib.parse import urlencode from urllib.request import urlopen from django.apps import apps as django_apps from django.conf import settings from django.core import paginator from django.core.exceptions import ImproperlyConfigured from django.urls import NoReverseMatch, reverse from django.utils ...
541b9ffc550e0a3d50c61ce3381625595ae2a3a6ac5a42a030f1b37abdbf329c
import datetime import warnings from dataclasses import dataclass from functools import wraps from django.contrib.sites.shortcuts import get_current_site from django.core.paginator import EmptyPage, PageNotAnInteger from django.http import Http404 from django.template.response import TemplateResponse from django.urls ...
4a26952588edc6fc0baec40849e39e7ff8df267dda3945d9922a98625867a9ea
from django.apps import AppConfig from django.contrib.messages.storage import base from django.contrib.messages.utils import get_level_tags from django.core.signals import setting_changed from django.utils.translation import gettext_lazy as _ def update_level_tags(setting, **kwargs): if setting == 'MESSAGE_TAGS':...
b17c18874abcdd6db1913e0be5544cfbd7eac6a0bae550e40a7d0fcefb86e295
"Misc. utility functions/classes for admin documentation generator." import re from email.errors import HeaderParseError from email.parser import HeaderParser from inspect import cleandoc from django.urls import reverse from django.utils.regex_helper import _lazy_re_compile from django.utils.safestring import mark_sa...
adba73fedc9ffc89b1444eb0bf1bd4841b45d7ae31efaa15db41c4084421123c
import inspect from importlib import import_module from inspect import cleandoc from pathlib import Path from django.apps import apps from django.contrib import admin from django.contrib.admin.views.decorators import staff_member_required from django.contrib.admindocs import utils from django.contrib.admindocs.utils i...
45a07f9e934d6ac2b0c49757533c8cb5201eb929549a6ff93ac8eda5134ab413
from django.db import NotSupportedError from django.db.models import Func, Index from django.utils.functional import cached_property __all__ = [ 'BloomIndex', 'BrinIndex', 'BTreeIndex', 'GinIndex', 'GistIndex', 'HashIndex', 'SpGistIndex', ] class PostgresIndex(Index): @cached_property def max_name_l...
ff63ec975c0ca6391bdc01b99e5bb0e6c712e7a8793a1dd8ab092f7c8bb2db16
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_...
0a21f9c084c8251dd7227fd5a4afa70b02c9d58acc7717ed0b125bcad5b8e740
from psycopg2.extras import ( DateRange, DateTimeRange, DateTimeTZRange, NumericRange, ) from django.apps import AppConfig from django.core.signals import setting_changed from django.db import connections from django.db.backends.signals import connection_created from django.db.migrations.writer import MigrationWri...
92477322fbe184b7707379da74497083ae204f2bf9704d036110a260f65085d1
import functools import psycopg2 from psycopg2 import ProgrammingError from psycopg2.extras import register_hstore from django.db import connections from django.db.backends.base.base import NO_DB_ALIAS @functools.lru_cache def get_hstore_oids(connection_alias): """Return hstore and hstore array OIDs.""" wit...
6823a5d74a73d56b11c1e9dd6dc1d9064707f12910841bc68f0068af506b2120
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): ...
bd71858ad9d426d6ed0288eddb9ffc367d181e2615434560c9d142592a4aef88
import warnings from django.contrib.postgres.indexes import OpClass from django.db import NotSupportedError from django.db.backends.ddl_references import Expressions, Statement, Table from django.db.models import Deferrable, F, Q from django.db.models.constraints import BaseConstraint from django.db.models.expressions...
3997190954903d5b5f7bc8237a174c1c67c4af4d11275bfada54269a04e1f141
from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.db.models import Exists, OuterRef, Q UserModel = get_user_model() class BaseBackend: def authenticate(self, request, **kwargs): return None def get_user(self, user_id): return None ...