hash
stringlengths
64
64
content
stringlengths
0
1.51M
255bc9022b68d0bbfb900127417902f89aa72cc022a8ac4107ee77685a5293da
import datetime import re import sys from contextlib import contextmanager from unittest import SkipTest, skipIf from xml.dom.minidom import parseString import pytz from django.contrib.auth.models import User from django.core import serializers from django.core.exceptions import ImproperlyConfigured from django.db im...
f7dddfdea2dea1e2e2f095b271a851159b32e30699ab30630a710609545259ac
import os import re import shutil import tempfile import time import warnings from io import StringIO from pathlib import Path from unittest import mock, skipIf, skipUnless from admin_scripts.tests import AdminScriptTestCase from django.core import management from django.core.management import execute_from_command_li...
54f11e6d4b729b87436d2e7f7ef5b6ef1c2b3b4ef1ece4b646677cbc7c4793d9
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...
e1bc80dfb37c6e3d66e60eef79c039eb855b38357db98894ad8190f321e0363e
# Unittests for fixtures. import json import os import re from io import StringIO from pathlib import Path from django.core import management, serializers from django.core.exceptions import ImproperlyConfigured from django.core.serializers.base import DeserializationError from django.db import IntegrityError, transact...
8b36105c474a0e12baaa3862d52365ea15c4933b6dfa147068a700354e001b1a
from unittest import mock from django.db import migrations try: from django.contrib.postgres.operations import ( BloomExtension, BtreeGinExtension, BtreeGistExtension, CITextExtension, CreateExtension, CryptoExtension, HStoreExtension, TrigramExtension, UnaccentExtension, ) except Impo...
b7f3391c7752303aa5b1ebab2296255871bf88b1bedb315804314db5f0f9d136
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...
99d8089f467a220eac236bfaa1a77b6360df236925b4a63016a76c5876ac05bd
import os import re import tempfile import threading import unittest from pathlib import Path from sqlite3 import dbapi2 from unittest import mock from django.core.exceptions import ImproperlyConfigured from django.db import ConnectionHandler, connection, transaction from django.db.models import Avg, StdDev, Sum, Vari...
49699f5a203e401a898086664cda2c0f71783ac475ec599e8a680cfa6c540f94
import os import sys from distutils.sysconfig import get_python_lib from setuptools import setup CURRENT_PYTHON = sys.version_info[:2] REQUIRED_PYTHON = (3, 6) # This check and everything above must remain compatible with Python 2.7. if CURRENT_PYTHON < REQUIRED_PYTHON: sys.stderr.write(""" =====================...
37075014a08a83153da430c63d359163d72d4ef2e105995a67569efe34b6ed8c
import functools import re import sys import types 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 django.urls import re...
394d8aedf4187043f8c5fd2259be21ef65b658fb9b03965b776f96d17f8315b7
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, ...
1876abf1847e3eb0514d6b66e4517dab8d32e10f128d8843bdcc8bba60df24bb
""" Helpers to manipulate deferred DDL statements that might need to be adjusted or discarded within when executing a migration. """ class Reference: """Base class that defines the reference interface.""" def references_table(self, table): """ Return whether or not this instance references th...
b15aab55bc7703f2ec6c4d18705e85c76b5dc81c70782eabfb1c0e50e04842b5
import unicodedata from django import forms from django.contrib.auth import ( authenticate, get_user_model, password_validation, ) from django.contrib.auth.hashers import ( UNUSABLE_PASSWORD_PREFIX, identify_hasher, ) from django.contrib.auth.models import User from django.contrib.auth.tokens import default_to...
8e7cd658412aeb1544db9a050f39129a72f47bcac5932208ec0a3dad72a0e7f8
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...
08d3b010cd2056d8d6abc95200f15cf27fae9a1abde7ac6a3f37d45bea31ae3a
from django.contrib.postgres.search import TrigramDistance, TrigramSimilarity from django.test import modify_settings from . import PostgreSQLTestCase from .models import CharFieldModel, TextFieldModel @modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'}) class TrigramTest(PostgreSQLTestCase): M...
9043286a95b31b3ed2780a10c33e90ad4ad3142fe3ec33b608b95fbc8be5e451
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.http import QueryDict from django.test import override_settings from django.test.utils import isolate_apps f...
3964472e1eb5df5147c4e741b020b8deb13d6cba407306060d1fc2b4fb8917e3
import datetime from unittest import skipIf, skipUnless from django.db import connection from django.db.models import Index from django.db.models.deletion import CASCADE from django.db.models.fields.related import ForeignKey from django.db.models.query_utils import Q from django.test import ( TestCase, Transaction...
ada5425ffbea699d4435f6c9dabe4399aa32ae313b47dc66a4c28dcacedf9c82
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...
aafb8dc19cd1d855b2108e2072b2c76c7a6e4b948fe9060be6349a72a1f40f6f
import json import mimetypes import os 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.handlers....
3f3ce9226eb61845415eb83114dfc4c6c60109e238adffcc910cf84c1d9b0b46
""" PHP date() style date formatting See http://www.php.net/date for format strings Usage: >>> import datetime >>> d = datetime.datetime.now() >>> df = DateFormat(d) >>> print(df.format('jS F Y H:i')) 7th October 2003 11:39 >>> """ import calendar import datetime import time from email.utils import format_datetime as ...
f5b0e647918f5eb4d41882633bca429b6bd9aceb81e14dfb63acc039e065d88b
"""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.encoding import punycode from django.utils.functional import Promise, keep_lazy, keep_lazy_t...
eb7c84c1f956e3df20ab8674847c4c8a599468539d999b4d529e42450ae71312
"""Default tags used by the template system, available to all templates.""" import re import sys import warnings from collections import namedtuple from datetime import datetime from itertools import cycle as itertools_cycle, groupby from django.conf import settings from django.utils import timezone from django.utils....
85df6e094852bbddceac2b1afd81a23114e7c6db66a933f0ad2ca28c27792cc5
import pkgutil from importlib import import_module from pathlib import Path from asgiref.local import Local from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.functional import cached_property from django.utils.module_loading import import_string DEFAULT_DB_ALI...
f50f4d20a922b6ab3cf740f8f3d6320cbf758a4b7f297b894aa543159ce020a9
""" HTML Widget classes """ import copy import datetime import warnings from collections import defaultdict from itertools import chain from django.conf import settings from django.forms.utils import to_current_timezone from django.templatetags.static import static from django.utils import datetime_safe, formats from...
0824c4eba630af61e8458ff95c06ad288a8fb23c8a6dec62cc10481f3bfb1c88
from django.apps.registry import apps as global_apps from django.db import migrations, router from .exceptions import InvalidMigrationPlan from .loader import MigrationLoader from .recorder import MigrationRecorder from .state import ProjectState class MigrationExecutor: """ End-to-end migration execution - ...
d3244e03ab60b99183338e0b2bde6ce91f2af85e95bea1434d2178c06ef6d9aa
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)...
a1f7e1b063231e307d413c49b2013c375564c1488bb26e0c80803e5b1a19d0db
""" The main QuerySet implementation. This provides the public API for the ORM. """ import copy import operator import warnings from collections import namedtuple from functools import lru_cache from itertools import chain from django.conf import settings from django.core import exceptions from django.db import ( ...
c3593d1a599bf29a3ea1a42173d53a091ee37081f54da6ddfc018f59ff28a921
from django.core.exceptions import ObjectDoesNotExist from django.db.models import signals from django.db.models.aggregates import * # NOQA from django.db.models.aggregates import __all__ as aggregates_all from django.db.models.constraints import * # NOQA from django.db.models.constraints import __all__ as constraint...
d3cdf56d1a0f23e624f193dc10e383784779ea83d944c50413eb28be40998410
""" 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...
76be7f14969f00445d0d597f9bbcc60cd46dabb7625ffee04d3844ba0f1122e2
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...
27644de9870a07649654d8d62276432f60e52eda4ab6d8e7b49bc25353e14d05
import operator from collections import Counter, defaultdict from functools import partial, reduce from itertools import chain from operator import attrgetter from django.db import IntegrityError, connections, transaction from django.db.models import query_utils, signals, sql class ProtectedError(IntegrityError): ...
2fd9908cc9ec28d934d68dcac5520dde459446e53c2bfc6a9e628b8d364ac9ec
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...
11020c244c478b722af4da9cfffc0125d6b2aa500b17a187bd3663afa124290d
from django.db.models.query_utils import Q from django.db.models.sql.query import Query __all__ = ['CheckConstraint', 'UniqueConstraint'] class BaseConstraint: def __init__(self, name): self.name = name def constraint_sql(self, model, schema_editor): raise NotImplementedError('This method mu...
9ec9fc7102f5156c9ca61eb7e1f486fff391bca2caeec9ff91488b6f120eb8fe
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...
eb21b1e4849d261c5084b55400c5962583ca309d588d86068be5538a907adad6
""" 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...
5c66d706d92707326adc2ccc6284076f7ea85c8fa9d833d718405890d767bf20
""" 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 ...
b00083452f1383ecb18288f08fef0d70d0a223acd7cafe1ce596a7e34f4551d0
import collections import re from functools import partial 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...
8a155d35a9539ce408906fdda6bae9ac71ab06d7b46ed2038d3b71f81ba87440
""" Oracle database backend for Django. Requires cx_Oracle: https://oracle.github.io/python-cx_Oracle/ """ import datetime import decimal import os import platform from contextlib import contextmanager from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import utils...
c2b51729203503e3c16d6e9f902065597dc6512606cab03e51f7ec095a76306f
import datetime 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.models.expressions import Exists, ExpressionWrapper, RawSQL from django.db.m...
f7bfc12353b585d04d3763b42c985439049718eb639eccd1365c25eac2f5d3be
import datetime from .base import Database class InsertVar: """ A late-binding cursor variable that can be passed to Cursor.execute as a parameter, in order to receive the id of the row created by an insert statement. """ types = { 'AutoField': int, 'BigAutoField': int, ...
3d3fcf6539dd51976c6584a8dae78ac6765e9c8b9a34fd803bfadf0fd1017092
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: ...
56bb340ff30f34e9e14bf82f3ce3ec3a56940404183da1f8add7d74646fc35bf
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...
d695502c71324348246aced93049ab7f49feb70c55dfdde4d8a608f7c64bb921
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 # The prefix to put on the default database name when creating # the test database. TEST_DATABASE_PREFIX = 'test_' class BaseDatabaseCreation: ...
ccb2414f116a8bfdeaa3fd9b563867638072f5d50524806e6aa15eb33f5099e6
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...
7a734c6d60c1f9cf2109bfe3d77ff0730d6df3a099d5fa886331da302a2347ca
""" MySQL database backend for Django. Requires mysqlclient: https://pypi.org/project/mysqlclient/ """ 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 django.utils...
fcc273130b669fbdd9a61452704dc0904c013ec29f0a283ca4cd1cb5c9c886e6
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...
64c27cb8626e61d6954e46b9873619be1c559ed879310f127b832381bb5e7968
""" PostgreSQL database backend for Django. Requires psycopg 2: http://initd.org/projects/psycopg2 """ import asyncio import threading import warnings from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import connections from django.db.backends.base.base import Ba...
7a40e8fc3e45ff218f2b5ab7bcce3b1655ff546263682c530e8564a40d11bd45
import re from collections import namedtuple import sqlparse from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) from django.db.models.indexes import Index from django.utils.regex_helper import _lazy_re_compile FieldInfo = namedtuple('FieldInfo'...
accaa09b336995b0542d9c2e79d4542b538c4ac4398fa4d11da7fa91ffc78ce9
""" 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...
679e1873230f895a863f0a0cb15138456779062dc6ed8b7845a9e22ea80b4e4c
import os import shutil import sys from pathlib import Path from django.db.backends.base.creation import BaseDatabaseCreation class DatabaseCreation(BaseDatabaseCreation): @staticmethod def is_in_memory_db(database_name): return not isinstance(database_name, Path) and ( database_name == ...
a37f951180dc418158b19e72aeb9ea33c21d07e4b450d4623e544f651156f8e6
import glob import os import re import sys from functools import total_ordering from itertools import dropwhile import django from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.files.temp import NamedTemporaryFile from django.core.management.base import BaseComman...
24911f2d375b5413bbce0ff7eb56d49aef987ebdb871798614551d1242594fce
"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...
8fd470b4287f4dd0aed97badc7fc236c926c7244bc2306c7842cc0422cefc63a
"Memcached cache backend" import pickle import re import time from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.utils.functional import cached_property class BaseMemcachedCache(BaseCache): def __init__(self, server, params, library, value_not_found_exception): super().__...
78485fef88b1ae7f64e5bc49c815d66e269ddec0ab816de61f58615c42329581
"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: ...
e4bdfe113bd40841c70faef43fe8d46dcbe4d96810219d07a9e1371714d133a4
"Base Cache class." import time import warnings from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import import_string class InvalidCacheBackendError(ImproperlyConfigured): pass class CacheKeyWarning(RuntimeWarning): pass # Stub class to ensure not passing in a `tim...
0dc7dc90239db1fae6a9aac4418c9e2d10f223bdcf5376de09f96da687c06127
"Dummy cache backend" from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache class DummyCache(BaseCache): def __init__(self, host, *args, **kwargs): super().__init__(*args, **kwargs) def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): key = self.make_key(key, ve...
517f581df8100ee8c2531b31aa63ae42676e6c8064b906e2758861664b5e94cb
"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...
5389ae3f29e9bbef7b06ecbaf95f570010ba48ab14354422e17d6f78728a83a2
import inspect from importlib import import_module from pathlib import Path from django.apps import apps from django.conf import settings from django.contrib import admin from django.contrib.admin.views.decorators import staff_member_required from django.contrib.admindocs import utils from django.contrib.admindocs.uti...
64f8e6db2f8aaaf909c979a2b6e2c876e42b1834bb62c0fdcd7cf0fd39b773eb
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...
bcb8ce74e2a9548a60d976f176f865542e53b2f17877921d1909c6290cdee258
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 class AccessMixin: """ Abstract CBV mixin that gives access mixins the same customizable fu...
c4c4ac6616ed395ed33d125edff140ce183f76a949b757691f5b30a19c93440c
import datetime import decimal 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 django.urls impo...
765a2b325d378ff964ebb3e87b4bfdbddab56c2957df66a54456ae5cd1d9c962
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...
e3e3dc3682bbd074b4f34f115662d7433dc5e3c9b608d52947f8a70687f89fcc
from datetime import datetime, timedelta from django import forms from django.conf import settings from django.contrib import messages from django.contrib.admin import FieldListFilter from django.contrib.admin.exceptions import ( DisallowedModelAdminLookup, DisallowedModelAdminToField, ) from django.contrib.admin....
098f231f9e96ef2d8d5c1da4b09050064f279a28e6e76ca8b30e55016d299e00
# LayerMapping -- A Django Model/OGR Layer Mapping Utility """ The LayerMapping class provides a way to map the contents of OGR vector files (e.g. SHP files) to Geographic-enabled Django models. For more information, please consult the GeoDjango documentation: https://docs.djangoproject.com/en/dev/ref/contrib/gi...
a313600a624709e6af028a770cf82279b3024521c88aa9c83e2a1a29b55fe517
from decimal import Decimal from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField from django.contrib.gis.db.models.sql import AreaField, DistanceField from django.contrib.gis.geos import GEOSGeometry from django.core.exceptions import FieldError from django.db.models import ( BinaryField...
54c126f5c85530413020a473b60d223091adc759dd900e57ca605304934442f3
""" This module contains the spatial lookup types, and the `get_geo_where_clause` routine for Oracle Spatial. Please note that WKT support is broken on the XE version, and thus this backend will not work on such platforms. Specifically, XE lacks support for an internal JVM, and Java libraries are required to use...
ddbb9f5efd1e928ed5052abeb2c86b4a694ce5d1a5fec28e0a3e058a40218b53
""" SQL functions reference lists: https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html """ from django.contrib.gis.db.backends.base.operations import ( BaseSpatialOperations, ) from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter from django.contrib.gis.db.backends.utils import Sp...
82e294f9f340b040800c931674d65222f01dff831f0ee6edfc873fb6313138da
import re from django.conf import settings from django.contrib.gis.db.backends.base.operations import ( BaseSpatialOperations, ) from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.db.models import GeometryField, RasterField from django.contrib.gis.gdal import GDALRaster from d...
d639017296ebea5beb7508217f82ca126f7908c74295d5c562e0538c32581f71
""" Tests for django.core.servers. """ import errno import os import socket from http.client import HTTPConnection from urllib.error import HTTPError from urllib.parse import urlencode from urllib.request import urlopen from django.core.servers.basehttp import WSGIServer from django.test import LiveServerTestCase, ove...
b6b114efbb19cc6873004e2a5fa79f5c2c4a34c7d29fea56b2a93c08db195bba
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, connection, connections, models, ) from django.db.backends.base.schema impor...
776056b9e82408ecb7dabbf1d9dbbca64af0aaebfac94db010c2c289c094dff0
from django.apps.registry import Apps from django.contrib.contenttypes.fields import GenericForeignKey from django.db import models from django.db.migrations.exceptions import InvalidBasesError from django.db.migrations.operations import ( AddField, AlterField, DeleteModel, RemoveField, ) from django.db.migrations....
88c6ba2617a6ad04c2193733fd0a177bc26bf606c40cbcf91fef15d7f085d1a9
import datetime import itertools import os import re from importlib import import_module from unittest import mock from urllib.parse import quote 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, RED...
dc495977d32f67a6b6fed77d07abb29998aed66838fcf75ea734b748871f93d7
from datetime import 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 class MockedPasswordResetTokenGenerator(PasswordResetTokenGenerator): def __init__(self, now): ...
95f17de95a798fb56b9a681e2d152548571529aafacee66ded93e05c6838fad6
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, Count, DecimalField, DurationField, F, FloatField, Func, IntegerField, Max, Min, Sum, Value, ) from django.db.models.expressions import Case, ...
dd556c3af05bc3ec7081eb54795e9cc4de49c428ce1230cafa9860e47af3ee36
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...
a51d7932630b67abb36eb413390e0ac8eab3c9d460d555eb6f20d52e04f8244e
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...
05ac31fe28f6dfd40cbfc60cb4df5a3d10e858b27eef0921bc5ae45520360e15
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...
ecd1833eda54d0a203433c5f96435df6d035fd2029965e16328693d52557a211
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.http import QueryDict from django.test import override_settings from django.test.utils import isolate_apps f...
8db49a748525234ddaa7dfb89da7cbe688c45e093aea1b7ba11d5f9c085f2228
import datetime from decimal import Decimal from django.core.exceptions import FieldDoesNotExist, FieldError from django.db.models import ( BooleanField, CharField, Count, DateTimeField, ExpressionWrapper, F, Func, IntegerField, NullBooleanField, OuterRef, Q, Subquery, Sum, Value, ) from django.db.models.expre...
6082ec7b71da22f5b760d09ebecafddefbcc937cd9cd4389745dcbf91678b661
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 PeopleMore...
7c97d2d5406544b2ecffeac5eef91e078d862c6cf941c6f923114fc8f2049e3d
from django.db import models class People(models.Model): name = models.CharField(max_length=255) parent = models.ForeignKey('self', models.CASCADE) class Message(models.Model): from_field = models.ForeignKey(People, models.CASCADE, db_column='from_id') class PeopleData(models.Model): people_pk = m...
282779ba9950d17bf7900e8f1f94c91031bc575226f241bb7139be99c9d30c8a
import unittest from datetime import date, datetime, time, timedelta from decimal import Decimal from operator import attrgetter, itemgetter from uuid import UUID from django.core.exceptions import FieldError from django.db import models from django.db.models import F, Max, Min, Q, Sum, Value from django.db.models.exp...
71cf7c4a28e46bf2dd8c71263399ffae88a01b1d712ecaeb4b1fd4895bfe9f11
from django.db import models try: from PIL import Image except ImportError: Image = None class CaseTestModel(models.Model): integer = models.IntegerField() integer2 = models.IntegerField(null=True) string = models.CharField(max_length=100, default='') big_integer = models.BigIntegerField(nul...
98af1137160475ff988dffa03ff609b373400c56ebbdfe23bd2e93c16e45c409
""" Testing signals emitted on changing m2m relations. """ from django.db import models from django.test import TestCase from .models import Car, Part, Person, SportsCar class ManyToManySignalsTest(TestCase): @classmethod def setUpTestData(cls): cls.vw = Car.objects.create(name='VW') cls.bmw...
ebed766386ea9b9d7d13661b735c8e4e4d34f9f0a5849abb71795d8d7f954961
from django.apps import apps from django.db import models from django.test import SimpleTestCase, override_settings from django.test.utils import isolate_lru_cache class FieldDeconstructionTests(SimpleTestCase): """ Tests the deconstruct() method on all core fields. """ def test_name(self): "...
436ec0c085517542c9958b7350f9abcf7ea089ad5f98caa1b499302307dedec4
# 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...
f790300ecdb0f91ad5fab4d7768c73c2ce49dc774413d48170d1dfde95da4a4b
from datetime import date, datetime from django.test import SimpleTestCase, override_settings from django.test.utils import TZ_SUPPORT, requires_tz_support from django.utils import dateformat, translation from django.utils.dateformat import format from django.utils.timezone import ( get_default_timezone, get_fixed...
6ba471f7e288f2020e7c614927800ed7d3fd357ee0898b374febaaafcd592e28
""" A test spanning all the capabilities of all the serializers. This class defines sample data and a dynamically generated test case that is capable of testing the capabilities of the serializers. This includes all valid data values, plus forward, backwards and self references. """ import datetime import decimal impo...
c8cd6504976c6d2981245dbefef071b2c42a38cd9c618f2fd5080baf83528c27
from unittest import mock from django.db import transaction from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from .models import ( Article, InheritedArticleA, InheritedArticleB, Publication, User, ) class ManyToManyTests(TestCase): def setUp(self): # Create a couple of Publica...
0efd26c274e609733adf95601e6bb1c171a166ab19789707b6050ffb7e8eb328
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, Exists, F, OuterRef, Q from django.db.models.sql.constants import LOUTER from dja...
7fa302b41e19d9c5a0a1953e216455779942f5e6da08f3e7daf1713770fd095c
from contextlib import contextmanager from django.core.exceptions import FieldDoesNotExist, FieldError from django.db.models.query_utils import InvalidQuery from django.test import SimpleTestCase from django.utils.deprecation import RemovedInDjango40Warning class InvalidQueryTests(SimpleTestCase): @contextmanage...
6d59d95d3057bb563755021a08cfb48ef256bf2f438fb6df6ee11e2fc805d897
from datetime import datetime from django.core.exceptions import FieldError from django.db.models import BooleanField, CharField, F, Q from django.db.models.expressions import Col, Func from django.db.models.fields.related_lookups import RelatedIsNull from django.db.models.functions import Lower from django.db.models....
a55153e22603e71fe08bb52a72366b28647b44fc39e0491ab0ff1fb35ec767b9
import datetime import uuid from decimal import Decimal from django.db import models from django.utils import timezone try: from PIL import Image except ImportError: Image = None class Country(models.Model): name = models.CharField(max_length=255) iso_two_letter = models.CharField(max_length=2) ...
f4765a1ac584883903c11db8ae5b195b2d6fae19ac1bf715490ca973fd3a8f09
import datetime from unittest import mock, skipIf, skipUnless from django.core.exceptions import FieldError from django.db import NotSupportedError, connection from django.db.models import ( F, Func, OuterRef, Q, RowRange, Subquery, Value, ValueRange, Window, WindowFrame, ) from django.db.models.aggregates imp...
0c823799b962277bb08101a3e485c260df64fffe94c409e2a56831caa8967245
from math import ceil from django.db import IntegrityError, connection, models from django.db.models.deletion import Collector, RestrictedError from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from .models import ( B1, B2, MR...
97563b6e7036eff429e472ccbb7217f947c4ff85141345680dbb2502961ef6bd
from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.db import models class P(models.Model): pass class R(models.Model): is_default = models.BooleanField(default=False) p = models.ForeignKey(P, m...
37bd63da4143c5cd339453f1a5643b1ccd161b43be2a2612567a3df70d32bc58
import unittest from django.core.checks import Error, Warning as DjangoWarning from django.db import connection, models from django.test import SimpleTestCase, TestCase, skipIfDBFeature from django.test.utils import isolate_apps, override_settings from django.utils.functional import lazy from django.utils.timezone imp...
d3f8aac2df38c6312bfc578842fc9f8d6d454fad801953e8b9166e4034c41ee0
from datetime import date from decimal import Decimal from django.core.exceptions import FieldDoesNotExist from django.db.models.query import RawQuerySet from django.test import TestCase, skipUnlessDBFeature from .models import ( Author, Book, BookFkAsPk, Coffee, FriendlyAuthor, MixedCaseIDColumn, Reviewer, )...
d5d94f4ce7b4777ac73a606721383043f51434deca2d7d5ab6a304750db86dbd
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, PositiveBigIntegerModel, PositiveIntegerModel, Po...
2a4a752c6909e37fe737ab119c76f5a9a6889742e933e8c70e137a74b6cab226
import datetime from decimal import Decimal from django.db.models.fields import ( AutoField, BinaryField, BooleanField, CharField, DateField, DateTimeField, DecimalField, EmailField, FilePathField, FloatField, GenericIPAddressField, IntegerField, IPAddressField, NullBooleanField, PositiveBigIntegerField, ...
1ca1cf35fdc86f2d5b65a9243c07ff6fe1403a886040b90b2f473df5a7b54396
import os import tempfile import uuid from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.core.files.storage import FileSystemStorage from django.db import models from django.db.models.fields.files import Imag...