hash
stringlengths
64
64
content
stringlengths
0
1.51M
2ae18df137dee9cb1013ffbcc1d7f689b687dd051e9cc611305bd8d49574d4eb
import itertools import math from copy import copy from django.core.exceptions import EmptyResultSet from django.db.models.expressions import Exists, Func, RawSQL, Value from django.db.models.fields import DateTimeField, Field, IntegerField from django.db.models.query_utils import RegisterLookupMixin from django.utils...
e4813ce78ca4bc5ed078a9d98465ba764438f7e77a265e46e5a32e01962cdb1a
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...
c7d3f25960ae63a615da071f1cf5624dd72f87b5664f3b55e476788d102b0a3f
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...
36097be0c9ad8d4da46ce0bf445e93fac9df13a31dff7c57297678736e32c599
""" 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 ...
1a3739b32b6cd95eda846ea0c6ba1d572caadd05cf175af73a08fb1f227aae58
import collections import re import warnings from itertools import chain from django.core.exceptions import EmptyResultSet, FieldError from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import OrderBy, Random, RawSQL, Ref, Value from django.db.models.functions import Cast from django.d...
e3725c1e40df3bb6ac9b7fe10b307e193a5b9a1aaeb10ac18a61ae0b295de37d
import datetime import re import uuid from functools import lru_cache from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.db.backends.utils import strip_quotes, truncate_name from django.db.utils import DatabaseError from django.utils import timezone from ...
ab9f9322a92de1c4f85d9250551f227dbe70749a5e6cda4324731a02f11ead9a
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 = { 'FloatField': Database.NATIVE_FLOAT, 'CharFie...
88705d05119a2c16beac8fbff6cf7f32ff2db4021eaa444a07dbbc3cccfeef27
from django.db.utils import ProgrammingError from django.utils.functional import cached_property class BaseDatabaseFeatures: gis_enabled = False allows_group_by_pk = False allows_group_by_selected_pks = False empty_fetchmany_value = [] update_can_self_select = True # Does the backend distingu...
cc89aea54b05134b4d940f5a0dbc2247c0f12d08793105112be790a90a68bd2e
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: ...
4ac137378c3b875ac00fd017a397b9d7636f3293b565658fe331c2267397e6b9
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 Index from django.db.transaction import TransactionManagementError, a...
a95d93ed2783ba7c3cdb06902c97c8c8d1e6bb2ee2b774c860b6ede61c42b81f
import operator from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value = () update_can_self_select = False allows_group_by_pk = True related_fields_match_type = True ...
4c3b8f77c758b9e50e7cb81c996b10ca518828c203da4c53199999e820adb25d
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.indexes import Index from django.utils.datastructures import OrderedSet FieldIn...
c781567394de2efbb19647a1a0bb59cd7d3a7d29b26d885dbae0a43c56197bdd
""" MySQL database backend for Django. Requires mysqlclient: https://pypi.org/project/mysqlclient/ """ import re from django.core.exceptions import ImproperlyConfigured from django.db import utils from django.db.backends import utils as backend_utils from django.db.backends.base.base import BaseDatabaseWrapper from d...
181af43e6032f1aa506b25ddbd1a33e80dda220d0f11adba06c773fac09dcfe4
import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.utils import timezone from django.utils.duration import duration_microseconds from django.utils.encoding import force_str class DatabaseOperations(BaseDatabaseOperations): compiler_modul...
15594c0c75bea2db7e26643be5a63adb0d92ce43c3c84b414ddc79531079ab1a
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_...
a89363c458463b1e030beee811568f038d196c23ab5ba956541984e8c3ee210a
from psycopg2.extras import Inet from django.conf import settings from django.db import NotSupportedError from django.db.backends.base.operations import BaseDatabaseOperations class DatabaseOperations(BaseDatabaseOperations): cast_char_field_without_max_length = 'varchar' explain_prefix = 'EXPLAIN' cast_...
e598a3a9661622bf2c8f20376751e2eb20d7a2242889a8836c34a797c7498f0e
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...
6904ddad1c3849ed03a972cef6cfa6712f595451fa15e3921656a3f257a9bdbc
from django.db.backends.base.features import BaseDatabaseFeatures from .base import Database class DatabaseFeatures(BaseDatabaseFeatures): # SQLite can read from a cursor since SQLite 3.6.5, subject to the caveat # that statements within a connection aren't isolated from each other. See # https://sqlite....
3f8a8eb809505b34e084e15ea31ee41e5ca615e70180467e0e72ee32a029e48b
""" SQLite backend for the sqlite3 module in the standard library. """ import datetime import decimal import functools import hashlib import math import operator import re import statistics import warnings from itertools import chain from sqlite3 import dbapi2 as Database import pytz from django.core.exceptions impor...
dbe95c26a28481215088373115d5107ccf048d8ae0b561b908dc7074c9e9cc00
import fnmatch import os from pathlib import Path from subprocess import PIPE, Popen 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...
80f2494bb09e9a0f658d5ffb3f6164d09780737628a94822be5202cd78a0670d
import asyncio import logging import sys import tempfile import traceback from asgiref.sync import sync_to_async from django.conf import settings from django.core import signals from django.core.exceptions import RequestAborted, RequestDataTooBig from django.core.handlers import base from django.http import ( Fil...
866535f3daa9794b0389ed33bed54436be85a0fa018b9c63e167d5d00f456a87
from django.conf import settings from .. import Tags, Warning, register SECRET_KEY_MIN_LENGTH = 50 SECRET_KEY_MIN_UNIQUE_CHARACTERS = 5 W001 = Warning( "You do not have 'django.middleware.security.SecurityMiddleware' " "in your MIDDLEWARE so the SECURE_HSTS_SECONDS, " "SECURE_CONTENT_TYPE_NOSNIFF, " ...
b746fa6a366e55cdb653ff03eaf0500dd190d302083ce2f0e52cf44b8fc26475
from django.db.backends.ddl_references import Statement, Table from django.db.models import F, Q from django.db.models.constraints import BaseConstraint from django.db.models.sql import Query __all__ = ['ExclusionConstraint'] class ExclusionConstraint(BaseConstraint): template = 'CONSTRAINT %(name)s EXCLUDE USIN...
eb2c2e96dd3fcfa97139a4a385a1ab8175769378c69e0162062ec5cdf0a1919d
import hashlib import json import os import posixpath import re import warnings from urllib.parse import unquote, urldefrag, urlsplit, urlunsplit from django.conf import settings from django.contrib.staticfiles.utils import check_settings, matches_patterns from django.core.cache import ( InvalidCacheBackendError, ...
b54b6cae2c8d6deafd56d347b1593caa044b465758479b6c850549d0584e0294
import json from django.contrib.postgres import lookups from django.contrib.postgres.forms import SimpleArrayField from django.contrib.postgres.validators import ArrayMaxLengthValidator from django.core import checks, exceptions from django.db.models import Field, IntegerField, Transform from django.db.models.lookups ...
fcb628ed0c1ed203c627bf357f72bd027c2e8525fcae49a5085e34ac760540a2
import datetime import json from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange, Range from django.contrib.postgres import forms, lookups from django.db import models from .utils import AttributeSetter __all__ = [ 'RangeField', 'IntegerRangeField', 'BigIntegerRangeField', 'DecimalRangeField...
e0e400e7a6cb2fdcfa6bc9b2ea1d0bced432496e4323ae4cd53ec66ccff4f99e
import json from django.contrib.postgres import forms, lookups from django.contrib.postgres.fields.array import ArrayField from django.core import exceptions from django.db.models import Field, TextField, Transform from django.utils.translation import gettext_lazy as _ from .mixins import CheckFieldDefaultMixin __al...
ebb35879e4eea96a98113ea45aa9658770066015143dec8e0f5150a4c48e84e2
import json from psycopg2.extras import Json from django.contrib.postgres import forms, lookups from django.core import exceptions from django.db.models import ( Field, TextField, Transform, lookups as builtin_lookups, ) from django.utils.translation import gettext_lazy as _ from .mixins import CheckFieldDefault...
831793a8eacff35817f9b063cc9a9086cf3f2e3793e73bb68e3a4751fdccee65
from django.core.exceptions import FieldDoesNotExist from django.db import connection, migrations, models, transaction from django.db.migrations.migration import Migration from django.db.migrations.operations import CreateModel from django.db.migrations.operations.fields import FieldOperation from django.db.migrations....
9a55da623bfeb3974da0886879f25ba29f1a66e4ff43dba1482b3b05fc1bb0b3
import os import sys import unittest from types import ModuleType, SimpleNamespace from unittest import mock from django.conf import ENVIRONMENT_VARIABLE, LazySettings, Settings, settings from django.core.exceptions import ImproperlyConfigured from django.http import HttpRequest from django.test import ( SimpleTes...
294958620aeb798189a7a5e58514a8d69b505ab80a0243a6a3db92eee1a64e3d
import os import shutil import sys import tempfile import threading import time import unittest from datetime import datetime, timedelta from io import StringIO from urllib.request import urlopen from django.core.cache import cache from django.core.exceptions import SuspiciousFileOperation from django.core.files.base ...
1b55b53b9eff3657bc5713c3684fa72c2351e23e5d451a189ffdddcb28289f29
import uuid from django.core.exceptions import ImproperlyConfigured from django.test import SimpleTestCase from django.test.utils import override_settings from django.urls import Resolver404, path, resolve, reverse from .converters import DynamicConverter from .views import empty_view included_kwargs = {'base': b'he...
d9cfdff778d8d2b346e917e2e699245d691ee2ce51b8b4f56e0aa6de1d423e7d
import json from django.contrib import admin from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.admin.views.autocomplete import AutocompleteJsonView from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models import ContentType from django.http import H...
e328a826fb7d308b2721dc78b6cc226d0f6127d229f4669503105944bffce797
import datetime import pickle from decimal import Decimal from operator import attrgetter from unittest import mock from django.contrib.contenttypes.models import ContentType from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( Avg, Case, Count, DecimalField...
9d92822949da01c73948bcdfa8eaa991d42f5f1c6651179cab17eca6b1d63fa6
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...
c906f184b68c7bde2c84c7b717336f51463e4e54676c01378d4761f119f4476c
import datetime import json from decimal import Decimal from django import forms from django.core import exceptions, serializers from django.db.models import DateField, DateTimeField, F, Func, Value from django.test import ignore_warnings, override_settings from django.utils import timezone from django.utils.deprecati...
4288b0a61b2a5463df75c29a5eb43294ae76e0c035eb027f25c2a5b8c0900d53
import datetime import operator import uuid from decimal import Decimal from django.core import checks, exceptions, serializers from django.core.serializers.json import DjangoJSONEncoder from django.db import connection from django.db.models import Count, F, Q from django.db.models.expressions import RawSQL from djang...
364dd05d324a76f94363bd410ccf542ffc194f9ee261fd4ca8cef8c909ae5fc8
import json from django.core import checks, exceptions, serializers from django.db import connection from django.db.models.expressions import RawSQL from django.forms import Form from django.test.utils import CaptureQueriesContext, isolate_apps from . import PostgreSQLSimpleTestCase, PostgreSQLTestCase from .models i...
21f93171afb0bb93d0c63c2096664ea71891c532c808d5b2118e9fb1f1193742
import datetime from django.db import connection, transaction from django.db.models import F, Func, Q from django.db.models.constraints import CheckConstraint from django.db.utils import IntegrityError from django.utils import timezone from . import PostgreSQLTestCase from .models import HotelReservation, RangesModel...
953071308ed68493db468477d936a1ad8793eeb75f5d08f26b9cbc3b9f297694
import os import shutil import sys import tempfile import unittest from io import StringIO from unittest import mock from django.conf import settings from django.contrib.staticfiles import finders, storage from django.contrib.staticfiles.management.commands.collectstatic import ( Command as CollectstaticCommand, )...
4ea919c0bf8ab3c007006e29ce1b360cc5289c78e68e86e68ab939a9f87a7b43
import datetime import sys import unittest from unittest import mock from urllib.parse import quote_plus from django.test import SimpleTestCase from django.utils.encoding import ( DjangoUnicodeDecodeError, escape_uri_path, filepath_to_uri, force_bytes, force_str, get_system_encoding, iri_to_uri, repercent_brok...
ed84f3b47873428eb0d88feb6637744bb6ba818c3d700f2c7337c4211b1b8ddf
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 unittest import mock, skip, skipIf from django.apps.registry import Apps from django.test impo...
2906e807fb6fbeaac90648a1cb3e8a3558021efc72c50d44a94c512d95b46ec4
import unittest from datetime import datetime from django.test import SimpleTestCase, ignore_warnings from django.utils.datastructures import MultiValueDict from django.utils.deprecation import RemovedInDjango40Warning from django.utils.http import ( base36_to_int, escape_leading_slashes, http_date, int_to_base36,...
fd71d22eb0dcd21464635faa427321fdd26fd08bf3e4dc961ad153d3cf4573c5
from django.conf import settings from django.db import connection, models from django.db.models.query_utils import Q from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from django.test.utils import isolate_apps from .models import Book, ChildModel1, ChildModel2 class SimpleIndexesTests(SimpleTestC...
ad1d4e4aa96b7e4b4d48fc8b6fdedf0cb597244613966a1b44c186e75b3216cb
import datetime import pickle import sys import unittest from operator import attrgetter from django.core.exceptions import EmptyResultSet, FieldError from django.db import DEFAULT_DB_ALIAS, connection from django.db.models import Count, F, Q from django.db.models.sql.constants import LOUTER from django.db.models.sql....
014bf53bc729676874351c153c04f8936367bff85aaaf54145bc9a577d6d71aa
""" Various complex queries that have been problematic in the past. """ import threading from django.db import models class DumbCategory(models.Model): pass class ProxyCategory(DumbCategory): class Meta: proxy = True class NamedCategory(DumbCategory): name = models.CharField(max_length=10) ...
9c13e9f579dfe834e34a4604ab73f3e9825c7900ee79bfe4cd1826fadd0d8dcb
from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.db import models class NonIntegerAutoField(models.Model): creation_datetime = models.DateTimeField(primary_key=True) class Square(models.Model): r...
b31b75678e63865a3f4c0619c2c52a5e8098fd3f7e8687873150d4eacc4368e4
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, IntegrityError, OperationalError, connection, ) from django.db.models import Index, Model, Q from django.db.models.constraints im...
e584230a4fc203578c73d216067d1e50eef15e25088ca8c2d6a34e08b364c582
from django.conf import settings from django.core.checks.security import base, csrf, sessions from django.test import SimpleTestCase from django.test.utils import override_settings class CheckSessionCookieSecureTest(SimpleTestCase): @property def func(self): from django.core.checks.security.sessions i...
036668c93c2d906f257815dd1bf553c187c4be267b9c5807be1694c6ccca5e82
from datetime import datetime from operator import attrgetter from django.core.exceptions import FieldError from django.db.models import ( CharField, Count, DateTimeField, F, Max, OuterRef, Subquery, Value, ) from django.db.models.functions import Upper from django.test import TestCase from django.utils.deprecatio...
a3e565873b4ca69778f4645ff7a244ea2ce8b70c197889dde0e8084a87384ac2
import unittest from django.conf import settings from django.core.checks import Error, Warning from django.core.checks.model_checks import _check_lazy_references from django.core.exceptions import ImproperlyConfigured from django.db import connection, connections, models from django.db.models.functions import Lower fr...
603eb0f9e2eaa9008ca54a4ed10bda1b35e2a9f00b3716fcd7def463f3853cdf
import unittest from django.core import validators from django.core.exceptions import ValidationError from django.db import IntegrityError, connection, models from django.test import SimpleTestCase, TestCase from .models import ( BigIntegerModel, IntegerModel, PositiveIntegerModel, PositiveSmallIntegerModel, ...
1ef2997478c3a36773c165d032448f6251573935cad24814769a32c24da5ae5d
from django.test import TestCase from .models import AutoModel, BigAutoModel, SmallAutoModel class AutoFieldTests(TestCase): model = AutoModel def test_invalid_value(self): tests = [ (TypeError, ()), (TypeError, []), (TypeError, {}), (TypeError, set())...
413e530af90b42c6e4a99b2fb880017c3195f242be9f0bfdcd9ef307e4f6dde5
from django.core.exceptions import ValidationError from django.db import IntegrityError, connection, models from django.db.models.constraints import BaseConstraint from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from .models import ChildModel, Product, UniqueConstraintProduct def get_constraint...
cd6375c42a3e25276fb3ca4fb8cd1e46611df6f14427f9dbdf56a260d2d8c3b1
import warnings from datetime import datetime from django.core.paginator import ( EmptyPage, InvalidPage, PageNotAnInteger, Paginator, QuerySetPaginator, UnorderedObjectListWarning, ) from django.test import SimpleTestCase, TestCase from django.utils.deprecation import RemovedInDjango31Warning from .custom im...
8578830e972cc5c57a8a29e3897b38dd725acfe258a2b752e2a9cdb68d66df82
import datetime import pickle import unittest import uuid from copy import deepcopy from django.core.exceptions import FieldError from django.db import DatabaseError, connection, models from django.db.models import CharField, Q, TimeField, UUIDField from django.db.models.aggregates import ( Avg, Count, Max, Min, S...
728351206b66ed109fe50409c422221f00ef010e56895d981a84ba2e02eee143
from unittest import mock, skipUnless from django.db import connection from django.db.models import Index from django.db.utils import DatabaseError from django.test import TransactionTestCase, skipUnlessDBFeature from .models import ( Article, ArticleReporter, CheckConstraintModel, City, Comment, Country, Dis...
217ec3ea2767e0b21389d451acd5a5099cb9b18726df3805a1346914c2081487
from django.db import models class City(models.Model): id = models.BigAutoField(primary_key=True) name = models.CharField(max_length=50) def __str__(self): return self.name class Country(models.Model): id = models.SmallAutoField(primary_key=True) name = models.CharField(max_length=50) ...
7982b8ef16f785eddb89a9cb9b16539f7eca4e5de5c81cb2dec5aabcb61b9d5f
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 from django.db.models.expressions import Exists, OuterRef from django.db.models.functions import Substr from django.test import TestC...
ba4e73a95d7a0f3b8d26da3c30c8a4f6c85eb4dd9c76c524b03ca5ea109c768d
import copy import datetime import json import uuid from django.core.exceptions import NON_FIELD_ERRORS from django.core.files.uploadedfile import SimpleUploadedFile from django.core.validators import MaxValueValidator, RegexValidator from django.forms import ( BooleanField, CharField, CheckboxSelectMultiple, Choi...
1017cae95bb38d78b26706e985e1da6610dc4610261dbc385eec8004cd67f295
import datetime import unittest from django.db import connection from django.db.models.fields import BooleanField, NullBooleanField from django.db.utils import DatabaseError from django.test import TransactionTestCase from ..models import NonIntegerAutoField, Square @unittest.skipUnless(connection.vendor == 'oracle...
5e3e1ea66f96caba04e81d493aa1ad1e22bfb95bd176a35426f42f0e27332167
from datetime import datetime, timedelta, timezone as datetime_timezone import pytz from django.conf import settings from django.db.models import ( DateField, DateTimeField, F, IntegerField, Max, OuterRef, Subquery, TimeField, ) from django.db.models.functions import ( Extract, ExtractDay, ExtractHour, Ex...
15e6481dd1d886d4211752df0cbdd04dd77a6b1ee2a676ac8aeb74dd27b1b9f5
import datetime from decimal import Decimal from django.db.models import Case, Count, F, OuterRef, Q, Subquery, Sum, When from django.test import TestCase from .models import Author, Book, Publisher class FilteredAggregateTests(TestCase): @classmethod def setUpTestData(cls): cls.a1 = Author.objects....
ad193d8acf1798427bacf79b663621ff15b0618391bf57923323d18cb14033dc
from django.contrib.admin import ModelAdmin, TabularInline from django.contrib.admin.helpers import InlineAdminForm from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models import ContentType from django.test import Requ...
61f66078af10169c6dd68f2b63864cc58c4e73205f950f716429d07d8c725d05
from django import forms from django.contrib import admin from django.db import models from .models import ( Author, BinaryTree, CapoFamiglia, Chapter, Child, ChildModel1, ChildModel2, Consigliere, EditablePKBook, ExtraTerrestrial, Fashionista, Holder, Holder2, Holder3, Holder4, Inner, Inner2, Inner3, Inne...
7ddff46c7e3cec88fd5114bafbae42f85e3cb3b8dfdbd3086683ab6196668b09
import json import mimetypes import os import re import sys from copy import copy from functools import partial from http import HTTPStatus from importlib import import_module from io import BytesIO from urllib.parse import unquote_to_bytes, urljoin, urlparse, urlsplit from django.conf import settings from django.core...
4c79553dd59d888db48084880c513f6b3be150ea0725b56c9c82ff0b9ecfafbb
import asyncore import base64 import mimetypes import os import shutil import smtpd import sys import tempfile import threading from email import charset, message_from_binary_file, message_from_bytes from email.header import Header from email.mime.text import MIMEText from email.utils import parseaddr from io import St...
31b1b9509a6cf304ff7321f5f11e7464d07a274756baf11377de4dec67aafc14
from django.template.defaultfilters import filesizeformat from django.test import SimpleTestCase from django.utils import translation class FunctionTests(SimpleTestCase): def test_formats(self): tests = [ (1023, '1023\xa0bytes'), (1024, '1.0\xa0KB'), (10 * 1024, '10.0\...
2ef06a743c03006ae6e90fd60c8c2e08df92f7a8132bafe794df1f803e36b837
import functools import itertools import logging import os import pathlib 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 ...
d3139128f53dfc37415e163cb13eff2a7556b4b29f61b14cdec1cc35aceb13a0
""" 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 from importlib impor...
8c72e722f2f495a2a135802ee1423d2eb4e840165be3a0ffb791652851c65911
""" Helper functions for creating Form classes from Django models and database field objects. """ from itertools import chain from django.core.exceptions import ( NON_FIELD_ERRORS, FieldError, ImproperlyConfigured, ValidationError, ) from django.forms.fields import ChoiceField, Field from django.forms.forms impor...
51bb6c02eeb7acfada010b11749f9ea7634dc81188402492fb1cba36f2172a0e
""" 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 ...
014a17f4fecd8b453cc1b183ce0baa9a84ad60a11327eb271fcbf6a281bd096b
import copy import threading import time import warnings from collections import deque from contextlib import contextmanager import _thread import pytz from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import DEFAULT_DB_ALIAS from django.db.backends import utils f...
9a4879fe0314d3894968fc611e5a39ad3c42403381b5e9bd8c06e10c2e05f247
import datetime import decimal import gettext as gettext_module import os import pickle import re import tempfile from contextlib import contextmanager from importlib import import_module from pathlib import Path from unittest import mock from asgiref.local import Local from django import forms from django.apps impor...
0aaa6b867ce928e456106f9a0a6e70788bf2eb802d5a8fc5f8a2c1812a7446cf
"""HTML utilities suitable for global use.""" import html import json import re from html.parser import HTMLParser from urllib.parse import ( parse_qsl, quote, unquote, urlencode, urlsplit, urlunsplit, ) from django.utils.functional import Promise, keep_lazy, keep_lazy_text from django.utils.http import RFC3986_G...
59a6572762a18f3f9d8977a74601f2e4a12830c3d8d8769f5d754cf30ae7d838
import ipaddress import re from pathlib import Path from urllib.parse import urlsplit, urlunsplit from django.core.exceptions import ValidationError from django.utils.deconstruct import deconstructible from django.utils.functional import SimpleLazyObject from django.utils.ipv6 import is_valid_ipv6_address from django....
3362ec6cc299d2962843451b7704b9aa58b7a13e45706cc14ea137b6ad71db98
import asyncore import base64 import mimetypes import os import shutil import smtpd import sys import tempfile import threading from email import charset, message_from_binary_file, message_from_bytes from email.header import Header from email.mime.text import MIMEText from email.utils import parseaddr from io import St...
c54ddc0d20f831e6330ccc0773b71ac74cc5d8d14a990120be71243e2db36705
import copy import inspect import warnings from functools import partialmethod from itertools import chain from django.apps import apps from django.conf import settings from django.core import checks from django.core.exceptions import ( NON_FIELD_ERRORS, FieldDoesNotExist, FieldError, MultipleObjectsReturned, ...
27e0bdb2d91de887c9d6cbf75604736695257b367b4eac013a45e9680c10ba8e
import copy import datetime import inspect from decimal import Decimal from django.core.exceptions import EmptyResultSet, FieldError from django.db import connection from django.db.models import fields from django.db.models.query_utils import Q from django.db.utils import NotSupportedError from django.utils.deconstruc...
0d7a6e4dea00a87288cbddfafa7f760427a0cfb89d41e74692dc70531327f2df
import collections import re import warnings from itertools import chain from django.core.exceptions import EmptyResultSet, FieldError from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import OrderBy, Random, RawSQL, Ref, Value from django.db.models.functions import Cast from django.d...
7d17b36addb33355e49f5ccc5ec789ececfc13f9d0eec73e87653acf1936ee01
import datetime import re import uuid from functools import lru_cache from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.db.backends.utils import strip_quotes, truncate_name from django.db.utils import DatabaseError from django.utils import timezone from ...
be76a5424b40cf943e2b305bc7ace0235e51f842dff1d38df8a33b78fda21027
from psycopg2.extras import Inet from django.conf import settings from django.db import NotSupportedError from django.db.backends.base.operations import BaseDatabaseOperations class DatabaseOperations(BaseDatabaseOperations): cast_char_field_without_max_length = 'varchar' explain_prefix = 'EXPLAIN' cast_...
feac06877a019c8b4230f4cc84b21f09f5d0e37ca5919bc26a442be2f420d296
import datetime import json from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange, Range from django.contrib.postgres import forms, lookups from django.db import models from .utils import AttributeSetter __all__ = [ 'RangeField', 'IntegerRangeField', 'BigIntegerRangeField', 'DecimalRangeField...
bf46637f504f3356aef0842688fce0c47bdeefd010e513d1b4bf6981b60e5860
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...
d1491e54bbf0323c9837225fd9d8450d2ef388ac31b0a5a5041672ef92691e03
from django.core.serializers.json import DjangoJSONEncoder from django.db import models from .fields import ( ArrayField, BigIntegerRangeField, CICharField, CIEmailField, CITextField, DateRangeField, DateTimeRangeField, DecimalRangeField, EnumField, HStoreField, IntegerRangeField, JSONField, SearchVectorFi...
2f3859fc6174d9d88dcad49aa074212733e62cd60c188531fc74258dbba23ffe
import datetime from django.db import connection, transaction from django.db.models import F, Q from django.db.models.constraints import CheckConstraint from django.db.utils import IntegrityError from . import PostgreSQLTestCase from .models import RangesModel try: from psycopg2.extras import NumericRange except...
068e22fa0aa51a034ec5b40889adf10e4d100acda0d915c69e75cea4af1b5480
import datetime import pickle import sys import unittest from operator import attrgetter from django.core.exceptions import EmptyResultSet, FieldError from django.db import DEFAULT_DB_ALIAS, connection from django.db.models import Count, F, Q from django.db.models.sql.constants import LOUTER from django.db.models.sql....
00ab5ba6aad99d1f6245e31fe0ec67082d68e6043ea6775dc277a52b7ea15893
from django.db.models import Exists, F, IntegerField, OuterRef, Value from django.db.utils import DatabaseError, NotSupportedError from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from .models import Number, ReservedName @skipUnlessDBFeature('supports_select_union') class QuerySetSetOperationTe...
081f6f8ea041e4badb08ab16e4bc975eee6014c8041beb3a3d7e6d136ce4106b
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, IntegrityError, OperationalError, connection, ) from django.db.models import Index, Model, Q from django.db.models.constraints im...
d3c0d0de51b90678e13ceb2c3bcda3c9fafbfb025d906e6ee7b14f68ba247460
from django.core import checks from django.core.checks import Error from django.db import models from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from django.test.utils import ( isolate_apps, modify_settings, override_system_checks, ) @isolate_apps('check_framework', attr_name='apps') @overri...
025c61b796463e5b51c132fd43cc326e8a824729dcd811424381546f4e436dc3
import unittest from django.conf import settings from django.core.checks import Error, Warning from django.core.checks.model_checks import _check_lazy_references from django.core.exceptions import ImproperlyConfigured from django.db import connection, connections, models from django.db.models.functions import Lower fr...
f464c2388c76cef71aed293f16a88b94ebe56333b8933f6a49804f1978b734bb
from django.core.exceptions import ValidationError from django.db import IntegrityError, connection, models from django.db.models.constraints import BaseConstraint from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from .models import ChildModel, Product def get_constraints(table): with connec...
2123a1225dc3be230a7ac3a7ddcc3dc7b7f8a03933279298a573d4ebf8ac57aa
from django.db import models class Product(models.Model): name = models.CharField(max_length=255) color = models.CharField(max_length=32, null=True) price = models.IntegerField(null=True) discounted_price = models.IntegerField(null=True) class Meta: constraints = [ models.Chec...
e823681b50255d0302a6260dbef4ff7b30fc78dbf36f02083f94c03e6c17cf3e
from django.core.serializers.json import DjangoJSONEncoder from django.db import migrations, models from ..fields import ( ArrayField, BigIntegerRangeField, CICharField, CIEmailField, CITextField, DateRangeField, DateTimeRangeField, DecimalRangeField, EnumField, HStoreField, IntegerRangeField, JSONField, S...
a24cdf9f554a791db288882f8591d312f393c757dd78f38384f1b2e7c968317c
import copy import datetime import inspect from decimal import Decimal from django.core.exceptions import EmptyResultSet, FieldError from django.db import connection from django.db.models import fields from django.db.models.query_utils import Q from django.db.utils import NotSupportedError from django.utils.deconstruc...
11c0c0ae0c911c9351cd2b022f895061f758d46157e71ed4431efd540e1406a9
import copy import inspect import warnings from functools import partialmethod from itertools import chain from django.apps import apps from django.conf import settings from django.core import checks from django.core.exceptions import ( NON_FIELD_ERRORS, FieldDoesNotExist, FieldError, MultipleObjectsReturned, ...
abc48a01047134128b1b5c0574b3b8e2f7220fd76db6e5a4be6c26740ce2abc0
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...
8e1520d20b60729ae9ca36ad495b6e67c64fc43b516d69e3888a1351e0248cba
""" 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 ...
e76aa5cf04a115a0de5653ee12df57a6b7dd348492355080a9a28063f2acdc87
import collections import re import warnings from itertools import chain from django.core.exceptions import EmptyResultSet, FieldError from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import OrderBy, Random, RawSQL, Ref, Value from django.db.models.functions import Cast from django.d...
f7b5569034371ddd9712d889c1f792e603f658b2bb16f6b333d4b75db4dd6474
from django.db.utils import ProgrammingError from django.utils.functional import cached_property class BaseDatabaseFeatures: gis_enabled = False allows_group_by_pk = False allows_group_by_selected_pks = False empty_fetchmany_value = [] update_can_self_select = True # Does the backend distingu...