hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
daeed7de86cd0a315008025166ef295dca89a724f4ad77460a613748250519a2 | from django.apps import apps
from django.apps.registry import Apps
from django.conf import settings
from django.contrib.sites import models
from django.contrib.sites.checks import check_site_id
from django.contrib.sites.management import create_default_site
from django.contrib.sites.middleware import CurrentSiteMiddlew... |
783691fbb4cfb0a1a60f8d123c3662e9ae11dbcfd7913b51017509e28de5f012 | import os
from django.apps import AppConfig, apps
from django.apps.registry import Apps
from django.contrib.admin.models import LogEntry
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from django.db import models
from django.test import SimpleTestCase, ignore_warnings, override_settings
f... |
f4e9f54d439b1929703575b6484df7601b985f9fccf22159b9bf48e3a7646b83 | import json
from django.db.models import CharField, F, OuterRef, Q, Subquery, Value
from django.db.models.functions import Cast, Concat, Substr
from django.test.utils import Approximate
from . import PostgreSQLTestCase
from .models import AggregateTestModel, StatTestModel
try:
from django.contrib.postgres.aggreg... |
08f3aeee16eb6b081a905a3ff82fc2e3843dc52a1fd99e386c5bd96f9141c52a | import os
import re
import types
from datetime import datetime, timedelta
from decimal import Decimal
from unittest import TestCase, mock
from django.core.exceptions import ValidationError
from django.core.files.base import ContentFile
from django.core.validators import (
BaseValidator, DecimalValidator, EmailVali... |
7ac7972a5e5f18c04af3ce0a4a6e850e35b41044d0df33570ccf83b7eefb3501 | import json
from django.conf import settings
from django.contrib.messages import constants
from django.contrib.messages.storage.base import Message
from django.contrib.messages.storage.cookie import (
CookieStorage, MessageDecoder, MessageEncoder,
)
from django.test import SimpleTestCase, override_settings
from dj... |
43ef1a770910d86e3d20024de95f0a504a49b901a86486231820e9ae230ad379 | import time
from datetime import datetime, timedelta
from http import cookies
from django.http import HttpResponse
from django.test import SimpleTestCase
from django.test.utils import freeze_time
from django.utils.http import http_date
from django.utils.timezone import utc
class SetCookieTests(SimpleTestCase):
... |
cd0727f2cae8017b12f3bbcb1d2e9b9b76abf0991643dbf5e16559ede57b75e6 | import datetime
from django.test import TestCase
from django.test.utils import requires_tz_support
from django.utils import timezone, translation
from django.utils.timesince import timesince, timeuntil
from django.utils.translation import npgettext_lazy
class TimesinceTests(TestCase):
def setUp(self):
s... |
c38a6bb57dd63fb57e2040ba82e1deb489925154a54d0d137d037ae39f71014f | import contextlib
import os
import py_compile
import shutil
import sys
import tempfile
import threading
import time
import types
import weakref
import zipfile
from importlib import import_module
from pathlib import Path
from subprocess import CompletedProcess
from unittest import mock, skip, skipIf
import django.__mai... |
a8febbae6f2c447044d0964ee27d98d0395642ddf8ddf9fdbe01a1bce76ac543 | """
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... |
6d4b134dee41bc5c34b99adffa4c91df50c3add79cda0a662b7e5d3b329acb44 | import base64
import os
import shutil
import string
import tempfile
import unittest
from datetime import timedelta
from http import cookies
from pathlib import Path
from django.conf import settings
from django.contrib.sessions.backends.base import UpdateError
from django.contrib.sessions.backends.cache import SessionS... |
6a3efe85607638426218f38eed6fd4e50efb8d9216766f86c046acb06fab123c | """Tests related to django.db.backends that haven't been organized."""
import datetime
import threading
import unittest
import warnings
from django.core.management.color import no_style
from django.db import (
DEFAULT_DB_ALIAS, DatabaseError, IntegrityError, connection, connections,
reset_queries, transaction,... |
dba5013d660e384bf37ff447cae5dcfd3210f28d1fbac8654af971dc6775c555 | import datetime
import itertools
import unittest
from copy import copy
from unittest import mock, skipIf
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... |
c2c94e58a5991625cfbf5ba26312d54ac20dd4e9180a66389ef5d01e1a4975a1 | from math import ceil
from operator import attrgetter
from django.db import IntegrityError, NotSupportedError, connection
from django.db.models import FileField, Value
from django.db.models.functions import Lower
from django.test import (
TestCase, override_settings, skipIfDBFeature, skipUnlessDBFeature,
)
from .... |
a18fac1b3efaca8a081b3fba4178afd534be9f24e4f5b52ca91aff45cdb6f1f4 | import asyncore
import base64
import mimetypes
import os
import shutil
import smtpd
import sys
import tempfile
import threading
from email import charset, message_from_binary_file, message_from_bytes
from email.header import Header
from email.mime.text import MIMEText
from email.utils import parseaddr
from io import St... |
9b8a85afe68dda17d6b503b383a1d5a9b0cd861d330e657bc0245475cc102bbb | import os
import pickle
import sys
import tempfile
import unittest
from pathlib import Path
from django.core.files import File, temp
from django.core.files.base import ContentFile
from django.core.files.uploadedfile import TemporaryUploadedFile
from django.db import IntegrityError, models
from django.test import TestC... |
586388f1cf1bb5174d17ab4dfaca1baabae97bb7252cf445e55d349b5fe5cb25 | 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... |
0d7816fda479fb7d3f124a03023262af23829b704db2a475f3ff487eb9d9fc46 | from django.db import models
class Product(models.Model):
price = models.IntegerField(null=True)
discounted_price = models.IntegerField(null=True)
unit = models.CharField(max_length=15, null=True)
class Meta:
required_db_features = {
'supports_table_check_constraints',
}
... |
ee6dc019525577d411e544f090b7dce451650ace77c9bb3a9e6fdffe8c41856c | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [('migrations', '0001_initial')]
operations = [
migrations.CreateModel(
'Something',
[
('id', models.AutoField(primary_key=True)),
],
),
]
|
c4cd1968cb99ae53ebdbb20b8d9cee1a4a82e6919360a07e4286c53353eaf005 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [('migrations', '0001_initial')]
operations = [
migrations.CreateModel(
'SomethingElse',
[
('id', models.AutoField(primary_key=True)),
],
),
]... |
b5cff3584b6d250eff40402264ff8553d07f376c26aa61b53c14d94284a9a3fd | from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
operations = [
migrations.CreateModel(
'Author',
[
('id', models.AutoField(primary_key=True)),
],
),
]
|
8551d8f576e3dde307c12e1d34c455924e52057e226644d8f1ca6197f7c8fb43 | default_app_config = 'apps.explicit_default_config_app.apps.ExplicitDefaultConfig'
|
f81cc01c5dccc16ab33bb1f95a1425bee64afb268013e86b570bec50cf7dee04 | from django.apps import AppConfig
class ExplicitDefaultConfig(AppConfig):
name = 'apps.explicit_default_config_app'
|
b55d02b8ba41157a808cdfcae8acf1c1806331d9726a490aeb245bb985e51228 | from django.apps import AppConfig
class TwoConfig(AppConfig):
default = True
name = 'apps.two_default_configs_app'
class TwoConfigBis(AppConfig):
default = True
name = 'apps.two_default_configs_app'
|
a8d526a39aecfb9d48853e90ef0b0667a75ca45a60294d38842a23144a8836f2 | from django.apps import AppConfig
class TwoConfig(AppConfig):
default = True
name = 'apps.two_configs_one_default_app'
class TwoConfigAlt(AppConfig):
name = 'apps.two_configs_one_default_app'
|
ab52d0eef38ef11d5c89340881e22f9422b177be017ba8c0911dd868c9cd0fe1 | from django.apps import AppConfig
class OneConfig(AppConfig):
name = 'apps.one_config_app'
|
28f54b125017267e9f84da7cd9c69388754990cc32797544806d6a534209d25a | from django.apps import AppConfig
class TwoConfig(AppConfig):
name = 'apps.two_configs_app'
class TwoConfigBis(AppConfig):
name = 'apps.two_configs_app'
|
a41f12a3e3050035f2d71b45e7e2fd466d181f83ff9843f5205e72cf5c3f2367 | default_app_config = 'apps.explicit_default_config_mismatch_app.not_apps.ExplicitDefaultConfigMismatch'
|
dcf9a2b7f47260673e8bc7aed48533d3c0a2bc5894b2d096a305151663bad6bb | from django.apps import AppConfig
class ImplicitDefaultConfigMismatch(AppConfig):
name = 'apps.explicit_default_config_mismatch_app'
|
d44eeb0ccac9d209c95334c300aecd0b87e23ba00f0b8a8ca39437db1d15374c | from django.apps import AppConfig
class ExplicitDefaultConfigMismatch(AppConfig):
name = 'apps.explicit_default_config_mismatch_app'
|
ed4c199fa37182240e27542fbd30f57bc6d67f669006fdf8709102fa1beb74c3 | import os
from django.apps import AppConfig
class NSAppConfig(AppConfig):
default = False
name = 'nsapp'
path = os.path.dirname(__file__)
|
9284ba2996549435b933071fbfd0bfb2ba7f0aef5936ebaafe11cb97bbd11e05 | from unittest import mock, skipUnless
from django.db import connection
from django.db.backends.mysql.features import DatabaseFeatures
from django.test import TestCase
@skipUnless(connection.vendor == 'mysql', 'MySQL tests')
class TestFeatures(TestCase):
def test_supports_transactions(self):
"""
... |
78d93dd93dfa52f398f2ec334cdeb4bb798d502d2c98b048e27c5d4df4991fa9 | from django.apps import AppConfig
class LoadingAppConfig(AppConfig):
name = 'i18n.loading_app'
|
30dd735db81eb2297d0882752668c4272117c60f0825581c6e24dc9b6d013038 | 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... |
7f31f6782a74bc6c9bfbf2cb0a0a244f9ee81ea6eaa30517ab2c2ac34265c18f | 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... |
84a174c664b3cc610791dfba59bf26afe6167b53bd907a922c035ebf8186aa0c | import os
import time
import warnings
from asgiref.local import Local
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.core.signals import setting_changed
from django.db import connections, router
from django.db.utils import ConnectionRouter
from django.dispatch import ... |
2d8d7fc188872a319908a3e6001eb5d9f5237baf66b6b92d879be106f13952b3 | import functools
import sys
import threading
import warnings
from collections import Counter, defaultdict
from functools import partial
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from .config import AppConfig
class Apps:
"""
A registry that stores the configuration of insta... |
7424cb5452c9d421b69beb9992a0285e6379f5fb6a984f273d4f3d72d21d69ad | import itertools
import json
import os
import re
from urllib.parse import unquote
from django.apps import apps
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.template import Context, Engine
from django.urls import translate_url
from django.utils.fo... |
065caa421aab5484054402caa169c0164176d4070c01a5a8d49c6d23ce1eaecc | from django.conf import settings
from django.http import HttpResponseForbidden
from django.template import Context, Engine, TemplateDoesNotExist, loader
from django.utils.translation import gettext as _
from django.utils.version import get_docs_version
# We include the template inline since we need to be able to relia... |
09a95bd6908e65a028adcc9597fd4ee0bed4946ae2e2c5ae3a5e3c42dc959d41 | """
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
import traceback
import warnings
f... |
7c6fdf5e2a4a8cde4e0c6dc6abe09dc03cc7b9f8f7875e235e5b407a6d467f64 | """
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
####... |
a228fa479e9f0fb44a4f42649abd312704f372caabdac792bba80bf192c8e5c4 | import functools
import itertools
import logging
import os
import signal
import subprocess
import sys
import threading
import time
import traceback
import weakref
from collections import defaultdict
from pathlib import Path
from types import ModuleType
from zipimport import zipimporter
from django.apps import apps
fro... |
b033a206b00b4f36e13fb670fbdd161fbe6fcfdd9ab6a8aeda367e1aa440d3c2 | """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.... |
97b666aab7e4476298fb9d935d640783e4247de7a860b9428cbf2666f4ebc60b | """
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the 'context_processors' option of the configuration
of a DjangoTemplates backend and use... |
2f4ebefce6996d5176e06dd44117f981d3cf93ff7d7b430e5dd75359e4e45fce | """
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... |
7e2675d83e075f0ccb252abfefc13efe853c5ac9ed4c36c9581c8f5c15db4dcf | """
Field classes.
"""
import copy
import datetime
import json
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 Validation... |
e9a6777f24d563602c2310288a696bb7a2bb827ba2aaac41f17b6a73a3f537db | 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... |
b7f330463c82e2ca97fd69de79752e3d5e08116477f1a1efcf9ab5db12656397 | """
Global Django exception and warning classes.
"""
import operator
from django.utils.hashable import make_hashable
class FieldDoesNotExist(Exception):
"""The requested model field does not exist"""
pass
class AppRegistryNotReady(Exception):
"""The django.apps registry is not populated yet"""
pass... |
7b75106e818d2afd68b6d3870edf038d4f4d134fbdf423c5e6e50e9a7f223c30 | """
Functions for creating and restoring url-safe signed JSON objects.
The format used looks like this:
>>> signing.dumps("hello")
'ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk'
There are two components here, separated by a ':'. The first component is a
URLsafe base64 encoded JSON of the object passed to dumps(). T... |
5eb6c97d2879a117be0b3efc7f556d9eb424b43925a67918235c44f4ce9f5831 | import ipaddress
import re
import warnings
from pathlib import Path
from urllib.parse import urlsplit, urlunsplit
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
from django.utils.deprecation import RemovedInDjango41Warning
from django.utils.encoding import punyc... |
0b1d09557486b15b42b0cf2e9dbcb591a769da5587e1096a0517606ea1109497 | """
Internationalization support.
"""
import warnings
from contextlib import ContextDecorator
from decimal import ROUND_UP, Decimal
from django.utils.autoreload import autoreload_started, file_changed
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.functional import lazy
from django.uti... |
864b72c0662fce7f5999c69a65177e37fa24a821f1b881339ddaf827ae9235c7 | from pathlib import Path
from asgiref.local import Local
from django.apps import apps
def _is_django_module(module):
"""Return True if the given module is nested under Django."""
return module.__name__.startswith('django.')
def watch_for_translation_changes(sender, **kwargs):
"""Register file watchers... |
a57532be07b08942547e41d1610fc0bd2a0c5be3fc3505229c62880e05ed7943 | """
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
import django
from django.conf import settings
from django.core import exceptions
from django.d... |
1c5eb0e738315bbfa541340466278c609b795ddba2e61fda65e225badc5908bf | 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... |
0aa498473d0c743e620b98a5ab8868d578634e8c857d52049c082d6d88142d66 | 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 (
CharField, DateTimeField, Field, IntegerField, UUIDField,
)
from django.db.models.query... |
69592a287c4ba85a6de6da06ab231433ecd44ae1f135ce5ee41e1d5d4148023b | from django.db.models.lookups import (
Exact, GreaterThan, GreaterThanOrEqual, In, IsNull, LessThan,
LessThanOrEqual,
)
class MultiColSource:
contains_aggregate = False
def __init__(self, alias, targets, sources, field):
self.targets, self.sources, self.field, self.alias = targets, sources, f... |
ea7dfa41624cdba9b0f55d8c9b294ee54d7916651343e50acfe1c6e266cde645 | import json
from django import forms
from django.core import checks, exceptions
from django.db import NotSupportedError, connections, router
from django.db.models import lookups
from django.db.models.lookups import PostgresOperatorLookup, Transform
from django.utils.translation import gettext_lazy as _
from . import ... |
9f20ae9f2a87ab56428c1204276f3402de6f06acdd0affd53332834018bc914a | """
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... |
041e6c4a5fa555a148e4b9312b506f85197ed99e543c120c2eb0dcdd51cc4709 | import sys
from django.db.models.fields import DecimalField, FloatField, IntegerField
from django.db.models.functions import Cast
class FixDecimalInputMixin:
def as_postgresql(self, compiler, connection, **extra_context):
# Cast FloatField to DecimalField as PostgreSQL doesn't support the
# foll... |
2f7282a68ea685834b7e8ebf667e4f936e2020077ccfa651596601aead201c45 | """
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 ... |
ff770a7160fa8baea990ff5f7939b1f522be083659728192b3710220c25d9e61 | 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... |
ea53ea36d06a910383613d386cec031c00243e910a98ffcf92f93082c2062492 | 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... |
8554f639d7d715a31044915066c7a2f42fd98d2f4c87d93b8d2e580231b7e4e4 | import _thread
import copy
import threading
import time
import warnings
from collections import deque
from contextlib import contextmanager
import pytz
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import DEFAULT_DB_ALIAS, DatabaseError
from django.db.backends... |
b29880fe93dc4308320e92167380478e78f575f26560acc657ac5b1e37994337 | 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... |
bf3eed8f3a2a603e355a2d6a51735bf6d75b88b65b183371fa2f98c2dfa04f0a | import operator
import platform
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 c... |
dfee0217dd52dbdb00df8a796699b92db31b888f889341819a343cf6e2e119c1 | """
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... |
4e8fb6c3366a48774d48808926049abdf298ca21c527ed11db85522c3286e5b2 | """
Portable file locking utilities.
Based partially on an example by Jonathan Feignberg in the Python
Cookbook [1] (licensed under the Python Software License) and a ctypes port by
Anatoly Techtonik for Roundup [2] (license [3]).
[1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
[2] https://sourcefor... |
e2e069550b74e4508648177b8f72a496a1103d856bac47964b2f7effa9e85443 | """
YAML serializer.
Requires PyYaml (https://pyyaml.org/), but that's checked for in __init__.
"""
import collections
import decimal
from io import StringIO
import yaml
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import (
Deserializer as PythonDeserializer,... |
a9fbb5547bc6f58b93f584ebcb1f7eb9b508d5211ff6040abb28e419a81b993a | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from .. import Error, Tags, Warning, register
REFERRER_POLICY_VALUES = {
'no-referrer', 'no-referrer-when-downgrade', 'origin',
'origin-when-cross-origin', 'same-origin', 'strict-origin',
'strict-origin-when-cross-ori... |
2b91d4e47ef9a72ebce789a6fa225b37f30df4313b1e393f4e33e73e0926393f | from django.core.management.base import BaseCommand
def module_to_dict(module, omittable=lambda k: k.startswith('_') or not k.isupper()):
"""Convert a module namespace to a Python dictionary."""
return {k: repr(getattr(module, k)) for k in dir(module) if not omittable(k)}
class Command(BaseCommand):
hel... |
57f91ca46a49140fa8320b09078cef1dd14954b1cd69dc91a55e3e1c42753997 | import os
import select
import sys
import traceback
from django.core.management import BaseCommand, CommandError
from django.utils.datastructures import OrderedSet
class Command(BaseCommand):
help = (
"Runs a Python interactive interpreter. Tries to use IPython or "
"bpython, if one of them is av... |
0199d29c09007e73402603c7340e4cebf015a2366dafb709fd56689ecac568bb | from urllib.parse import urlencode
from urllib.request import urlopen
from django.apps import apps as django_apps
from django.conf import settings
from django.core import paginator
from django.core.exceptions import ImproperlyConfigured
from django.urls import NoReverseMatch, reverse
from django.utils import translati... |
eb6855af2d9ad6ec79c9a88d501e526a2fa3630ab679ac9a427ed6db33523080 | from calendar import timegm
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import Http404, HttpResponse
from django.template import TemplateDoesNotExist, loader
from django.utils import feedgenerator
from django.u... |
de40b80f908da64deea7db2d378b71adf1dc0b5cbae7a934db6d4afa2743b355 | from datetime import datetime
from django.conf import settings
from django.utils.crypto import constant_time_compare, salted_hmac
from django.utils.http import base36_to_int, int_to_base36
class PasswordResetTokenGenerator:
"""
Strategy object used to generate and check tokens for the password
reset mech... |
71f12d39c04e062214fd6677cab5d4d116c9110460d08c44a0b528b1ffe0b155 | """
This module allows importing AbstractBaseUser even when django.contrib.auth is
not in INSTALLED_APPS.
"""
import unicodedata
from django.conf import settings
from django.contrib.auth import password_validation
from django.contrib.auth.hashers import (
check_password, is_password_usable, make_password,
)
from d... |
e26cb207dd9db7a645311ae2262116bdf1ab7b20146485fdcdd8c4ad2e66fd04 | def register(*models, site=None):
"""
Register the given model(s) classes and wrapped ModelAdmin class with
admin site:
@register(Author)
class AuthorAdmin(admin.ModelAdmin):
pass
The `site` kwarg is an admin site to use instead of the default admin site.
"""
from django.contri... |
fbbc2b49108e232cc37f3b483f4e827b6a23baa1f8a4e8aecd67bb063d7f4776 | 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... |
17aab599481aed80161e23180895a5d3ada32c3e85329128b45c33dcf735516b | import copy
import json
import operator
import re
from functools import partial, reduce, update_wrapper
from urllib.parse import quote as urlquote
from django import forms
from django.conf import settings
from django.contrib import messages
from django.contrib.admin import helpers, widgets
from django.contrib.admin.ch... |
bf1cb040117fa502f5166b2b1f625c5b2b61a8452767f306854bcbd341a8b753 | import re
from functools import update_wrapper
from weakref import WeakSet
from django.apps import apps
from django.contrib.admin import ModelAdmin, actions
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import ImproperlyConfigured
from django.db.models.base import ModelBase
from djang... |
4afd76ecb6f6074bf07bb99d7c74f6e9e0dc3f89881b20be2caf157593257386 | 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.... |
badb9eead62c7a4e97d8a45f04b525047446bc087cae518f896945cef63ce8db | import datetime
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.utils import (
display_for_field, display_for_value, get_fields_from_path,
label_for_field, lookup_field,
)
from django.contrib.admin.views.main import (
ALL_VAR, ORDER_VAR, PAGE_VAR, SE... |
17418e15e50c52d6a9c6e677d3a4fc777b8d6e53217d67ed3a5a5cf381de155b | """
This module contains useful utilities for GeoDjango.
"""
from django.contrib.gis.utils.ogrinfo import ogrinfo # NOQA
from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect # NOQA
from django.contrib.gis.utils.srs import add_srs_entry # NOQA
from django.core.exceptions import ImproperlyConfigured
t... |
4bc4cc88d04d50fc14f0500a1ef440809c10ecd525a91cd54a42f273fa899bf3 | """
This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
inherit from this object.
"""
import re
from ctypes import addressof, byref, c_double
from django.contrib.gis import gdal
from django.contrib.gis.geometry import hex_regex, json_regex, wkt_regex
from django.contrib.gis.geos import prototy... |
f338603106a6c9e0572c4196f1ad528f6c798aa817d4a1f8ac2cb10201890ffc | """
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... |
a7a54aaed5ed3a39e093b5d962ac27962ecbf755427f54d6aa3a1202f4fa90cc | """
SQL functions reference lists:
https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html
"""
from django.contrib.gis.db import models
from django.contrib.gis.db.backends.base.operations import (
BaseSpatialOperations,
)
from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter
from djang... |
c866ab487c6f6f47fba59d823f90e79210783f63edd788faa9f66e50b644e129 | from django.db import DatabaseError
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
class SpatialiteSchemaEditor(DatabaseSchemaEditor):
sql_add_geometry_column = (
"SELECT AddGeometryColumn(%(table)s, %(column)s, %(srid)s, "
"%(geom_type)s, %(dim)s, %(null)s)"
)
sql_add_... |
86e4c47afe5100c654f5ac53f59326ae57dddc1559ff494d6deb96fbd5cbc065 | import argparse
from django.contrib.gis import gdal
from django.core.management.base import BaseCommand, CommandError
from django.utils.inspect import get_func_args
class LayerOptionAction(argparse.Action):
"""
Custom argparse action for the `ogrinspect` `layer_key` keyword option
which may be an integer... |
e90612818365ed7572ea592940d51c30e0a449ee14e47ff6f5e3d7ae4ddf9c30 | import os
import sys
import unittest
from types import ModuleType, SimpleNamespace
from unittest import mock
from django.conf import ENVIRONMENT_VARIABLE, LazySettings, Settings, settings
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest
from django.test import (
SimpleTes... |
189305a1d1de6581742906ce9e8b1579979d98800fc2fb1448a75a52116fa6e0 | from unittest import mock
from django.conf.global_settings import PASSWORD_HASHERS
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.hashers import get_hasher
from django.contrib.auth.... |
89b26669b80542fb3dc1c83c75852f7450e667777ddfe0138c0d92757042a2ff | import sys
from datetime import datetime, timedelta
from types import ModuleType
from django.conf import (
PASSWORD_RESET_TIMEOUT_DAYS_DEPRECATED_MSG, Settings, settings,
)
from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.core.exceptions imp... |
5ecdf994537fb3986ae4661d48007704dc117e0d23182533de1eda4b5840ef32 | 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
from django.test.utils import ignore_warnings
from django.utils.deprecation import RemovedInDjango40W... |
c3620b786e622a5945fcae6a83b832de3bdacc1e75a7fcc0d42d1206c84339ae | from django.contrib.auth import HASH_SESSION_KEY
from django.contrib.auth.middleware import AuthenticationMiddleware
from django.contrib.auth.models import User
from django.http import HttpRequest, HttpResponse
from django.test import TestCase, override_settings
from django.test.utils import ignore_warnings
from django... |
653fee9d85016b5f1a05183b860616ac109e41150525954342af2fbcc301bf90 | from django.apps import apps
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.core.exceptions import FieldDoesNotExist
from django.db.models import (
CharField, Field, ForeignObjectRel, ManyToManyField,
)
from django.db.models.options import EMPTY_RELATION_TREE,... |
c83df1d8ce27983415824bc3f19770c65d2d100e8e767122aaa89199beea7c4e | 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... |
bdcbbbb772d6325a9098460dd54aaa7468ce678b7820816dea5f426198f9141a | import datetime
from django.core import signing
from django.test import SimpleTestCase
from django.test.utils import freeze_time, ignore_warnings
from django.utils.crypto import InvalidAlgorithm
from django.utils.deprecation import RemovedInDjango40Warning
class TestSigner(SimpleTestCase):
def test_signature(se... |
07d7e9a6b12705fabb6fcb3cd5d879108aba0383f950949c207d5ad8a4a9fc37 | 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... |
66965acab30af865d5afcec7dd6f756a1491325f2970d35f46c127bee8cd2f11 | from django.test import modify_settings
from . import PostgreSQLTestCase
from .models import CharFieldModel, TextFieldModel
try:
from django.contrib.postgres.search import (
TrigramDistance, TrigramSimilarity,
)
except ImportError:
pass
@modify_settings(INSTALLED_APPS={'append': 'django.contrib.... |
5b8c46b3d929902bfc3326059978c1935d5c86191931048f57f49ecbd2c01092 | try:
from django.contrib.postgres import forms
from django.contrib.postgres.fields import JSONField
from django.contrib.postgres.fields.jsonb import (
KeyTextTransform, KeyTransform,
)
except ImportError:
pass
from django.core.checks import Warning as DjangoWarning
from django.utils.depreca... |
2a9f0786470952d5a70eb085f3565c9633d29a196061ffffd37e17b2d79c2d79 | 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... |
d9ad98e8f436562342704861129a0b8e557093f9e688a75d23a495d5b9ac7a56 | 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
... |
0c2a1793bf9cc6908acdcfef16672518e980345b5acaa4245c372a1ca35ff335 | from django.db.backends.signals import connection_created
from django.db.migrations.writer import MigrationWriter
from django.test.utils import modify_settings
from . import PostgreSQLTestCase
try:
from psycopg2.extras import (
DateRange, DateTimeRange, DateTimeTZRange, NumericRange,
)
from djang... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.