hash
stringlengths
64
64
content
stringlengths
0
1.51M
57e87e1daa5c6c1095a6101dcd8445e334957cad7b61fb0e0ced52bcc71562d9
import unittest from decimal import Decimal from django.core import validators from django.core.exceptions import ValidationError from django.db import connection, models from django.test import TestCase from .models import BigD, Foo class DecimalFieldTests(TestCase): def test_to_python(self): f = mode...
982abe7976b4a911342a6573ca7a1361ee6f6b3bce19e78b241fa599507f5f6d
import datetime from collections import Counter from unittest import mock from django.core.exceptions import ValidationError from django.forms import ( BaseForm, CharField, DateField, FileField, Form, IntegerField, SplitDateTimeField, formsets, ) from django.forms.formsets import BaseFormSet, all_valid, formse...
bef4dcc3db7f3a64d672a30b34b7ea8d26f6b1c134f1de2ce24ae18fb1032c62
import functools import re import sys import types import warnings from pathlib import Path from django.conf import settings from django.http import Http404, HttpResponse, HttpResponseNotFound from django.template import Context, Engine, TemplateDoesNotExist from django.template.defaultfilters import pprint from djang...
18c69a77911885539dc802c32872202919b6f9882e285e64f80e6e78c9a032f4
""" 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 ...
ae24ac1646838c70408be397c1448bf9ea829168af2bf62f7d959bfe91c413b9
# The views used below are normally mapped in the AdminSite instance. # This URLs file is used to provide a reliable view deployment for test purposes. # It is also provided as a convenience to those who want to deploy these URLs # elsewhere. from django.contrib.auth import views from django.urls import path urlpatte...
5b1c5cfa2f887c8521b59ccff9ce01b8b9de912d8e2653bdbdb16bb3cc728a25
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....
5f9be89483d9ca6d0f5e33250f21e1ce90677928239e928b7232a4c5d94622dd
import logging import os import re from ctypes import CDLL, CFUNCTYPE, c_char_p, c_int from ctypes.util import find_library from django.contrib.gis.gdal.error import GDALException from django.core.exceptions import ImproperlyConfigured logger = logging.getLogger('django.contrib.gis') # Custom library path set? try: ...
ad7a685ce8f2cf6ee255ad6c5259a6d086c68af59407165d63301fd73b9c3acd
import asyncio import sys import threading from pathlib import Path from unittest import skipIf from asgiref.sync import SyncToAsync from asgiref.testing import ApplicationCommunicator from django.contrib.staticfiles.handlers import ASGIStaticFilesHandler from django.core.asgi import get_asgi_application from django....
6da430d24be7dc8f375e183076874878f28b62cb0a6e8e921fe26ddd1d4b03e9
from django.contrib.staticfiles.handlers import ASGIStaticFilesHandler from django.core.handlers.asgi import ASGIHandler from django.test import AsyncRequestFactory from .cases import StaticFilesTestCase class TestASGIStaticFilesHandler(StaticFilesTestCase): async_request_factory = AsyncRequestFactory() asy...
15e7af3df9021ecf1c53b0b6bb1b677fc022798f47a754c97bc3e1f0b8c7bd50
import datetime import pickle import sys import unittest from operator import attrgetter from threading import Lock from django.core.exceptions import EmptyResultSet, FieldError from django.db import DEFAULT_DB_ALIAS, connection from django.db.models import Count, Exists, F, OuterRef, Q from django.db.models.expressio...
9765550b7d882da4d9beda8773a315383b1015c23b54053daa91b73a3f475fac
""" Various complex queries that have been problematic in the past. """ from django.db import models from django.db.models.functions import Now class DumbCategory(models.Model): pass class ProxyCategory(DumbCategory): class Meta: proxy = True class NamedCategory(DumbCategory): name = models.Ch...
229200e7f6f0f1c5df21c23f7ea2422936edaa7f7f9eebe47f9a7a445183bcaa
import importlib import inspect import os import re import sys import tempfile import threading from io import StringIO from pathlib import Path from unittest import mock from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.db import DatabaseError, connection from djan...
3524d3d8a7fc6467673770086b34767e9116ebac73793913d58557af3253fea6
""" Default Django settings. Override these with settings in the module pointed to by the DJANGO_SETTINGS_MODULE environment variable. """ # This is defined here as a do-nothing function because we can't import # django.utils.translation -- that module depends on the settings. def gettext_noop(s): return s ####...
1ecf8eb69f092e13115b2cdc3eee54292d2c0c0c0cf392ca04463b17644968fe
import functools import itertools import logging import os import signal import subprocess import sys import threading import time import traceback import weakref from collections import defaultdict from pathlib import Path from types import ModuleType from zipimport import zipimporter from django.apps import apps fro...
cafb4f195364421ec4e36534a61c2ca5291311adc01154d15b0d7d4b074da45f
import ipaddress import re import warnings from pathlib import Path from urllib.parse import urlsplit, urlunsplit from django.core.exceptions import ValidationError from django.utils.deconstruct import deconstructible from django.utils.deprecation import RemovedInDjango41Warning from django.utils.encoding import punyc...
34ce217fb9b7d9d0f52916ed18303c43cfa78d3ac9b575e4eb9ac99462faf28a
""" Multi-part parsing for file uploads. Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to file upload handlers for processing. """ import base64 import binascii import cgi import collections import html import os from urllib.parse import unquote from django.conf import settings from djan...
0388547f629d89a9ee13f7d0f580e0a7037b03020468872979537733cab26912
""" LANG_INFO is a dictionary structure to provide meta information about languages. About name_local: capitalize it as if your language name was appearing inside a sentence in your language. The 'fallback' key can be used to specify a special fallback logic which doesn't follow the traditional 'fr-ca' -> 'fr' fallbac...
713a8963ecfec1b71a52e88b64fed6720be141662b19fc7d88733948b0d3d0c8
from django.db.backends.utils import names_digest, split_identifier from django.db.models.query_utils import Q from django.db.models.sql import Query __all__ = ['Index'] class Index: suffix = 'idx' # The max length of the name of the index (restricted to 30 for # cross-database compatibility with Oracle)...
c0e297b592588e64ec95ed48cd8ea568866e74eac7d4123ceac17cae35cef1bf
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...
ffff4962106fb4e1ac21af3bada5fbba62a78e4c8b7bee697bc6ae91d7892137
""" 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...
abf6e7957f44e9cbad0ffacb794a36d32f47f4bb5785540ca5f4e3ab46a13f34
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 ...
38608afea3b1271e0ae6efb4fe94c10582ebbc131595a13db86fe70e2be604ca
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...
9d7c3a26ed9bf3c797c6490cfabd95e0d383f7753cc864a80ad71c97a63e72b4
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...
d206354414478ccdbca27a6aefb66e1e675d5dc106e5fc2332f3f0203ef45db9
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...
7e71ce09d37ba354aec154e2367d818e6d2123d87fdebe5924877bca483d1783
from django.db import NotSupportedError from django.db.models.expressions import Func, Value from django.db.models.fields import CharField, IntegerField from django.db.models.functions import Coalesce from django.db.models.lookups import Transform class BytesToCharFieldConversionMixin: """ Convert CharField r...
845d828ed8f8501f4423e18eaebee25fbf22ad6daa8f47d3c979fe68e7c54c9a
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, Random, RawS...
db6b8ad767c6cf0ab0dc3a5e5d50c5645f89abf09421ac9a81528774355160a6
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...
a09f11c69480413d73c9905cb7b42ca3d40edbc8e051e28161b9f36390915b5b
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', ...
716105e860f79610ecba9664f6e0169b6b9749b01b81f2c76245634bbc40e6c5
""" Serialize data to/from JSON Lines """ import json from django.core.serializers.base import DeserializationError from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers.python import ( Deserializer as PythonDeserializer, Serializer as PythonSerializer, ) class Serializer(Pytho...
10e0d7328b5bd4983746479d8ddaa2e50520f38c38fe37c39676daba550e204f
""" 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 = { ...
2afed78f63f4332e035810fce637a09fa32cbf97933083aa4bf3c02b7bf5c48d
""" XML serializer. """ import json from xml.dom import pulldom from xml.sax import handler from xml.sax.expatreader import ExpatParser as _ExpatParser from django.apps import apps from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.core.serializers import base from djang...
acc2d6cdd3f28994e6e9b7fe134eb09df61d481e909ea7f0116c53e22d62af0d
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...
5fd3368417b4e4ddf1b73b0b9464e74fe10005de11e3c1270a383f91add419a5
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...
9b9cba665aea5b669e8266fc89271b49cb64b066161938ff50d77b95cabbce13
import base64 import binascii import functools import hashlib import importlib import warnings from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.signals import setting_changed from django.dispatch import receiver from django.utils.crypto import ( constant_tim...
52dca23130268b9cabd4cd52f7b2b4ad7cd8365170ab3b8f956545e7e9fc6e92
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...
7c20df5924d0494e356002cd6ac1dd969511bdc70517f1c0b7228bd2866228cd
from django.contrib.postgres.fields import ArrayField from django.db.models import Aggregate, JSONField, Value from .mixins import OrderableAggMixin __all__ = [ 'ArrayAgg', 'BitAnd', 'BitOr', 'BoolAnd', 'BoolOr', 'JSONBAgg', 'StringAgg', ] class ArrayAgg(OrderableAggMixin, Aggregate): function = 'ARRAY_AGG'...
ffab69fe5cf922fd99be5f74878679621c0496ab8b5bea0bdaa26f678d9701d1
from django.contrib.gis.db.models import GeometryField from django.contrib.gis.db.models.functions import Distance from django.contrib.gis.measure import ( Area as AreaMeasure, Distance as DistanceMeasure, ) from django.db import NotSupportedError from django.utils.functional import cached_property class BaseSpat...
81da98def65abdf926aab64171f604b2b3b24c6bb1c4c35ceaa395ae5fee9f00
import datetime import importlib import io import os import sys from unittest import mock from django.apps import apps from django.core.management import CommandError, call_command from django.db import ( ConnectionHandler, DatabaseError, OperationalError, connection, connections, models, ) from django.db.back...
085ba0fe00457ea9dcda68741eb14af39f853c8919d246a3f5d16b204aeafb3b
from unittest import mock, skipUnless from django.conf.global_settings import PASSWORD_HASHERS from django.contrib.auth.hashers import ( UNUSABLE_PASSWORD_PREFIX, UNUSABLE_PASSWORD_SUFFIX_LENGTH, BasePasswordHasher, PBKDF2PasswordHasher, PBKDF2SHA1PasswordHasher, check_password, get_hasher, identify_hasher...
cee723b51d1e67c7aed14c5087981293841583069cc0e159dbe3c227d1c88b14
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...
abf987b2273ffb2948d5dddb3b458107e20a4cf16303cf878910b4ee27834f43
import json from django.db.models import CharField, F, OuterRef, Q, Subquery, Value from django.db.models.functions import Cast, Concat, Substr from django.test.utils import Approximate from . import PostgreSQLTestCase from .models import AggregateTestModel, StatTestModel try: from django.contrib.postgres.aggreg...
57af4bb5ce3f75035c2728706e77aebd012f5b2029e10b35ddcd157d8d3007d6
import datetime from unittest import mock from django.db import ( IntegrityError, NotSupportedError, connection, transaction, ) from django.db.models import ( CheckConstraint, Deferrable, F, Func, Q, UniqueConstraint, ) from django.test import skipUnlessDBFeature from django.utils import timezone from . impor...
cca7f95197002f5111e8d3e6388b0d8a9285505dbc2e063951614091fa46e56e
import datetime from decimal import Decimal from unittest import skipIf from django.core.exceptions import FieldDoesNotExist, FieldError from django.db import connection from django.db.models import ( BooleanField, Case, CharField, Count, DateTimeField, Exists, ExpressionWrapper, F, Func, IntegerField, Max, Nu...
f45badacaed94d2333925bb7bb459383defcefafa367a67e3a54eb9e247f22ee
import os import re import types from datetime import datetime, timedelta from decimal import Decimal from unittest import TestCase, mock from django.core.exceptions import ValidationError from django.core.files.base import ContentFile from django.core.validators import ( BaseValidator, DecimalValidator, EmailVali...
8121a7042398c3660d3bfeb8cb74d10ee594674a4c160555155061fb22db6774
import contextlib import os import py_compile import shutil import sys import tempfile import threading import time import types import weakref import zipfile from importlib import import_module from pathlib import Path from subprocess import CompletedProcess from unittest import mock, skip, skipIf import django.__mai...
71f4a3c3a835c9cf3526411c0abb2769c774df83fa7bec120b6648705499b4e9
from unittest import mock from django.conf import settings from django.db import connection, models from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from django.test.utils import isolate_apps from .models import Book, ChildModel1, ChildModel2 class SimpleIndexesTests(SimpleTestCase): def t...
212c374e7c570c0ecc95ab20a52bb9710557316b5b6a2512562b5295d3ea62b3
import decimal import json import re from django.core import serializers from django.core.serializers.base import DeserializationError from django.db import models from django.test import TestCase, TransactionTestCase from django.test.utils import isolate_apps from .models import Score from .tests import SerializersT...
71681283cc9bbd59cd4249df6b3c5bceec61b3f9da7706e5484a2bab861e700c
from datetime import datetime from operator import attrgetter from django.core.exceptions import FieldError from django.db.models import ( CharField, DateTimeField, F, Max, OuterRef, Subquery, Value, ) from django.db.models.functions import Upper from django.test import TestCase from .models import Article, Autho...
ed766b8a821559632f5cbda31776c12c1bc9fadeaf116c1de2c8e774ec3488ba
""" Specifying ordering Specify default ordering for a model using the ``ordering`` attribute, which should be a list or tuple of field names. This tells Django how to order ``QuerySet`` results. If a field name in ``ordering`` starts with a hyphen, that field will be ordered in descending order. Otherwise, it'll be ...
69a72365fc2f27c7490d2caf9f809c3b599749f8a0e94f9d6b9e0ed05d9e320e
import base64 import hashlib import os import shutil import sys import tempfile as sys_tempfile import unittest from io import BytesIO, StringIO from urllib.parse import quote from django.core.files import temp as tempfile from django.core.files.uploadedfile import SimpleUploadedFile from django.http.multipartparser i...
055733436389a0d9abdb86e4a12908d1a41088d1622fdb759c8fc71d422ff314
import operator import uuid from unittest import mock, skipIf, skipUnless from django import forms from django.core import serializers from django.core.exceptions import ValidationError from django.core.serializers.json import DjangoJSONEncoder from django.db import ( DataError, IntegrityError, NotSupportedError, ...
89e754f4d7db806af483f67883cab41b29268e92f98e19c59c207b131211f174
from unittest import mock from django.core.exceptions import ValidationError from django.db import IntegrityError, connection, models from django.db.models.constraints import BaseConstraint from django.db.transaction import atomic from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from .models impo...
77b0af9c553863803eb4c7b39d2df0c3987b5ece1a428ca8d0026889c1d7a905
import datetime import pickle import unittest import uuid from copy import deepcopy from unittest import mock from django.core.exceptions import FieldError from django.db import DatabaseError, NotSupportedError, connection from django.db.models import ( Avg, BooleanField, Case, CharField, Count, DateField, DateTim...
dc6691a7ee434250858acb48f185a33cd34973f8a5d246a7b37ddde1d8c4e48a
import collections.abc from datetime import datetime from math import ceil from operator import attrgetter from django.core.exceptions import FieldError from django.db import connection, models from django.db.models import Exists, Max, OuterRef from django.db.models.functions import Substr from django.test import Test...
8ccda59d7a95aed844456d67fa002ead387f07937307caa8205e520076419390
from django.db.backends.mysql.client import DatabaseClient from django.test import SimpleTestCase class MySqlDbshellCommandTestCase(SimpleTestCase): def test_fails_with_keyerror_on_incomplete_config(self): with self.assertRaises(KeyError): self.get_command_line_arguments({}) def test_bas...
5a3c89c4463152b80235679c4fa7a32d4aeff2ff428d2f1142e249a0b4de7f7b
from django.db import connection from django.db.models import Value from django.db.models.functions import Length, Repeat from django.test import TestCase from ..models import Author class RepeatTests(TestCase): def test_basic(self): Author.objects.create(name='John', alias='xyz') none_value = ''...
a8724233fba2281d9659200e1da408c54709859915f9e8f5cc5c5162babd12a5
from django.db.models import IntegerField, Value from django.db.models.functions import Lower, Right from django.test import TestCase from ..models import Author class RightTests(TestCase): @classmethod def setUpTestData(cls): Author.objects.create(name='John Smith', alias='smithj') Author.ob...
97ffa0feb3537279e29d726919231bffcae40bac8103383c9781210b2171e2df
from django.db.models import IntegerField, Value from django.db.models.functions import Left, Lower from django.test import TestCase from ..models import Author class LeftTests(TestCase): @classmethod def setUpTestData(cls): Author.objects.create(name='John Smith', alias='smithj') Author.obje...
8484f2e48a7e73ee9ec7ea052b16f8939c93e17588ae0e95aa9a62caa9248824
from django.db.models import Value as V from django.db.models.functions import Lower, StrIndex, Substr, Upper from django.test import TestCase from ..models import Author class SubstrTests(TestCase): def test_basic(self): Author.objects.create(name='John Smith', alias='smithj') Author.objects.cr...
afc4f70b2c3662c8b584c4f14f119811a5cd73db02a12c62f5ec6c391c37af1f
from django.db import connection from django.db.models import Value from django.db.models.functions import Length, LPad, RPad from django.test import TestCase from ..models import Author class PadTests(TestCase): def test_pad(self): Author.objects.create(name='John', alias='j') none_value = '' if...
5c45ffec00523d5e3c21da286e647a255de67c15589563d82b86c2cfd615f229
""" This module contains helper functions for controlling caching. It does so by managing the "Vary" header of responses. It includes functions to patch the header of response objects directly and decorators that change functions to do that header-patching themselves. For information on the Vary header, see: http...
4b66fd74f6ce9ec9d6fcea6a6a5d2c4ea0d311693a3116958de7aac55d17a9f4
""" This module converts requested URLs to callback view functions. URLResolver is the main class here. Its resolve() method takes a URL (as a string) and returns a ResolverMatch object which provides access to all attributes of the resolved URL match. """ import functools import inspect import re import string from i...
ec8f0eecf51dc365e06fff8acbd5a5bd0c85a93145f8d7336482e3eec67f2844
""" Helper functions for creating Form classes from Django models and database field objects. """ import warnings from itertools import chain from django.core.exceptions import ( NON_FIELD_ERRORS, FieldError, ImproperlyConfigured, ValidationError, ) from django.forms.fields import ChoiceField, Field from django.fo...
1cad792a4757e13a280b19cb131b1ca4853ce1be5884462e58d0293159d3bbdc
from django.core.exceptions import ValidationError from django.forms import Form from django.forms.fields import BooleanField, IntegerField from django.forms.utils import ErrorList from django.forms.widgets import HiddenInput, NumberInput from django.utils.functional import cached_property from django.utils.html import...
3a7c4b8b3695aae28d4004bcbcb2ae0311d3504485f06586934fac20fc12bd46
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 ...
9ea2b05f15498d232fb1e6c1cb3e14a7526cd720b5160494fb867d7e61f374f6
from django.db.migrations import operations from django.db.migrations.utils import get_migration_name_timestamp from django.db.transaction import atomic from .exceptions import IrreversibleError class Migration: """ The base class for all migrations. Migration files will import this from django.db.migra...
32243f4715c66d2a5e96d67d5743ca61d136da6b8ff224bf2c29b74a290bdf24
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...
20385a687a85cfca6a4f5b11a9553493e9ab634a5cd7d3e3971e4b6bd40621a4
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...
f782a39d847b722648f027db78df302366f325e9ead5e832c6c904e249deb186
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...
2f33f2a4cc7689f9f9339a28873462b8e92f58532e15edde5b80787d6c3824bc
""" 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...
8e4cd0d85fe38cb116370e44670786e584c1dca5d387f26311ac9b664c07ad05
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...
7f9085a81af64cdd61ac3aa0839e3420537337b6d9e737c3504eaf857299265a
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 ...
db2aae68e77acfece31f065137008a594cf753df864f2539f273dff45ec0551f
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...
84bcb00dbe184289f9a969834f44bbc9f254ace32e0a08efa34eb5676bd0ed21
import codecs import concurrent.futures import glob import os from pathlib import Path 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 fn.open('rb') as f: sample = f.read...
1a67e19b0c0f1a725ddf01f5eaac63d66f914d17c6a51349f8bec640365977f3
"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: ...
74de99a58bf82a001747a6e1c9ca9ae62137a4b1480b57d28fb3d905b795103d
from django.contrib.sites.models import Site from django.db import models from django.utils.translation import gettext_lazy as _ class Redirect(models.Model): site = models.ForeignKey(Site, models.CASCADE, verbose_name=_('site')) old_path = models.CharField( _('redirect from'), max_length=200,...
2e1c5b92345c4b09d0bd9e2d978c6928e83631e04ca5857579194e7ad6e25fc0
import base64 import binascii import functools import hashlib import importlib import warnings from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.signals import setting_changed from django.dispatch import receiver from django.utils.crypto import ( constant_tim...
61419e35016e259af42f5b69f49a2f356cb1a0f0d1ed25cef137714571aa6d32
from urllib.parse import urlparse from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME from django.contrib.auth.views import redirect_to_login from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.shortcuts import resolve_url class AccessMixin: """ ...
2707a398bf7cea76e13fcf106b63d9c6e905c6fd41f20d294f349cd2d05b5a9c
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('redirects', '0001_initial'), ] operations = [ migrations.AlterField( model_name='redirect', name='new_path', field=models.CharField( blan...
772a1d526d728e48aee394bc798c368130dd2f41b42bc9c35097bd27dec49ff0
import datetime import decimal import enum import functools import math import os import pathlib import re import sys import uuid from unittest import mock import custom_migration_operations.more_operations import custom_migration_operations.operations from django import get_version from django.conf import SettingsRe...
ad4be864469e8363a52ff76c6f9175499a049860e7e2fc086a3a6b7dd5774a98
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...
182f57bb6beb5cd98e9e2016bcb66d3ec997a6a2f5e4ab35c88925478785ed41
from unittest import mock from django.contrib.auth import models from django.contrib.auth.mixins import ( LoginRequiredMixin, PermissionRequiredMixin, UserPassesTestMixin, ) from django.contrib.auth.models import AnonymousUser from django.core.exceptions import PermissionDenied from django.http import HttpResponse...
20a8af0f0f768d43d2faed1973a38262727c8147d067a743f288659bbf0ab70d
from unittest import mock, skipUnless from django.conf.global_settings import PASSWORD_HASHERS from django.contrib.auth.hashers import ( UNUSABLE_PASSWORD_PREFIX, UNUSABLE_PASSWORD_SUFFIX_LENGTH, BasePasswordHasher, PBKDF2PasswordHasher, PBKDF2SHA1PasswordHasher, check_password, get_hasher, identify_hasher...
2592d292516e5bed78926ac7cb7407cdda0f3a620b56eb9e31be7c6dd6ab66be
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...
46da37a7356f5e486ddab5fc7aa4dfb1244976dc3e527e906f3f422809d21fd6
import decimal import enum import json import unittest import uuid from django import forms from django.core import checks, exceptions, serializers, validators from django.core.exceptions import FieldError from django.core.management import call_command from django.db import IntegrityError, connection, models from dja...
15f7a08c3d5780b8a9f88bfd66961e3cc2defb7e2469f008d154625a256c0dc0
import os import re from io import StringIO from unittest import mock, skipUnless from django.core.management import call_command from django.db import connection from django.db.backends.base.introspection import TableInfo from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature from .models import ...
0783b4ac366fc1f4abaffbfc10bdd04dc720cb0f79a56e73a01a50dff6786e33
""" Unit tests for reverse URL lookups. """ import sys import threading from admin_scripts.tests import AdminScriptTestCase from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist from django.http import ( HttpRequest, ...
e5d64dcb244e18422c779c68a0620914a584f92b0c1a0909a008abc67bfe36ba
# Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. import copy import io import os import pickle import re import shutil import tempfile import threading import time import unittest from pathlib import Path from unittest import mock from django.conf import settings from dj...
9b38a4276df4ee7e04afcb97db6bbc7b1f71701cc9d6395911fd6ecac478477a
import datetime import re from datetime import date from decimal import Decimal from django import forms from django.core.exceptions import ImproperlyConfigured, ValidationError from django.db import models from django.forms.models import ( BaseModelFormSet, _get_foreign_key, inlineformset_factory, modelformse...
e42857bd59aca007d746a35502376157d6138889db1fccaee3d8dc0606a9a94a
import datetime import itertools import unittest from copy import copy from unittest import mock from django.core.management.color import no_style from django.db import ( DatabaseError, DataError, IntegrityError, OperationalError, connection, ) from django.db.models import ( CASCADE, PROTECT, AutoField, BigAut...
f88fb09f370cd548f95a934eab5435f0afad29d11be0def8c0880fee9a396f50
import unittest from unittest import mock from django.core.checks.database import check_database_backends from django.db import connection, connections from django.test import TestCase class DatabaseCheckTests(TestCase): databases = {'default', 'other'} @mock.patch('django.db.backends.base.validation.BaseDa...
87e74ae6698348e441ac8ce00d3ba29d49caa6bee3b77e22fe143adda56b05d7
import gettext as gettext_module import os import stat import unittest from io import StringIO from pathlib import Path from subprocess import run from unittest import mock from django.core.management import ( CommandError, call_command, execute_from_command_line, ) from django.core.management.commands.makemessage...
4777f63dae0642fed93b93c4da48c39f9ca6f2f50677f06d0700f5b7880d271a
import datetime from collections import Counter from unittest import mock from django.core.exceptions import ValidationError from django.forms import ( BaseForm, CharField, DateField, FileField, Form, IntegerField, SplitDateTimeField, formsets, ) from django.forms.formsets import BaseFormSet, all_valid, formse...
b1c1680794c2b9e944e2afc81495c64195c3655031d4b1703c5262b47eb5bd87
import datetime from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import models from django.http import Http404 from django.utils import timezone from django.utils.functional import cached_property from django.utils.translation import gettext as _ from django.views...
6c163958966481290246fdff9d7db82bcd37e31deebda0b5fed3d245ce36fecf
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...
451962f4b7b2043a1bc912fdd6507005b5fe82464ed38ce9e754878230336d76
from django import forms from django.core.exceptions import NON_FIELD_ERRORS from django.test import TestCase from django.utils.functional import lazy from . import ValidationAssertions from .models import ( Article, Author, GenericIPAddressTestModel, GenericIPAddrUnpackUniqueTest, ModelToValidate, ) class B...
7bb5e37283e8687326f5c8031f1963ab2eb26777e51db8f043eec4e0ef2e022d
from datetime import datetime from django.core.exceptions import ValidationError from django.db import models def validate_answer_to_universe(value): if value != 42: raise ValidationError('This is not the answer to life, universe and everything!', code='not42') class ModelToValidate(models.Model): ...
5a64a9bf6d361089a6176fed7c5a84f6f1b3ddfc1b63694bd1ec4d68ea284a0d
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...
adf32922bfb9c4952567176b7420d4dc5604efe57d41f4fc73cd39b693643d9f
import datetime from unittest import mock from django.core.exceptions import ImproperlyConfigured from django.test import TestCase, override_settings, skipUnlessDBFeature from django.test.utils import requires_tz_support from django.utils import timezone from .models import Artist, Author, Book, BookSigning, Page d...
cdf5bcc8f724e5010d53711f80c2408ed88a647ac37f9ada7c47405377db927a
from django.contrib.auth import views as auth_views from django.contrib.auth.decorators import login_required from django.urls import path, re_path from django.views.decorators.cache import cache_page from django.views.generic import TemplateView, dates from . import views from .models import Book urlpatterns = [ ...