hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
304cd03c9b1f5b084e4800cd1c03c79dbaa8a9f7807ad56b093a6393d92ae36b | 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... |
e2913c65d7e9b4710b15d6c5b5bf4f9f83da8d7451e1003a27c6bbcb20ad7026 | """
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... |
c626c321afb9b963d0e24dde3066b16f32a5cf1a3dc01468e097a1ae529cf377 | from django.db.backends.base.introspection import (
BaseDatabaseIntrospection, FieldInfo, TableInfo,
)
from django.db.models.indexes import Index
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type codes to Django Field types.
data_types_reverse = {
16: 'BooleanField',
17: ... |
ea8a899981c35e2525c2b05deaa9670f93b9055d61d58c3ca799a51c672ebacc | 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.... |
eafd02a13af4933e801a5381a1bc0d284752acdfd6f00aa980753b16d2c1e91e | import datetime
from copy import deepcopy
from django.core.exceptions import FieldError, MultipleObjectsReturned
from django.db import models, transaction
from django.db.utils import IntegrityError
from django.test import TestCase
from django.utils.translation import gettext_lazy
from .models import (
Article, Ca... |
550f6b336fb5ba830d0b2295dffffd62d6f4cf606e08217403462a9a71a41b9b | 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... |
74fac5589f87d71226cb019330b539ab5cd5b8ef765f6198dae1a6856dbbb252 | 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... |
99fce6dd464d278016fff781301f323b5fcfb2cde0f727a22a9c5820ba4d21a3 | 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, City, Comment, District, Reporter
class IntrospectionTest... |
865506fd3f46e1100703a01781a1c13e404d1076419b31b7029b3832b70182dc | 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... |
217ae33d34cf42aff82121ea8e23a8cfc935c53ac9bbadf92dfe4932c041bf1a | #!/usr/bin/env python
import argparse
import atexit
import copy
import os
import shutil
import socket
import subprocess
import sys
import tempfile
import warnings
try:
import django
except ImportError as e:
raise RuntimeError(
'Django module not found, reference tests/README.rst for instructions.'
... |
dd06f455544662ac2a045fa487faf5119d713b3b8f7a796a5469ed86bae1758b | """
Default Django settings. Override these with settings in the module pointed to
by the DJANGO_SETTINGS_MODULE environment variable.
"""
# This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module depends on the settings.
def gettext_noop(s):
return s
####... |
45b10255299a64d64621de6a9f6c474fea5d461df03f5e456f58bfea8d48efb2 | 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)... |
286e620d9cbe13f81f744e96553d0c5b96dd0b0ac5f70962f467ec5dec240c0a | 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,
... |
01e885b057c6e941fd42625433a9468305593b0cb4c9c7e9403445f80b21084e | 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... |
1ea54d91a4547cb4892ce313a02b7b668b949b5e3a9c5b7a8200a01d53e2bcf4 | import itertools
import math
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, DateTimeField, Field, IntegerField,
)
from django.db.models.query_utils import RegisterLo... |
de3d8c8ab7a21266e52e207dccf3413d5f6d56c577773827520436f4fdb5401e | 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... |
3edd9b2633b5c4d23b5a0af6a07cee0618161b72b7c9f14ba853b153dafd8199 | """
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 ... |
90794505f1a26855943f3bab3c5a49d6737bb073d6219cbc9dac2da75af88bde | 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.models.expressions import Exists, ExpressionWrapper
from django.db... |
073c579342c5827d4cbe7b0bdc2ae84037168f92349c1b1a61b16efee38fd9ac | 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:
... |
cb9f1e1713674aecfbe7c250192002819f28a799b827dfc12950020a9c8f815d | 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... |
00b271ef42bf50c6c7335d2a4211fe1ffd766471a0c3729311a87e836024dde6 | 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... |
9af2cf156c9221826bd9d310c52f9dde7d0db70379e84afcf183a024cf32633f | """
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... |
832d973bb5244d33c113a7cfb4a3967d35c1c8b20b56fe4b981cdf3e96545142 | 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_... |
05a8c42062d18a13648d6a9c9675682f48fc982834d3bfcffd9a511b83ab02db | 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... |
63a25a97225570b1e230ecf6e16c71aea9806d1d72a14bd5e721a9ae0be80f69 | import inspect
import warnings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.db.models import Exists, OuterRef, Q
from django.utils.deprecation import RemovedInDjango31Warning
UserModel = get_user_model()
class BaseBackend:
def authenticate(self, re... |
3108975a2aa9dc993191e5736b8cc4f203cbfb56e0e16657b126e762c0a4bad6 | 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.... |
580710f5b180c503de0abb2803dd08492fcf7d97943b9af0b82888f6f09cf538 | 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 ... |
7bd1b6953bcfc0a35238674d67c0be2ba05fc5e218771e27d9c86173335192cd | 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... |
47047fe388ea05d958f2683536296d868ad975119f4f3e94acb81524a249753d | # 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 unittest import mock
from django.conf import settings
from django.core import manageme... |
320e997f4e879c24c91aed1e6f80d6d6a5b25bddcd4a53bbfa49ddeca2e8e8f7 | import contextlib
import os
import py_compile
import shutil
import sys
import tempfile
import threading
import time
import types
import weakref
import zipfile
from importlib import import_module
from pathlib import Path
from subprocess import CompletedProcess
from unittest import mock, skip, skipIf
from django.apps.re... |
2026bc8b81e71cf8cda7eab0299e2902e0c95b2cb8b676617b05cc3d76678b2c | import threading
from datetime import datetime, timedelta
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections, models
from django.db.models.manager import BaseManager
from django.db.models.query import MAX_GET_RESULTS, EmptyQ... |
6bbd0ce7034b30624569a01791e4951e6c198683763f106c6c65ece97f91261c | 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... |
39d43a7177bc8c2e345ce88fc810f35940023159826fcd237d2cf119d7f4c3a8 | import os
import shutil
import tempfile
from django import conf
from django.test import SimpleTestCase
from django.test.utils import extend_sys_path
class TestStartProjectSettings(SimpleTestCase):
def setUp(self):
self.temp_dir = tempfile.TemporaryDirectory()
self.addCleanup(self.temp_dir.cleanup... |
0a32379701646fd3ec6b42a9a1a35a80826c6d935eafd8fc0eff55a2db06f6a6 | 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... |
55de5aa4264c88d2ddfe996ae47dccb743053adb351f26a799028176f1467de8 | 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, ... |
fd3d0e42b502ecf6e6f60083904c9730c352c00b0e8d7e8c15d183dcb6440afd | 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... |
228b556cf81cbc726f6954414f17e67e018ed83760b6da75ce88b19c861eed4d | from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import Prefetch, QuerySet
from django.db.models.query import get_prefetcher, prefetch_related_objects
from django.test import TestCase, override_setting... |
44710cd3df9b66a18510373adb061ccfa147e7fbaf6836e75d21d8986fcb1171 | 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... |
ae307596924bc9f1f5391ce147afecf7b73277ed86926926d5d2220d3931a3a7 | 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... |
74a1159d8a670134d715986010f895d8ceaa19711ff16f1129e7816ccc4fc9a0 | import base64
import calendar
import datetime
import re
import unicodedata
import warnings
from binascii import Error as BinasciiError
from email.utils import formatdate
from urllib.parse import (
ParseResult, SplitResult, _coerce_args, _splitnetloc, _splitparams, quote,
quote_plus, scheme_chars, unquote, unquo... |
54beb217c526d0f2443899ee91b453d5533dbefe3361a29bf610286764cc5d10 | 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... |
0b6212e928e2c854704b12d4cca0f01110b0b916a61b18721fd5caf880f9ec58 | """
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 ... |
59776b6b3a72e757a8c1aa0048ca8f300cedde93f394f53607800edb98827246 | 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,
... |
f1c1152b667fd345192eff09abfae913fca370aa96a2fbe2bf3f7bd6fed1b8e7 | 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,... |
ac110bc900a4174026f30f40206be0fba6f4cca2651286f90b0cbee2af189620 | import builtins
import collections.abc
import datetime
import decimal
import enum
import functools
import math
import re
import types
import uuid
from django.conf import SettingsReference
from django.db import models
from django.db.migrations.operations.base import Operation
from django.db.migrations.utils import COMP... |
0fd97ae46edbd7b4aa1ba7fccf8daa7316a2cbdd6114ef6b226a1b4119541b8f | 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
... |
457fc7bfbccc1642a2c0d9b3575666e47e3b6c2d07f608e950feaff9297a2642 | import datetime
import decimal
import enum
import functools
import math
import os
import re
import uuid
from unittest import mock
import custom_migration_operations.more_operations
import custom_migration_operations.operations
from django import get_version
from django.conf import SettingsReference, settings
from dja... |
8cee7559503345044dac289477ada918d32bfbebd0eb4d8f92e8762c45ce42f1 | 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... |
9d689d3e7bcad74c0358d8c7067eb1908b98d768427493b005b87aef1cb2dc3c | """
Settings and configuration for Django.
Read values from the module specified by the DJANGO_SETTINGS_MODULE environment
variable, and then from django.conf.global_settings; see the global_settings.py
for a list of all possible variables.
"""
import importlib
import os
import time
from pathlib import Path
from dja... |
b5be279119b6ddbc8d44dcaad09654b83caa60e1c14646223d19abfb52013173 | """
Default Django settings. Override these with settings in the module pointed to
by the DJANGO_SETTINGS_MODULE environment variable.
"""
# This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module depends on the settings.
def gettext_noop(s):
return s
####... |
95bf182abea6ecbca6c4c2a13c9330d821788e0e23e626e80864f373335af9d3 | import collections.abc
import inspect
import warnings
from math import ceil
from django.utils.functional import cached_property
from django.utils.inspect import method_has_no_args
from django.utils.translation import gettext_lazy as _
class UnorderedObjectListWarning(RuntimeWarning):
pass
class InvalidPage(Exc... |
c37140686c80cfc5b271f9e2488c8dea8da75f51550014a2ba7f074c520d1d25 | 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)... |
47267b4f7aab90b69a241f022087d9d95c79f763eec29b522ae9cc46ad370ddd | """
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 (
... |
111e383cb9ddc3de6c1fac1c9eac343f59f72519ad411b86806ef303da707961 | 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,
... |
0d520a623a54619cfc9b07c5a87fb166d0c956448ba3311a79f5bdd6e0c8d870 | 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... |
6ab41ebf6b13ac498fdbebc08e9d63e258c9b7505242701225f75922069ded36 | import collections
import re
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.db.models.query_u... |
a0d037397ef2f00f2ffaadf171121d880b1da8da32fd7f42a0014125e54596ed | 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.models.expressions import Exists, ExpressionWrapper
from django.db... |
2033ae24ef7b8151509f4f03091d132175b81d5716e121e5d92404a1a384658e | 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,
... |
a9806c113e59960c7dfbaa08b28de051d921aec86ff3a34c06184ca9995e33ca | 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... |
2e661229e275e97e3d6dbdc9e04f7e628ea50732d44df60778029195a0befbcb | 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:
... |
828c971ba3ba076c631e7ac22ef056eb1baf239ad48ae8798ce58c40379d0fa5 | 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
... |
d7e69d5554f88f14f4790e405ed9d47eaa6fd46cc7bdc1cf64767c0f59ac7af7 | import operator
from django.db.backends.base.features import BaseDatabaseFeatures
from django.db.utils import InterfaceError
from django.utils.functional import cached_property
class DatabaseFeatures(BaseDatabaseFeatures):
allows_group_by_selected_pks = True
can_return_columns_from_insert = True
can_retu... |
96398054c5eb7ea60662449531542e18dbf6f5ded24c9f0bfb563965b3ec6e2d | 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_... |
6e1f5fb5ab30d416ec4957472f7ef373c8f02e037d80b1ad426705db2eb2fc76 | import hashlib
import json
import os
import posixpath
import re
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.exceptions import ImproperlyConfigured
from django.core.files... |
8717058aed2915d3b2f796157cb4463546b81e8bc3cc3c3fa7857aed939a2177 | import datetime
from django.db import NotSupportedError, connection
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from django.test.utils import CaptureQueriesContext
from .models import DumbCategory, NonIntegerPKReturningModel, ReturningModel
@skipUnlessDBFeature('can_return_columns_from_in... |
c8285cd5162115a7ce5352f0e5a12fe04f95792d8955da5643aaec020386dde8 | 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... |
a212c10e037f9a887906de27abcf20e2ee91570fc18f5f87582254369898a44d | import warnings
from datetime import datetime
from django.core.paginator import (
EmptyPage, InvalidPage, PageNotAnInteger, Paginator,
UnorderedObjectListWarning,
)
from django.test import SimpleTestCase, TestCase
from .custom import ValidAdjacentNumsPaginator
from .models import Article
class PaginationTes... |
4bafeb7d33333b70888ff1eec2baa523b28dffeec3a9c87cae7ac569f44abeab | """
This is the Django template system.
How it works:
The Lexer.tokenize() method converts a template string (i.e., a string
containing markup with custom template tags) to tokens, which can be either
plain text (TokenType.TEXT), variables (TokenType.VAR), or block statements
(TokenType.BLOCK).
The Parser() class ta... |
dd16375bed23afdde95cb6b18adee464b9ab66355a5b0c3fab88aa98922c4d3a | """
Field classes.
"""
import copy
import datetime
import math
import operator
import os
import re
import uuid
from decimal import Decimal, DecimalException
from io import BytesIO
from urllib.parse import urlsplit, urlunsplit
from django.core import validators
from django.core.exceptions import ValidationError
from d... |
1fdb30c6c92b6e26317dad3455061adb96ccbd12552c965bf746100b52316e19 | """
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 (
... |
d8aa28af93ce03b4ce5ff9e104001cb62568800dd4127f3789b7eac3a0c036c8 | 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,
... |
054bf008bf4fb274e5057650115302f9cc1e1af4d790a9d31e7f3798c0292f53 | 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.models.expressions import Exists, ExpressionWrapper
from django.db... |
d02ff9a04e66bc8c52a37edfe556e955c79db5c7e7c326403123f3f8d8ad2b38 | 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,
... |
387fef358efe96cd6e07bf4050c995c1d933631ac12da2e89d0fe00a89c2f952 | 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
... |
e25f31adfd7dffdbf96fc0371b6d9e7e6761210bf90baa2a383089a927b5df06 | import warnings
from datetime import datetime
from django.core.paginator import (
EmptyPage, InvalidPage, PageNotAnInteger, Paginator,
UnorderedObjectListWarning,
)
from django.test import SimpleTestCase, TestCase
from .custom import ValidAdjacentNumsPaginator
from .models import Article
class PaginationTes... |
22a9b8324f87781d605b3c7573c49e705dee898c723676e79a2b73f16339ae15 | 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,
... |
06f085395df0778cfdd2d6346e2b1c1f606975253527697a31e72d90eecfbd5c | import builtins
import collections.abc
import datetime
import decimal
import enum
import functools
import math
import re
import types
import uuid
from django.conf import SettingsReference
from django.db import models
from django.db.migrations.operations.base import Operation
from django.db.migrations.utils import COMP... |
0b8888f96005d3d321411a442f946089fe3a88167ce62a851239210c7b76108c | import datetime
import decimal
import enum
import functools
import math
import os
import re
import uuid
from unittest import mock
import custom_migration_operations.more_operations
import custom_migration_operations.operations
from django import get_version
from django.conf import SettingsReference, settings
from dja... |
869451f103179ffea9f80b63b8dc5a9f269e959e3598d95bf5ea11872101b80d | """
This is the Django template system.
How it works:
The Lexer.tokenize() method converts a template string (i.e., a string
containing markup with custom template tags) to tokens, which can be either
plain text (TokenType.TEXT), variables (TokenType.VAR), or block statements
(TokenType.BLOCK).
The Parser() class ta... |
c5ca01d0afa1daa643418f2891fa21dd42e7eaf51aa196fc16d81709afa3969c | 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... |
6c2b5be59e02995177aa3507180ac31dcc3b0ccc31c1120bced30af6194fee23 | import sys
import unittest
from contextlib import contextmanager
from django.test import LiveServerTestCase, tag
from django.utils.functional import classproperty
from django.utils.module_loading import import_string
from django.utils.text import capfirst
class SeleniumTestCaseBase(type(LiveServerTestCase)):
# L... |
23582c2c1c08562d2dc003354a9a6b20ffa3e4b58448e276ca545f8e3d8bd9a7 | 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... |
66fb5ac2a170dabe28f92c76deeb3b46d8619a9ed22353728518e1625f4d9f5e | import difflib
import json
import posixpath
import sys
import threading
import unittest
from collections import Counter
from contextlib import contextmanager
from copy import copy
from difflib import get_close_matches
from functools import wraps
from unittest.suite import _DebugResult
from unittest.util import safe_rep... |
ed73f4a52e7db7c8a28287b6ec7cbfe6c566dfeaa906ba238f3168bb677c176a | "Functions that help with dynamically creating decorators for views."
from functools import partial, update_wrapper, wraps
class classonlymethod(classmethod):
def __get__(self, instance, cls=None):
if instance is not None:
raise AttributeError("This method is available only on the class, not ... |
7e9703a7e43565a73318e6e2756a534d126edf7e40b2630c68524afd289e05a7 | import copy
import itertools
import operator
from functools import total_ordering, wraps
class cached_property:
"""
Decorator that converts a method with a single self argument into a
property cached on the instance.
A cached property can be made out of an existing method:
(e.g. ``url = cached_pr... |
2e1a6b7e754a2d1966c3992a213237da7f7973d1cd27bfee301dfbd240e031e4 | """
This module contains helper functions for controlling caching. It does so by
managing the "Vary" header of responses. It includes functions to patch the
header of response objects directly and decorators that change functions to do
that header-patching themselves.
For information on the Vary header, see:
http... |
198bdd11ddfe5e05e53f38d050956ce6d5f2f7890222b46224ec3863d784779a | """
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... |
e050e0f12f3fe724cffc78f8414e9fe1ab7cb78ef37b7386ca4d6c4def711953 | import pkgutil
import sys
from importlib import import_module, reload
from django.apps import apps
from django.conf import settings
from django.db.migrations.graph import MigrationGraph
from django.db.migrations.recorder import MigrationRecorder
from .exceptions import (
AmbiguityError, BadMigrationError, Inconsi... |
a97714f5328f526f8ddde6d8d0ab26e6bd547706db1bb8501f4efd31e50dd467 | 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 ... |
9cbd7b518e27f10a31eef2bb0ef9810457b7b768262d2ea74845e951e56298b3 | from django.apps.registry import Apps
from django.db import models
from django.db.utils import DatabaseError
from django.utils.functional import classproperty
from django.utils.timezone import now
from .exceptions import MigrationSchemaMissing
class MigrationRecorder:
"""
Deal with storing migration records ... |
660d329d14228d118027835b628a7ce9fafabf8616ec8f99bb2e00b40b1fb15e | 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... |
f4a174620d0ca5e48760916ed03e2448eabf8727b44f19e87dd7da3a61bf36c6 | from django.core import checks
NOT_PROVIDED = object()
class FieldCacheMixin:
"""Provide an API for working with the model's fields value cache."""
def get_cache_name(self):
raise NotImplementedError
def get_cached_value(self, instance, default=NOT_PROVIDED):
cache_name = self.get_cache... |
0213f94d4e356ada62364a58a64ba0fa9314fb70bf25efeeda21762449ec391f | 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... |
cc196be407be41766c9f376f4bf68241f06a4e074a0791da5a5dc509a58a53ac | 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
... |
f62cf08f6394a5940123c2e250094f6f17af89905b2555ca0699b75a233087f1 | 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... |
1363fd974ab4490fa7843c52531b3c87a0dfbddcac6350d1104b7addab758d97 | 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.... |
5918d7ade904714af1f2aef0a769abd853cbbdb0a003dc238eb36a0c6a56732d | import datetime
import decimal
import uuid
from functools import lru_cache
from itertools import chain
from django.conf import settings
from django.core.exceptions import FieldError
from django.db import utils
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.models import aggregates... |
0c4e3f1793640bbb09e2fcc08821a126beb9f285f6c0df435396d713be695287 | import functools
import os
import pkgutil
import sys
from argparse import _SubParsersAction
from collections import defaultdict
from difflib import get_close_matches
from importlib import import_module
import django
from django.apps import apps
from django.conf import settings
from django.core.exceptions import Improp... |
d1074a95e50dfcf6caf1634571acb165c9106fc0b181f2ae440dc197de1bdf0b | import time
from importlib import import_module
from django.apps import apps
from django.core.checks import Tags, run_checks
from django.core.management.base import (
BaseCommand, CommandError, no_translations,
)
from django.core.management.sql import (
emit_post_migrate_signal, emit_pre_migrate_signal,
)
from... |
e6a5d9dee2f2d8bcf06796649e13ba8805611da852ea5088bfe47a91c5b6fa91 | from django.db.models import Lookup, Transform
from django.db.models.lookups import Exact, FieldGetDbPrepValueMixin
from .search import SearchVector, SearchVectorExact, SearchVectorField
class PostgresSimpleLookup(FieldGetDbPrepValueMixin, Lookup):
def as_sql(self, qn, connection):
lhs, lhs_params = self... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.