hash
stringlengths
64
64
content
stringlengths
0
1.51M
531a3a7e0ac0aa85b67227bfc8f2acc947b4e9b688d2f500945801ad4cdb3606
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...
d146814c2736e39c8e30b3823a44d907f8a1763fef092193eff4609785d4a5ab
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 ...
09d91b158e01adec5d2f662af4cb4bdc177d2bdc4852f0d93b273d8eec50c724
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...
c80ba94b54aa0987fdd1aca4451b1c1266148d2b48d83ceb5c33ec8048d478d7
""" 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...
2714de1883eec52843ee5cd6e7a3aedfe33e586ecee1ada2cdc07192dd9a5832
""" "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...
de932908931a75ccb3555664a4263e78954a8619d8c81fc0606689015508a600
from .comparison import Cast, Coalesce, Collate, Greatest, Least, NullIf from .datetime import ( Extract, ExtractDay, ExtractHour, ExtractIsoWeekDay, ExtractIsoYear, ExtractMinute, ExtractMonth, ExtractQuarter, ExtractSecond, ExtractWeek, ExtractWeekDay, ExtractYear, Now, Trunc, TruncDate, TruncDay, TruncHo...
9890c35185ef06d890f5692b691e6fbf765d38733594ea9cf1ba8f87b3e5a1d7
import math from django.db.models.expressions import Func from django.db.models.fields import FloatField, IntegerField from django.db.models.functions import Cast from django.db.models.functions.mixins import ( FixDecimalInputMixin, NumericOutputFieldMixin, ) from django.db.models.lookups import Transform class ...
e3847e5247e96d58a053faf6c65eb7a8d58ff069637fb07d9fc38523a2ed5879
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...
713948ed489920a76686e558cb4930a28b1794cc13641b3cc1abc58fb75cae4e
""" 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 ...
51c90382063a46165ca0c3df16fad2f8b43500a8361c5929e77e5208532b1773
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 F, OrderBy, RawSQL, Ref,...
b447985e2b75f168421e25ee825039e06d7c745e32e23b4ef1897c6b7b947cea
""" 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. ...
87c3dcde68d299be718f7f98a617ddd46156d6294f8e044c03db1ef4b09b66e2
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...
aa1da3728a1130cf035b68a7c16faa8598ac81f98123503abd5e94db0555492c
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 + ...
30028ebd67dff9d56db8dbc93b881bdd7d1a476b335fc4d3bf0731de437b30fe
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...
5e7bab4e9dce3e611193c069134e885125bbeb8b85c520430822dd386b3f24ca
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...
1f7e5c6df3251137b81e049e5a96715e2d8cf977e0b43536a9567d2bce1a486d
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...
faad0b47d20732b4ab2244fa970a8e48430fa2a8e3f6e3334227250d77e8efa3
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...
66d6700322015c83526083d97fea408488a896068bf5f999220fcfb8a9825a84
import _thread import copy import threading import time import warnings from collections import deque from contextlib import contextmanager 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...
379089e3fbb50bedd41bc7db71b7fd709cdb16f69a359b948f645048c062eba6
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: ...
e96fdc59757d0bdf2f9bd5d10050fdfdc406ccea47d595833dda494bbcf6223f
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...
444310c6fcdc27f0e698491037d85759ca7493afb138d5e3af7d366b2f3f1596
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 ...
c35fa275b2ae4d334a163ace7ccc15664b927102e773709bbf67b29c527bc7f2
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...
1284541b3db7dff83fd79da681670cee735d75777590e0507e60c1b4f3f144e3
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...
d6066ba0242fa52fd3c5b81cb06405f2ab67e03bb37a53a1e4999fd0deacc6eb
from django.core.exceptions import FieldError from django.db.models.sql import compiler class SQLCompiler(compiler.SQLCompiler): def as_subquery_condition(self, alias, columns, compiler): qn = compiler.quote_name_unless_alias qn2 = self.connection.ops.quote_name sql, params = self.as_sql()...
2cedb284ab3d2061fe450127cde2bcf3b3de149fec15fd54bdbd65596104c67d
import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.utils import timezone from django.utils.encoding import force_str class DatabaseOperations(BaseDatabaseOperations): compiler_module = "django.db.backends.mysql.compiler" # MySQL sto...
5c417b7cd32cc268928620e28ac84f568179899a1ec23bcfb9311c5b4bead1b3
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_...
ed012eb4a508771e293ccc5a0733e3568cc0bb79a0f7bd0834935246fe10f2cc
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', ...
61d7f7564acea649360dfbe23a85ac888a31e496e8e66d93b2a555b5d191016e
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...
905b5b0f64751782bccc793ec1f35c0b2666fd5400e987d54de4f20b14f64d32
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...
c4fb01d486d3d1a1dba946ee67ba2d576528216dfa89278a841f8c9fd036f4a0
""" 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...
677a8b49722ee71003e4244ed01568637dd74a63c7e6c25f7dff5696c450b4c8
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...
d865f784a825bd5866f68522f946f2e35c8df7cba238ddff07c53ce200b426cd
import psycopg2 from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.ddl_references import IndexColumns from django.db.backends.utils import strip_quotes class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_sequence = "CREATE SEQUENCE %(sequence)s" sql_dele...
bc302779afadbf8cd427de1f6837a820af26574129679fb5aed09963fb5874a4
import operator import platform 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 c...
c2d42d7e99478b4496cb69305ef0812d8776f886b135fb13523044b8e14b7442
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...
27a1237e35bce592b88871781808d068b9f284894e405ffc60305f243e781d53
""" SQLite backend for the sqlite3 module in the standard library. """ import datetime import decimal import functools import hashlib import math import operator import random import re import statistics import warnings from itertools import chain from sqlite3 import dbapi2 as Database import pytz from django.core.ex...
b33553e99818d6ff8ff9f6ac8a4948f8e03aacb700f0b2627530956a09e2ef30
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...
ec0fe805d83bba315f69d1e965cf78125127814ee0f19f7524d825382785a791
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...
47a13283b2b61fea0e69eafe3a315258057b1ffe19d2345b2ba50017be7da776
""" Base file upload handler classes, and the built-in concrete subclasses """ import os from io import BytesIO from django.conf import settings from django.core.files.uploadedfile import ( InMemoryUploadedFile, TemporaryUploadedFile, ) from django.utils.module_loading import import_string __all__ = [ 'Upload...
1a22bea151b34987ca5c022c9186ac67681eb1f541ff28883759c341b8103508
import os 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.signals import setting_changed from django.ut...
a4eb00ae4b114ef935c27f129b576b89b14a9af72c65971f73a7b0e30732b974
""" 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] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203 [2] https://sourcefor...
56c547a0c3febc2fc23480b165f49dc0e785eba2fed7393c33e0628d8cfedef6
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....
96b522121763e730b78e1f7b191df1fe035255f58f1664066132e4dee4fd1975
""" Base classes for writing management commands (named commands which can be executed through ``django-admin`` or ``manage.py``). """ import os import sys import warnings from argparse import ArgumentParser, HelpFormatter from io import TextIOBase import django from django.core import checks from django.core.exceptio...
749cda68e3faef03dec4a8e87e2a87ebcfec5156815bfb89a578b4276e819023
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...
0634bb509da6f6d7731c05c473883fc766204cc57d9e962b6dd8f0e63c84edad
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 ...
aee42b103177a2086629a3252cf248b24c7ac8fbd05c8f721be3cb83f497524d
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...
fb38b73693ab9188e81c63662905c44daf300e259fc96a96377af64a10f98ca1
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.utils import NullTimeKeeper, TimeKeeper, get_runner class Command(BaseCommand): help = 'Discover and run tests in the specified modules...
baf639040961a84b6160e481b6192fa88d494a90167183cd7e501f8d6d3b1455
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...
e83a8e8ac4d273213417fab9c4be8f99c20aa918821117b334e90b9d43e9341a
"File-based cache backend" import glob import hashlib 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 class FileBasedCache(BaseCac...
c729882244871b10e5a96c59c7da926356ac5366e661245f43ec3219767823f8
"Memcached cache backend" import pickle 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, librar...
04ddc01b973903deead2718040a79a18d781fb179b455d5fe3430a3119661318
"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...
996d4a42ef4403ec22c61e23734d6d076ec99ae8862d33b4386eec666336fa7b
import datetime from calendar import timegm 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 import reverse from dj...
51af9af1896caf8ed153c0569ee1ec3b367783466719d7fa6e3dc7f71011effe
from django.conf import settings from django.http import HttpResponse from django.utils.deprecation import MiddlewareMixin from .utils import get_view_name class XViewMiddleware(MiddlewareMixin): """ Add an X-View header to internal HEAD requests. """ def process_view(self, request, view_func, view_a...
36dfa9aebb67b653751921937bacf3e26f98e49f40478cac9f41ea6897acd0c0
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...
31e1b57336078adae776db80d813db2a892f18a154e6cdef8a46a8043d58f79a
from django.db import NotSupportedError 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(BaseConstrain...
aa3ac32645ce53c689668b31f5a20972b02490a089ae1cbd9175cb7915080490
from calendar import timegm from django.contrib.sites.shortcuts import get_current_site from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from django.http import Http404, HttpResponse from django.template import TemplateDoesNotExist, loader from django.utils import feedgenerator from django.u...
b6afff7af687f7c81288ea2366407db723f1a4165bd5859a57d2a2e71bdf49eb
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...
d725905da0c92ba3ca6c16fcf9ea921f3adea348ce7dc1ad95b6c576be1bc4d8
from datetime import datetime, time 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 rese...
8eb9c986a9938b33b422fcaa20e61b2ff092aaa0117316851f9102dfa37835bc
import json from django import forms from django.contrib.admin.utils import ( display_for_field, flatten_fieldsets, help_text_for_field, label_for_field, lookup_field, quote, ) from django.core.exceptions import ObjectDoesNotExist from django.db.models.fields.related import ( ForeignObjectRel, ManyToManyRe...
3b9ca361b01808489ec6d68d2fe6a615f664c1e7f2a673fa44dd024a1b4f9dc4
from contextlib import contextmanager from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.test import modify_settings from django.test.selenium import SeleniumTestCase from django.utils.deprecation import MiddlewareMixin from django.utils.translation import gettext as _ class CSPMiddl...
744dc5bdf1d597845ca36bc5d6637c521a5960c8bed2a4c24e84850260f0cdb4
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...
4a34a9f7aff2084d8cfd17238e48f00c4da3d668ca481caae6b3e9c08879eb9f
import re from functools import update_wrapper from weakref import WeakSet from django.apps import apps from django.contrib.admin import ModelAdmin, actions from django.contrib.auth import REDIRECT_FIELD_NAME from django.core.exceptions import ImproperlyConfigured from django.db.models.base import ModelBase from djang...
232ce2cc6ebf0156f44a7892996a978514bd47a8caf38ad73f4464254649c72a
import datetime import decimal import json from collections import defaultdict from django.core.exceptions import FieldDoesNotExist from django.db import models, router from django.db.models.constants import LOOKUP_SEP from django.db.models.deletion import Collector from django.forms.utils import pretty_name from djan...
a0ebdd6ab533a2e1694e89860b5cfc941861eb55f366bd5f0ed6c3eec1a2acb5
""" This encapsulates the logic for displaying filters in the Django admin. Filters are specified in models with the "list_filter" option. Each filter subclass knows how to display a filter for a field that passes a certain test -- e.g. being a DateField or ForeignKey. """ import datetime from django.contrib.admin.op...
7718e3bd52129c094298579b1dd8b29514f5e8073675d3d7b6ef162f40ebe3dc
from urllib.parse import urlparse from urllib.request import url2pathname from asgiref.sync import sync_to_async from django.conf import settings from django.contrib.staticfiles import utils from django.contrib.staticfiles.views import serve from django.core.handlers.asgi import ASGIHandler from django.core.handlers....
1f2c6737aab66c2083c8648dc5e5adae628bf626cf8073d13dfde0dc339f6684
import functools import itertools import operator from collections import defaultdict from django.contrib.contenttypes.models import ContentType from django.core import checks from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, models, router, transaction fr...
a6bfa09c15242fb580717ab0a48ad86e69b62a6e5c76d7eae5c29538bd17f6b1
from django.contrib.contenttypes.models import ContentType from django.db import models from django.forms import ModelForm, modelformset_factory from django.forms.models import BaseModelFormSet class BaseGenericInlineFormSet(BaseModelFormSet): """ A formset for generic inline objects to a parent. """ ...
724992f2b0ce048c930c4f4fcc1743d5540a798b188c5347a1bdfe9fd43908fc
from django.core.exceptions import BadRequest, SuspiciousOperation class InvalidSessionKey(SuspiciousOperation): """Invalid characters in session key""" pass class SuspiciousSession(SuspiciousOperation): """The session may be tampered with""" pass class SessionInterrupted(BadRequest): """The s...
9333fb388c4729dbb00e19cc1352be9a2f565bbc9f1115e817e727e113c35a09
import time from importlib import import_module from django.conf import settings from django.contrib.sessions.backends.base import UpdateError from django.contrib.sessions.exceptions import SessionInterrupted from django.utils.cache import patch_vary_headers from django.utils.deprecation import MiddlewareMixin from dj...
386b3d31b59f60e3e730778e5d66d220737d098db273835fe8908015fade48c0
from django.contrib.postgres.fields import ArrayField from django.db.models import Aggregate, BooleanField, JSONField, Value from .mixins import OrderableAggMixin __all__ = [ 'ArrayAgg', 'BitAnd', 'BitOr', 'BoolAnd', 'BoolOr', 'JSONBAgg', 'StringAgg', ] class ArrayAgg(OrderableAggMixin, Aggregate): function...
931d1ab23975ad6cae09cd75e631a500047807ea08c4236e48137760b56ce3fa
from django.db.models import F, OrderBy class OrderableAggMixin: def __init__(self, *expressions, ordering=(), **extra): if not isinstance(ordering, (list, tuple)): ordering = [ordering] ordering = ordering or [] # Transform minus sign prefixed strings into an OrderBy() expres...
1596eb9fefbfbcd279300f9f5d5494a074dbabff48a3f2005f14f590c2505ebc
""" Creates permissions for all installed apps that need permissions. """ import getpass import unicodedata from django.apps import apps as global_apps from django.contrib.auth import get_permission_codename from django.contrib.contenttypes.management import create_contenttypes from django.core import exceptions from ...
714488d82065988978f1c96075b03bf0d3f83a0c52d61aac8e29d77c99cdfafc
""" Management utility to create superusers. """ import getpass import os import sys from django.contrib.auth import get_user_model from django.contrib.auth.management import get_default_username from django.contrib.auth.password_validation import validate_password from django.core import exceptions from django.core.m...
2d919b64349076f473385ab597f22be8504153f525bc328fcb0417a3e3930223
import base64 import logging import string import warnings from datetime import datetime, timedelta from django.conf import settings from django.contrib.sessions.exceptions import SuspiciousSession from django.core import signing from django.core.exceptions import SuspiciousOperation from django.utils import timezone ...
e12ee5cee20ec4e166d4c4c4dd3b4b1aab37b5f457a77e2f45bff0234820e0b4
from cx_Oracle import CLOB from django.contrib.gis.db.backends.base.adapter import WKTAdapter from django.contrib.gis.geos import GeometryCollection, Polygon class OracleSpatialAdapter(WKTAdapter): input_size = CLOB def __init__(self, geom): """ Oracle requires that polygon rings are in prop...
9a5e1c41c78e9386ed713b5b3bbfa15668d2e2e2baf59569e8bc74eed4d3e82e
import re from django.contrib.gis.db import models class BaseSpatialFeatures: gis_enabled = True # Does the database contain a SpatialRefSys model to store SRID information? has_spatialrefsys_table = True # Does the backend support the django.contrib.gis.utils.add_srs_entry() utility? supports_...
b1d6651c651fcf67923ec4e394ef71068192cfb06a283fcd854456f1fcf3dbaa
class WKTAdapter: """ An adaptor for Geometries sent to the MySQL and Oracle database backends. """ def __init__(self, geom): self.wkt = geom.wkt self.srid = geom.srid def __eq__(self, other): return ( isinstance(other, WKTAdapter) and self.wkt == oth...
e3ca18d55764252a19138b2fbe699fe96cd0894c81af6de160d7258d92445a15
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures from django.db.backends.sqlite3.features import ( DatabaseFeatures as SQLiteDatabaseFeatures, ) from django.utils.functional import cached_property class DatabaseFeatures(BaseSpatialFeatures, SQLiteDatabaseFeatures): can_alter_geomet...
8e15c1441e130a5e3c8766e32c3c8c29e6369165d2641dc670e4dccf4d491581
""" This object provides quoting for GEOS geometries into PostgreSQL/PostGIS. """ from psycopg2 import Binary from psycopg2.extensions import ISQLQuote from django.contrib.gis.db.backends.postgis.pgraster import to_pgraster from django.contrib.gis.geos import GEOSGeometry class PostGISAdapter: def __init__(self...
dc26e4c720da971ac1c89417306eef7cbf2214fb929ee012ef3ab3c3e30fbfc9
import json import os import sys import uuid from ctypes import ( addressof, byref, c_buffer, c_char_p, c_double, c_int, c_void_p, string_at, ) from django.contrib.gis.gdal.driver import Driver from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.prototypes import raster as capi fro...
0fb59ab23e4be6ca605bff670864afc8ecc0ddedb895e77fe539f630cd57fcdd
from django.core.exceptions import FieldDoesNotExist from django.db import ( IntegrityError, connection, migrations, models, transaction, ) from django.db.migrations.migration import Migration from django.db.migrations.operations.fields import FieldOperation from django.db.migrations.state import ModelState, Projec...
7c16c8a41f6df3c5041f79f5809ba9e376f3de4b26bdeb003eec47d8b94061aa
import functools import re from unittest import mock from django.apps import apps from django.conf import settings from django.contrib.auth.models import AbstractBaseUser from django.core.validators import RegexValidator, validate_slug from django.db import connection, migrations, models from django.db.migrations.auto...
91e415e5fa6931747f565c7722cb291a5663f797aa3b0b1ec12eca32f0acd67b
import datetime import itertools import re from importlib import import_module from unittest import mock from urllib.parse import quote, urljoin from django.apps import apps from django.conf import settings from django.contrib.admin.models import LogEntry from django.contrib.auth import ( BACKEND_SESSION_KEY, HASH...
0fcac2dd72cbbc8e85b8fa3c36569b112f6d2cc7b8c295f6eff0e149c8db39ca
from unittest import mock from django.conf.global_settings import PASSWORD_HASHERS from django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.hashers import get_hasher from django.contrib.auth....
d5b32bc6330156aa5c2b1257433d957db236458c30a16b7786bfa3d612e8b7f1
from django.contrib.auth import authenticate from django.contrib.auth.context_processors import PermLookupDict, PermWrapper from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models import ContentType from django.db.models import Q from django.test import SimpleTestCase, TestCase, ...
221c843722bf8c7182bc9d12112c70a98a098152f24fc6cb8a51a9cde9345379
import builtins import getpass import os import sys from datetime import date from io import StringIO from unittest import mock from django.apps import apps from django.contrib.auth import get_permission_codename, management from django.contrib.auth.management import ( create_permissions, get_default_username, ) f...
93922db645d6150f71830202b2bd5ee0b938099abc9a5ae5dd14dc526e734056
from datetime import date, datetime, timedelta from django.conf import settings from django.contrib.auth.models import User from django.contrib.auth.tokens import PasswordResetTokenGenerator from django.test import TestCase from django.test.utils import ignore_warnings from django.utils.deprecation import RemovedInDja...
6878f1d5c8b639a49589dec707379fdd2b4d02924c1b991a73805d08b84241a2
from django.contrib.auth.checks import ( check_models_permissions, check_user_model, ) from django.contrib.auth.models import AbstractBaseUser from django.core import checks from django.db import models from django.db.models import Q, UniqueConstraint from django.test import ( SimpleTestCase, override_settings,...
4f59c3a1e6e1b7efb2a196083f782acbdb2b40a38badf0e5131f648e60bcdb4a
from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.contrib.auth.tokens import PasswordResetTokenGenerator from django.contrib.auth.views import ( PasswordChangeDoneView, PasswordChangeView, PasswordResetCompleteView, PasswordResetDoneView, PasswordResetView, ) f...
d325599239fd979bef64b7cdce2dde14b9c1dcecb6abdd5634123e6c1d07e405
import os import shutil import sys import tempfile import threading import time import unittest from datetime import datetime, timedelta from io import StringIO from pathlib import Path from urllib.request import urlopen from django.core.cache import cache from django.core.exceptions import SuspiciousFileOperation fro...
45384ca6d6cabecdd2cd6bc5b6a12502077dfdcbfb0b914bd421f4b6cc744503
import string import uuid from django.conf.urls import url as conf_url from django.core.exceptions import ImproperlyConfigured from django.test import SimpleTestCase from django.test.utils import override_settings from django.urls import NoReverseMatch, Resolver404, path, resolve, reverse from django.utils.deprecation...
2448657132eb0d3254780b9e3ec31150d1e92f21617feb9b40f0bf70d6af23f8
import datetime import re from decimal import Decimal from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( Avg, Case, Count, DecimalField, DurationField, Exists, F, FloatField, Func, IntegerField, Max, Min, OuterRef, Subquery, Sum, Value, When, ) from dj...
23556469181ffa04c7ce1c46bf614937fdad6b26f8f7996f8e480bb8a21680b9
import os import unittest import warnings from io import StringIO from unittest import mock from django.conf import settings from django.contrib.staticfiles.finders import get_finder, get_finders from django.contrib.staticfiles.storage import staticfiles_storage from django.core.exceptions import ImproperlyConfigured ...
ddbe140599d818fb857ec8f517072c8a8f4d5577f2450af1fc49abb54f70a86f
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...
8546a7abdbd921dbf92d589ea28847ecac43b846fd448b7535902054a6ddd008
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...
9ad2fe88195d78c497ad5ee2b6bb2e583a91c48ef5dfaaa8b62335c02dd3b1f5
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...
1f5aeec70287ffaaac60a8effa8afebb28ff8cdfc92fcceeb844a32e1c6978e9
import datetime import pickle import django from django.db import models from django.test import TestCase from .models import Container, Event, Group, Happening, M2MModel, MyEvent class PickleabilityTestCase(TestCase): @classmethod def setUpTestData(cls): cls.happening = Happening.objects.create() ...
338a055c3fc05b7d69d736ff835b4d0e26e617c2c83377bf956f5359c9d14210
import datetime from django.db import DJANGO_VERSION_PICKLE_KEY, models from django.utils.translation import gettext_lazy as _ def standalone_number(): return 1 class Numbers: @staticmethod def get_static_number(): return 2 class PreviousDjangoVersionQuerySet(models.QuerySet): def __getst...
11e33a126dc3cc7ccc9565382373b1d71f5faa762058b1a42b5b1aa5dd3ed330
import datetime import sys import unittest from django.contrib.admin import ( AllValuesFieldListFilter, BooleanFieldListFilter, EmptyFieldListFilter, ModelAdmin, RelatedOnlyFieldListFilter, SimpleListFilter, site, ) from django.contrib.admin.options import IncorrectLookupParameters from django.contrib.auth.adm...
9d62014b5d79e6187f758a032789c5082990fb1ad5695a9726adf283070721e6
from django.contrib.auth.models import User from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.db import models class Book(models.Model): title = models.CharField(max_length=50) year = models.Positiv...
bfe783b20423bde47c4f7854e0a1188521dc004850fd644e93aa408d4a494398
from django import forms from django.contrib.contenttypes.forms import generic_inlineformset_factory from django.contrib.contenttypes.models import ContentType from django.db import models from django.test import TestCase from django.test.utils import isolate_apps from .models import ( Animal, ForProxyModelModel, ...