hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
f97355059af0eecd96ef38d469151420a582f60c8987b58ec4e4582df1205637 | import os
import re
from django.contrib.gis.db.models import Extent3D, Union
from django.contrib.gis.db.models.functions import (
AsGeoJSON, AsKML, Length, Perimeter, Scale, Translate,
)
from django.contrib.gis.geos import GEOSGeometry, LineString, Point, Polygon
from django.test import TestCase, skipUnlessDBFeatu... |
1378f1ec0cf45ed911b83de8a99e1ed9a5cab7224e2eac3c599cf4d8dbdaf620 | import ctypes
import itertools
import json
import pickle
import random
from binascii import a2b_hex
from io import BytesIO
from unittest import mock, skipIf
from django.contrib.gis import gdal
from django.contrib.gis.geos import (
GeometryCollection, GEOSException, GEOSGeometry, LinearRing, LineString,
MultiLi... |
5013e65f742b6b5a191dbcda966b8805652d10a59eb0cb0599ebed1b5b77fc19 | import os
import shutil
import struct
import tempfile
from django.contrib.gis.gdal import GDAL_VERSION, GDALRaster
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.raster.band import GDALBand
from django.contrib.gis.shortcuts import numpy
from django.test import SimpleTestCase
from... |
ec2916aaf09a605f0e1055d7e29c4904d0c1bebc4c640dfcc9f9902c60c45d37 | from unittest import skipIf
from django.contrib.gis.gdal import (
GDAL_VERSION, AxisOrder, CoordTransform, GDALException, SpatialReference,
SRSException,
)
from django.contrib.gis.geos import GEOSGeometry
from django.test import SimpleTestCase
class TestSRS:
def __init__(self, wkt, **kwargs):
sel... |
3a397edaededb03610ab99975bb08d9b8326f832a785970ecd6bc15e1e03f6a6 | 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,
... |
3bb1a58ab7c1e135c5faf8c0e285f374428896f91ab2a2609d3297df0a4105ea | 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... |
ab82ff2d50b1d64fd5f679a73fb0ab4270bbb2eb3b4131f7ac600e6d250b96c1 | from django.db import InterfaceError
from django.db.backends.base.features import BaseDatabaseFeatures
class DatabaseFeatures(BaseDatabaseFeatures):
interprets_empty_strings_as_nulls = True
has_select_for_update = True
has_select_for_update_nowait = True
has_select_for_update_skip_locked = True
ha... |
e4339722dd3de4a485a162b136ef89376c1332aee438611718d8056f088fd826 | """
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 Integ... |
e7ee865647105d4043ab6b88a09e9f9bf249fac4a7c933c1002cc2aea2e7c8c5 | from django.db 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 distinguish be... |
29c12907fa6b382cf18b51489a6249f8e051bcb31a007a7910d70ae7924ac8f6 | import operator
from django.db import InterfaceError
from django.db.backends.base.features import BaseDatabaseFeatures
from django.utils.functional import cached_property
class DatabaseFeatures(BaseDatabaseFeatures):
allows_group_by_selected_pks = True
can_return_columns_from_insert = True
can_return_row... |
866027d1df444091a519f7c36447587894143e55248499bf2719f67527ee54fd | import json
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
__all__ = ['JSONField']
class InvalidJSONInput(str):
pass
class JSONString(str):
pass
class JSONField(forms.CharField):
default_error_messages = {
'i... |
5262e3306585081b4f8d96dfaaf636014c263b7d799227d278d9f27d81c59873 | import datetime
from unittest import mock
from django.db import IntegrityError, connection, transaction
from django.db.models import CheckConstraint, Deferrable, F, Func, Q
from django.utils import timezone
from . import PostgreSQLTestCase
from .models import HotelReservation, RangesModel, Room
try:
from django.... |
eb858d86f223f283078972f0254a87f7a144f524d5fe7f718bc38978f7c0ce04 | """
Various complex queries that have been problematic in the past.
"""
import threading
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):
... |
1b644688c96221d9d247994d816140d2ddfd10ae0dbfb9f32f42723be3e7d423 | import unittest
from django.core.checks import Error, Warning
from django.core.checks.model_checks import _check_lazy_references
from django.db import connection, connections, models
from django.db.models.functions import Lower
from django.db.models.signals import post_init
from django.test import SimpleTestCase, Test... |
3b2de3f204d8cd1c33f8986f8837d9c594c134fb673ac3e816ce87649444cf06 | import gettext
import os
import re
from datetime import datetime, timedelta
from importlib import import_module
import pytz
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import widgets
from django.contrib.admin.tests import AdminSeleniumTestCase
f... |
560a5259ac8ac21b6e12aae57ad7ec29ab758d76ef24214446a287604003d1a0 | 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 OrderBy, Random, RawSQL,... |
a9c6028b6364a799c60321caf83034f36128bf0d4c1623ef5d665e7b8aa226d6 | import collections
from itertools import chain
from django.apps import apps
from django.conf import settings
from django.contrib.admin.utils import (
NotRelationField, flatten, get_fields_from_path,
)
from django.core import checks
from django.core.exceptions import FieldDoesNotExist
from django.db import models
f... |
502871eea2c2d732f8345a2a67521330ff0f2a1e6c833612c067f810f58cb4ee | from datetime import datetime
from functools import partialmethod
from io import StringIO
from unittest import mock, skipIf
from django.core import serializers
from django.core.serializers import SerializerDoesNotExist
from django.core.serializers.base import ProgressBar
from django.db import connection, transaction
f... |
0b02be014b03a628884f681e3cf4fe822ee53f643c106f4dbd7a723af2fc316d | from django import forms
from django.contrib import admin
from django.contrib.admin import AdminSite
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.middleware import AuthenticationMiddleware
from django.contrib.contenttypes.admin import GenericStackedInline
from django.contrib.messages.m... |
eadd429da97b2fcb31478fb3cef20e99307287d98237c56276d4a954565a34c5 | 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 asgiref.sync import sync_to_async
from django.conf im... |
db0312b9ac794909a88ec8e890af4f1b586a2a84a68cea4c537ef1da5c9171e1 | import html.entities
import re
import unicodedata
import warnings
from gzip import GzipFile
from io import BytesIO
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.functional import SimpleLazyObject, keep_lazy_text, lazy
from django.utils.regex_helper import _lazy_re_compile
from django.... |
0fedeffbc1dfa86409ea710df4af44a29a41974f393626cc768dd5610bbfe0ca | """Translation helper functions."""
import functools
import gettext as gettext_module
import os
import re
import sys
import warnings
from asgiref.local import Local
from django.apps import apps
from django.conf import settings
from django.conf.locale import LANG_INFO
from django.core.exceptions import AppRegistryNotR... |
bda999342dee11aa8066ead0edadabd2d3547f76262bb8795bc4fe118f643c92 | 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 ... |
1f9e903ec3e772c2635afd3b18cbce966b4e5d971363d3c558006aa15f3b22e4 | 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 ... |
e01ba15a49a50907a554ea28f60a37b4f87871b2b0e01af3bad128e883c76398 | 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):
... |
6d3b5835fa6fa0b74687a5dd9f8d5849d3b55f37230c054d3a3dd4dd9b7d63a3 | from django.db import models
from django.db.migrations.operations.base import Operation
from django.db.migrations.state import ModelState
from django.db.models.options import normalize_together
from django.utils.functional import cached_property
from .fields import (
AddField, AlterField, FieldOperation, RemoveFie... |
fabe9ce10ec2202053f79ef81fbddd479a6ff7812ab28cd2e4fd9a357f15c939 | from django.db import router
class Operation:
"""
Base class for migration operations.
It's responsible for both mutating the in-memory model state
(see db/migrations/state.py) to represent what it performs, as well
as actually performing it against a live database.
Note that some operations... |
515352d3814761b8fcf9ed802bb46dfbe967999cebd4eb0784db16f321cd56c8 | from django.core.exceptions import FieldDoesNotExist
from django.db.models import NOT_PROVIDED
from django.utils.functional import cached_property
from .base import Operation
from .utils import field_is_referenced, field_references, get_references
class FieldOperation(Operation):
def __init__(self, model_name, n... |
b65ed53afd6ba0ba11380ba994b0c128877ff10bb50cfce701aa5fdd1209fcec | 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... |
4c69d61d39abb5fa8ac8890a53613fa5f6310057077122fa566fe11b3419a2a9 | import asyncio
import logging
import types
from asgiref.sync import async_to_sync, sync_to_async
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, MiddlewareNotUsed
from django.core.signals import request_finished
from django.db import connections, transaction
from django.urls ... |
4dcb8c2c69ccf3dde9e71d73b024f90148bf8da5e44429ab01539ba12d4181c1 | from django.contrib.postgres.signals import (
get_citext_oids, get_hstore_oids, register_type_handlers,
)
from django.db import NotSupportedError, router
from django.db.migrations import AddIndex, RemoveIndex
from django.db.migrations.operations.base import Operation
class CreateExtension(Operation):
reversib... |
63a27e0500b8373a2c998597a110029846d6fb28f937f4ed46193e18cbf8527b | import re
from datetime import date, datetime
from decimal import Decimal
from django import template
from django.template import defaultfilters
from django.utils.formats import number_format
from django.utils.safestring import mark_safe
from django.utils.timezone import is_aware, utc
from django.utils.translation imp... |
1dd5ae0fb49ff72bbb7336142bf10df8052a329814aeb6c57e635277559f38e7 | 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... |
d41c9b067529a9271621f5c305da9af2fdcdd40d8c7511c97cc641f567eb974e | from django.core.exceptions import FieldDoesNotExist
from django.db import (
IntegrityError, connection, migrations, models, transaction,
)
from django.db.migrations.migration import Migration
from django.db.migrations.operations.fields import FieldOperation
from django.db.migrations.state import ModelState, Projec... |
78902087de64f01634ed47b3b95e5b883aa6e0c6448af38924c90033826a8c90 | 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... |
20db99a436b03af1af37639143e978d145a973d810f88161102f3a121b280f41 | 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... |
b9b45737f892caa68736110a43b939d39676e6a18a068c418cb6acd6e34149dd | from django.contrib import admin
from django.contrib.admin.tests import AdminSeleniumTestCase
from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from django.urls import path, reverse
class AdminSiteWithSidebar(admin.AdminSite):
pass
class AdminSiteWithoutSidebar(admi... |
1e42852cfb5f9cccc56cdafea23041438e6e07ee207df08243c899db3226155b | import unittest
from migrations.test_base import OperationTestBase
from django.db import NotSupportedError, connection
from django.db.migrations.state import ProjectState
from django.db.models import Index
from django.test import modify_settings, override_settings
from django.test.utils import CaptureQueriesContext
... |
cfef469e0140fbb06c55181ea393726232ea5dde49675d7f96a55650aff63be3 | 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.models import (
BinaryField, BooleanField, Case, CharField, Count, DurationField, F,
Ge... |
e07b09d88f039daf72b90d01ba3c19810cc3b2f3abd3a5c5d1beeb38023bcd7b | import json
import sys
from django.test import SimpleTestCase, ignore_warnings
from django.utils import text
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.functional import lazystr
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy, override
I... |
f77b90e92c8a3e2d81ca933fcc9fd5c04dee5680eacb3a83620ef099fa4e7323 | import operator
from django.db import DatabaseError, NotSupportedError, connection
from django.db.models import Exists, F, IntegerField, OuterRef, Value
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from .models import Number, ReservedName
@skipUnlessDBFeature('supports_select_union')
class... |
eb1e281162da237a4ead093e726e0496e7e0ba23b1ea12abaef9fc7f2f425b9a | """
Testing using the Test Client
The test client is a class that can act like a simple
browser for testing purposes.
It allows the user to compose GET and POST requests, and
obtain the response that the server gave to those requests.
The server Response objects are annotated with the details
of the contexts and temp... |
9af324dfa1c4219a8ab1413ea90f53f01e1ae9e741bb1c8939e6a649ec4bf7e0 | from django.contrib.auth import views as auth_views
from django.urls import path
from django.views.generic import RedirectView
from . import views
urlpatterns = [
path('upload_view/', views.upload_view, name='upload_view'),
path('get_view/', views.get_view, name='get_view'),
path('post_view/', views.post_... |
1560df14ae745fa227b1e793a7a4368c1c0a1cd24530ce2b911d31381281b138 | import json
from urllib.parse import urlencode
from xml.dom.minidom import parseString
from django.contrib.auth.decorators import login_required, permission_required
from django.core import mail
from django.core.exceptions import ValidationError
from django.forms import fields
from django.forms.forms import Form
from ... |
c96d14a70633aa1d42bc5f9aab9be51768b981b1c9c70292c5922fd10a279d18 | 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... |
cc52c3a0b1474fda90452baf43c40b87329b566f7da071145270b4ff3b3680d8 | import gettext
import os
import re
from datetime import datetime, timedelta
from importlib import import_module
import pytz
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import widgets
from django.contrib.admin.tests import AdminSeleniumTestCase
f... |
79e97b54a4b89b74e12152fc2c8fd17d1afc1d83e4ef005d3e9b803008282122 | from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms import ClearableFileInput, MultiWidget
from .base import WidgetTest
class FakeFieldFile:
"""
Quacks like a FieldFile (has a .url and string representation), but
doesn't require us to care about storages etc.
"""
url =... |
054e3a24c9e7f2f41c6060fa9f1f1f17ac508edaa8ae61d932f69c759a87e335 | from django.apps import AppConfig
class LoadingAppConfig(AppConfig):
name = 'loading_app'
|
b0e45c9bb3ebfe1046e247d9602f03a7ba423f6a3e0928e904a26696e5918db5 | import datetime
import decimal
import unicodedata
from importlib import import_module
from django.conf import settings
from django.utils import dateformat, datetime_safe, numberformat
from django.utils.functional import lazy
from django.utils.translation import (
check_for_language, get_language, to_locale,
)
# f... |
5af0693e5f942eaf51903638e29be5b286931bb317b4e87a46d680f8ccda060d | import cgi
import codecs
import copy
import warnings
from io import BytesIO
from itertools import chain
from urllib.parse import quote, urlencode, urljoin, urlsplit
from django.conf import settings
from django.core import signing
from django.core.exceptions import (
DisallowedHost, ImproperlyConfigured, RequestDat... |
43f9c6f84a7ae172aebbfa62052ec1229a8261162fc5eda586afdcccd2f0af64 | 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)... |
b6078e4e5417d8212d29b80fed014c0d4fed444030101e89742e6032430e8c0d | 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... |
5318a56a920387cc7d2b67037067a7ea6bf642a2c7df148e488f30e26004d3a0 | 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 ... |
7002f9caf357dacb8e5645cb4596e4851daba35368dcb0c0bce1e800968efc05 | 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... |
b881e152b7d54c3d86b1effce6bfda37d16e4862151018941d7d8c049c06a19d | from django.db import InterfaceError
from django.db.backends.base.features import BaseDatabaseFeatures
from django.utils.functional import cached_property
class DatabaseFeatures(BaseDatabaseFeatures):
interprets_empty_strings_as_nulls = True
has_select_for_update = True
has_select_for_update_nowait = True... |
6a6ecc7d18c110f9b91e108d3bd49cbdd11fc9f6d2701a690e330c5ecd4522b6 | from django.db 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 distinguish be... |
eef907958a225315b9bebe98e0601ef860aa98ab5918d151f1ef8cf37541c664 | 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... |
901e76b44fc6563993e91d15bb058e734a81ec2cf9b779d47b8a9745f1bc02d1 | 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... |
73594e763190c673ec940fb454d14a92230529350e0b3f90fbf1cb5d508e64bd | import operator
from django.db import InterfaceError
from django.db.backends.base.features import BaseDatabaseFeatures
from django.utils.functional import cached_property
class DatabaseFeatures(BaseDatabaseFeatures):
allows_group_by_selected_pks = True
can_return_columns_from_insert = True
can_return_row... |
4f85c0a17aa238c9677cac5032316ed8cf99bc67dc2fdd92e5e2330a3704813b | 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... |
fe9ff0ec11e72b27584c9f5d02b706fb8fc95582ec3db6f25d954b8d86678f73 | import operator
from django.db import transaction
from django.db.backends.base.features import BaseDatabaseFeatures
from django.db.utils import OperationalError
from django.utils.functional import cached_property
from .base import Database
class DatabaseFeatures(BaseDatabaseFeatures):
# SQLite can read from a c... |
f23f7b1574369934cd84e41c16196fc459283178809f87b3aaa378b78e18dc6e | import inspect
import types
from collections import defaultdict
from itertools import chain
from django.apps import apps
from django.conf import settings
from django.core.checks import Error, Tags, Warning, register
@register(Tags.models)
def check_all_models(app_configs=None, **kwargs):
db_table_models = defaul... |
bb0bdd7f460348689300928b3a60fd6ca5c7dc3503fecf797e6cbd05cde7a2a6 | from django.apps import apps
from django.db import models
def sql_flush(style, connection, reset_sequences=True, allow_cascade=False):
"""
Return a list of the SQL statements used to flush the database.
"""
tables = connection.introspection.django_table_names(only_existing=True, include_views=False)
... |
7636c4ef5f8fdcf7b95b40b5ab8c0170a78a893c195ef3b40410005590d7b179 | """
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... |
00bb9b643cf33a5c517f3b3106dfb76032e40c11181e57dfec304b884a4dd06a | from importlib import import_module
from django.apps import apps
from django.core.management.base import BaseCommand, CommandError
from django.core.management.color import no_style
from django.core.management.sql import emit_post_migrate_signal, sql_flush
from django.db import DEFAULT_DB_ALIAS, connections
class Com... |
48a464937317ba8ef373ca285a1c4164b74b252843f95cda4c9886067e4053a4 | from django.core.management.base import BaseCommand
from django.core.management.sql import sql_flush
from django.db import DEFAULT_DB_ALIAS, connections
class Command(BaseCommand):
help = (
"Returns a list of the SQL statements required to return all tables in "
"the database to the state they wer... |
7e45da34a5e1fc0d2a32a59f8b82b5515eb048d688a7c149716b374771602fbe | import keyword
import re
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS, connections
from django.db.models.constants import LOOKUP_SEP
class Command(BaseCommand):
help = "Introspects the database tables in the given database and outputs a Django model mod... |
0168547a42e5932f86030e210b9cc604a93dce85dc91fb8bcdbf85bc505aa922 | "Memcached cache backend"
import pickle
import re
import time
from django.core.cache.backends.base import (
DEFAULT_TIMEOUT, BaseCache, InvalidCacheKey, memcache_key_warnings,
)
from django.utils.functional import cached_property
class BaseMemcachedCache(BaseCache):
def __init__(self, server, params, librar... |
9c22c151885f3018d062e553d907d4db5b581117be2f405f1d25009d703a93c5 | "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
class InvalidCacheKey(ValueError):
pass
... |
dc7d770813f5a88431ad477ec841dad6cd4fa8198bce3f36b6580aad2cbf0d3a | from django.db import NotSupportedError
from django.db.models import Index
from django.utils.functional import cached_property
__all__ = [
'BloomIndex', 'BrinIndex', 'BTreeIndex', 'GinIndex', 'GistIndex',
'HashIndex', 'SpGistIndex',
]
class PostgresIndex(Index):
@cached_property
def max_name_length(... |
fe90cd2f334791a117629869cbea7cc63cc30c76f4694e405c158141da8f01d1 | """
Form Widget classes specific to the Django admin site.
"""
import copy
import json
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator
from django.db.models import CASCADE
from django.urls import reverse
from d... |
f420644d080f25acff64c46c1c36db4b37bafc625873ebaba79e8aa8764dfd0b | from django.db.backends.ddl_references import Statement
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
class PostGISSchemaEditor(DatabaseSchemaEditor):
geom_index_type = 'GIST'
geom_index_ops_nd = 'GIST_GEOMETRY_OPS_ND'
rast_index_wrapper = 'ST_ConvexHull(%s)'
sql_alter_column_... |
ee0904c3431e5e461fae8d63aeb72250255472098d67d2d9d0b0f9eb40a16239 | from django.core.exceptions import FieldDoesNotExist
from django.db import (
IntegrityError, connection, migrations, models, transaction,
)
from django.db.migrations.migration import Migration
from django.db.migrations.operations.fields import FieldOperation
from django.db.migrations.state import ModelState, Projec... |
00acb90c7b077ad09069ade6eff4f61443cef26ed701d385bef317e5dc3a4b58 | from unittest import mock
from django.contrib.postgres.indexes import (
BloomIndex, BrinIndex, BTreeIndex, GinIndex, GistIndex, HashIndex,
SpGistIndex,
)
from django.db import NotSupportedError, connection
from django.db.models import CharField, Q
from django.db.models.functions import Length
from django.test ... |
41da4f5d9c50eef7363d589ec4d3be921ff8ca819e7d02e4b892981b7a7062cb | 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... |
e83ba97e184f4bd4c884510b626f2bdbb12ad46ef23e970da3716f4b23988570 | # 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... |
0c7fba4955b9b3acc5b9219e26ae3e8cded1d1f8cf9d3a4f851120987d058fe3 | import json
import sys
from django.test import SimpleTestCase, ignore_warnings
from django.utils import text
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.functional import lazystr
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy, override
I... |
7770333ccc7192c682384f622c4f5953e2c8775b2df7d0cc1ddf21aa42564b93 | 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... |
3b8cca780371f1292ae1da2443222ca47a4cdf3e5fc140317ff715160bb76da6 | import datetime
from unittest import skipIf, skipUnless
from django.db import connection
from django.db.models import CASCADE, ForeignKey, Index, Q
from django.test import (
TestCase, TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature,
)
from django.test.utils import override_settings
from django.utils impo... |
0634efaa2d1dee1883455c62d7b8124ebae61ce3d3ab96a935fd123484607c7a | 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... |
4d7f50ed964c245275f6802b7a40e1e0d22a3824f8f75717f49de29b7b0386cf | from django.core import checks
from django.core.checks import Error, Warning
from django.db import models
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.test.utils import (
isolate_apps, modify_settings, override_settings, override_system_checks,
)
class EmptyRouter:
pass
... |
2b6e4caa4c08aaabe3a62fdfc7d8c94c782b392d0dc91709ccabee9a1a29e82f | import unittest
from django.core.checks import Error, Warning
from django.core.checks.model_checks import _check_lazy_references
from django.db import connection, connections, models
from django.db.models.functions import Lower
from django.db.models.signals import post_init
from django.test import SimpleTestCase, Test... |
4148a6fa5ff921a9159f403b9a386bfd8e4efac743980f34a4d9d3038f6ed167 | 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... |
16a050fe3cd61c11727008aa4be90c72be43cf70c0e8d05adfcb017ed79442f7 | from django.db import models
class Product(models.Model):
price = models.IntegerField(null=True)
discounted_price = models.IntegerField(null=True)
class Meta:
required_db_features = {
'supports_table_check_constraints',
}
constraints = [
models.CheckConstra... |
ba11d9817a2f4f7fa77bde80a3606b4cb616eefac14d1fcfc9baff75c18915f9 | 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... |
eb023f9491e01598d7303c4622c56e22f97c2241854f870c4823814644ef2ec4 | from unittest import mock, skipUnless
from django.db import DatabaseError, connection
from django.db.models import Index
from django.test import TransactionTestCase, skipUnlessDBFeature
from .models import (
Article, ArticleReporter, CheckConstraintModel, City, Comment, Country,
District, Reporter,
)
class ... |
2409edee98b2d8842c8bd0adc775d126ba349c2b6704ac0b4dee3314770f7100 | 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... |
58e8994ea0da05250d7c49e24f8861830468fa3f8748ee6e501b0735848e4f9d | import gettext
import os
import re
from datetime import datetime, timedelta
from importlib import import_module
import pytz
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin import widgets
from django.contrib.admin.tests import AdminSeleniumTestCase
f... |
01a7529393004f3fdd5d06b88f845890d5f4fbf6e9a78f4e8d7d40a6664136b1 | import uuid
from django.contrib.auth.models import User
from django.db import models
class MyFileField(models.FileField):
pass
class Member(models.Model):
name = models.CharField(max_length=100)
birthdate = models.DateTimeField(blank=True, null=True)
gender = models.CharField(max_length=1, blank=Tr... |
b7f5bdb9d3cfd6332871d33a7eda5f0eb3acad1d6af032b479fc831445d1e5df | """
Sphinx plugins for Django documentation.
"""
import json
import os
import re
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.statemachine import ViewList
from sphinx import addnodes
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.directives.code import CodeBlo... |
99bcbf4e236808da253072e8057cc900e57ccc1da66bee78c765eebc7fb7bece | """
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... |
21ab8cf9d503a75cd4d027fc21cd578e04576f86b660b45a10057c02b23835e4 | 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... |
cdaf5cc7e8c32ade7a70f039ce5d3a8890447d1ee1fd699014783be9bd3f778e | 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 ... |
698c8f5c4dde73670f74b9d121fb52c45a294be1862f155ee1134afbe4eb8ca5 | 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... |
5c4091a74d36a3484ac45c63170b87cb4dd85064c9309ae7bf02275cf1e9cbfc | import os
import sys
import warnings
from itertools import takewhile
from django.apps import apps
from django.conf import settings
from django.core.management.base import (
BaseCommand, CommandError, no_translations,
)
from django.db import DEFAULT_DB_ALIAS, OperationalError, connections, router
from django.db.mig... |
d377955cb063d22c3be0c264ade35fd44e387d48b26376252e590fceacb7d2df | "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
class InvalidCacheKey(ValueError):
pass
... |
1b8d15469af91d4fadfcc08620c62b4207d7b8f84e886b2f29e8aa2f4ea2b995 | 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... |
18d324f8ab698e7196b5e51a4cc75bf52c463e7c9a3875f31350a77a210a29cf | 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... |
fefe73a6c55ff92c579276412092cc572e8321587d5182463252fc77b31dcd9e | # 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... |
693f90a190631332b7df954e08a53248727903fd0e68cd18a05381682525db3a | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.