hash
stringlengths
64
64
content
stringlengths
0
1.51M
921d9f5fe20831e8ceb9ef250893ac5ec7d1fe4393618c68595b58c9767229a9
from django.contrib.gis.db import models from ..admin import admin class City(models.Model): name = models.CharField(max_length=30) point = models.PointField() class Meta: app_label = 'geoadmin' def __str__(self): return self.name class CityAdminCustomWidgetKwargs(admin.GISModelAd...
5cb774cfd98bf0afe7e494013a87ad8d9dbe5c98218fbf254f08164e521a8e43
from django.db import connection from django.db.models import Value from django.db.models.functions import Length, Repeat from django.test import TestCase from ..models import Author class RepeatTests(TestCase): def test_basic(self): Author.objects.create(name='John', alias='xyz') none_value = ''...
f308b8fe10c3ea95dee6295a1ea0b838e454fcd97738969b36d5a3de621c02db
from django.db import connection from django.db.models import Value from django.db.models.functions import Length, LPad, RPad from django.test import TestCase from ..models import Author class PadTests(TestCase): def test_pad(self): Author.objects.create(name='John', alias='j') none_value = '' if...
68703bd7f05e06049267ef6af6e094232c0777f4c3dd8cf2504c7b973e115c7c
import unittest from datetime import datetime, timedelta, timezone as datetime_timezone try: import zoneinfo except ImportError: from backports import zoneinfo try: import pytz except ImportError: pytz = None from django.conf import settings from django.db.models import ( DateField, DateTimeField...
86d16e4301aed6db49055f672c90b6136c09c3fb1138cd11d855260ab8ace64e
from django.db.models import Subquery, TextField from django.db.models.functions import Coalesce, Lower from django.test import TestCase from django.utils import timezone from ..models import Article, Author lorem_ipsum = """ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incid...
fe183d8469ffb149ae728957af125ab219ef1f6e64a9527213b96896896fc325
import math from decimal import Decimal from django.db.models.functions import Log from django.test import TestCase from ..models import DecimalModel, FloatModel, IntegerModel class LogTests(TestCase): def test_null(self): IntegerModel.objects.create(big=100) obj = IntegerModel.objects.annotate...
7c72e5ac7504af7ea75eae57c0b2cf32fde7633ff0fb1aa1bf8bfefcb21ea234
import math from decimal import Decimal from django.db.models.functions import ATan2 from django.test import TestCase from ..models import DecimalModel, FloatModel, IntegerModel class ATan2Tests(TestCase): def test_null(self): IntegerModel.objects.create(big=100) obj = IntegerModel.objects.anno...
a24fa01e268a0d5766a23f410bc7428482bd53c8fa86d9f37eb5aeead55d74e0
from decimal import Decimal from django.db.models.functions import Power from django.test import TestCase from ..models import DecimalModel, FloatModel, IntegerModel class PowerTests(TestCase): def test_null(self): IntegerModel.objects.create(big=100) obj = IntegerModel.objects.annotate( ...
39148c7a388afb008b2b5c94e1f642d3a9fa79e5afd3fa30aa675ed7319ec9b4
from django.utils.translation import gettext as _ string1 = _('This is a translatable string.') string2 = _('This is another translatable string.')
eb23a78080e0aa0b765ed504d573721f7c790927bd435230411a4b2b2622ae19
import os from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.http import HttpResponse, HttpResponsePermanentRedirect from django.middleware.locale import LocaleMiddleware from django.template import Context, Template from django.test import SimpleTestCase, override_set...
d994c65de9dbd65b3e1972bdee7effe3f38748b4c5d4f9c4605f1d15260e8097
""" 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, version_info as sphinx_version from sphinx.builders.html import StandaloneHTMLBuilder from sphin...
14737aa2f4ffb6cd55f675ba4d57585ea0eb85df5d913c058cc7dbe5b450ff57
import argparse import ctypes import faulthandler import hashlib import io import itertools import logging import multiprocessing import os import pickle import random import sys import textwrap import unittest import warnings from collections import defaultdict from contextlib import contextmanager from importlib impo...
532a6eeaa2d6c03cc2ab3ac432b36666435d9f341e4b6223293ab980d447e49b
""" PHP date() style date formatting See http://www.php.net/date for format strings Usage: >>> import datetime >>> d = datetime.datetime.now() >>> df = DateFormat(d) >>> print(df.format('jS F Y H:i')) 7th October 2003 11:39 >>> """ import calendar import datetime from email.utils import format_datetime as format_datet...
fd8c331ec2741b705a68a18cd676fce07428743143da3d671af1773a594deebb
""" 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...
79b1f42c17830d0310bcf3b9f0ba1adfc5d2ea36d2656bd24a0ef4f8a10a1be7
import re from django.core.exceptions import ValidationError from django.forms.utils import flatatt, pretty_name from django.forms.widgets import MultiWidget, Textarea, TextInput from django.utils.functional import cached_property from django.utils.html import conditional_escape, format_html, html_safe from django.uti...
530970555743669e971a1b7d10152db61bf2218ad653a43844a5f51b684124c8
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...
5417781def37dd90b0deb7e6d3cd10e65e751ef8d70b289bf1e901d22e34ca1a
""" The main QuerySet implementation. This provides the public API for the ORM. """ import copy import operator import warnings from itertools import chain import django from django.conf import settings from django.core import exceptions from django.db import ( DJANGO_VERSION_PICKLE_KEY, IntegrityError, NotSuppor...
0ae462275e1f24eb569e2ca7eff154d2b6edae007e6058d1ac0690a77754a9c2
import functools import inspect from functools import partial from django import forms from django.apps import apps from django.conf import SettingsReference, settings from django.core import checks, exceptions from django.db import connection, router from django.db.backends import utils from django.db.models import Q...
f4cf290732b90b902cb4896a249a6dae0e7871c904345da969e120be33d36512
""" Code to manage the creation and SQL rendering of 'where' constraints. """ from django.core.exceptions import EmptyResultSet from django.utils import tree from django.utils.functional import cached_property # Connection types AND = 'AND' OR = 'OR' class WhereNode(tree.Node): """ An SQL WHERE clause. ...
de88c268a38faff29cb9df64cc5621a646f4d2c44fdf446cd49be770d04fea49
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...
25213e7b35efb4701dbd8c4916c0a2692be811fc409804ec130b447dbec7c83f
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, EmailValidator, Fil...
2ce60578f728bcad1a7d8b03054f490e83f7f442af9fdbc0b4d95fd4e430076e
import json import os import shutil import sys import tempfile import unittest from io import StringIO from pathlib import Path from unittest import mock from django.conf import settings from django.contrib.staticfiles import finders, storage from django.contrib.staticfiles.management.commands.collectstatic import ( ...
68e778fbe3b6a40584cde52f130282518e67648bca05586884b4e0be2f4805b3
from django.apps import apps from django.db import models from django.test import SimpleTestCase, override_settings from django.test.utils import isolate_lru_cache class FieldDeconstructionTests(SimpleTestCase): """ Tests the deconstruct() method on all core fields. """ def test_name(self): "...
d5cfe135eef146e9cd45b020502746922896dff94a7ce9c1fb97b09f40b5b93f
import logging import multiprocessing import os import unittest.loader from argparse import ArgumentParser from contextlib import contextmanager from importlib import import_module from unittest import TestSuite, TextTestRunner, defaultTestLoader, mock from django.db import connections from django.test import SimpleTe...
741dd5a3acc52949833e5472c5647b225edb406b015268a259901fe5a1fbdb7e
from unittest import mock from django.core.checks import Error, Warning as DjangoWarning from django.db import connection, models from django.test.testcases import SimpleTestCase from django.test.utils import isolate_apps, modify_settings, override_settings @isolate_apps('invalid_models_tests') class RelativeFieldTe...
7f509d2da8235eee929f1188a959d818ddac371211caed1d5a8aaef5ebb743b4
import datetime import re import sys from contextlib import contextmanager from unittest import SkipTest, skipIf from xml.dom.minidom import parseString import pytz try: import zoneinfo except ImportError: try: from backports import zoneinfo except ImportError: zoneinfo = None from django...
628d1f0ca3ab6095285cf36be845cfdd67db1118e180116b115ca01de39cfcc4
from datetime import datetime from django.core.exceptions import ValidationError from django.forms import ( CharField, Form, MultipleChoiceField, MultiValueField, MultiWidget, SelectMultiple, SplitDateTimeField, SplitDateTimeWidget, TextInput, ) from django.test import SimpleTestCase beatles = (('J', 'John'),...
8e653f641a15b99d6a2956622eecc8541e4016c00df42d77c381a18947f08401
#!/usr/bin/env python import argparse import atexit import copy import gc import os import shutil import socket import subprocess import sys import tempfile import warnings from pathlib import Path try: import django except ImportError as e: raise RuntimeError( 'Django module not found, reference tests...
5230518f20cb44d690b0b24951085ba613c0a960611351c6fa1c5e65c3e11fdf
import argparse import ctypes import faulthandler import hashlib import io import itertools import logging import multiprocessing import os import pickle import random import sys import textwrap import unittest import warnings from collections import defaultdict from contextlib import contextmanager from importlib impo...
b2a25fbafb1b003788cd46b0591e59073a48d537ec60e257851e0829377bb501
import functools from importlib import import_module from inspect import getfullargspec, unwrap from django.utils.html import conditional_escape from django.utils.itercompat import is_iterable from .base import Node, Template, token_kwargs from .exceptions import TemplateSyntaxError class InvalidTemplateLibrary(Exc...
c457e3ac4829865e1381785894d747567646758b2a9ea643424bd537f1f2df9c
""" Cross Site Request Forgery Middleware. This module provides a middleware that implements protection against request forgeries from other sites. """ import logging import string from collections import defaultdict from urllib.parse import urlparse from django.conf import settings from django.core.exceptions import...
9731b7afb15e928c0ccbaac3750fc94ca4d96e248c6dca21e275b877832ea291
from django.apps.registry import apps as global_apps from django.db import migrations, router from .exceptions import InvalidMigrationPlan from .loader import MigrationLoader from .recorder import MigrationRecorder from .state import ProjectState class MigrationExecutor: """ End-to-end migration execution - ...
6183b83dcaa99d19dc3ca871c05c9ca21902419f208a6e8346b3e562a035f751
import copy from collections import defaultdict from contextlib import contextmanager from functools import partial from django.apps import AppConfig from django.apps.registry import Apps, apps as global_apps from django.conf import settings from django.core.exceptions import FieldDoesNotExist from django.db import mo...
13826ea436cea9bbdcba274d92d6935d37e2482724bc0413e40a81b98373ff0b
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...
90b5aa1e0abfe3ff00d5322f816127727a2a85bcc1021738fe5ecf50180b98c0
from django.apps.registry import Apps from django.contrib.contenttypes.fields import GenericForeignKey from django.db import models from django.db.migrations.exceptions import InvalidBasesError from django.db.migrations.operations import ( AddField, AlterField, DeleteModel, RemoveField, ) from django.db.migrations....
cd69b4621ff3283ad0cbcc5189cb8a4f00ff5411dced40920c7dcbb7c639e235
import builtins import getpass import os import sys from datetime import date from io import StringIO from unittest import mock from django.apps import apps from django.contrib.auth import get_permission_codename, management from django.contrib.auth.management import ( create_permissions, get_default_username, ) f...
15f215e69dc50bf5aad094d22de1035768928972acec205a9578242b87b5049f
import re from django.conf import settings from django.contrib.sessions.backends.cache import SessionStore from django.core.exceptions import ImproperlyConfigured from django.http import HttpRequest, HttpResponse, UnreadablePostError from django.middleware.csrf import ( CSRF_ALLOWED_CHARS, CSRF_SECRET_LENGTH, CSRF...
1c5efaf749b412de374a834f7e090d02a050665520ae03821a11a8dda503fbbe
import datetime import json from contextlib import contextmanager from django.contrib import admin from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.admin.views.autocomplete import AutocompleteJsonView from django.contrib.auth.models import Permission, User from django.contrib.contenttyp...
faf9675dc11ee3882c8c45072f77f972c3257e2793e341f49fb2ae13f06ecbee
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 pytz import...
c1067cdebdd3303941910463eb989b87c6c40f4d81c3f19edc2e0b6f54a450a2
import logging import multiprocessing import os import unittest.loader from argparse import ArgumentParser from contextlib import contextmanager from importlib import import_module from unittest import TestSuite, TextTestRunner, defaultTestLoader, mock from django.db import connections from django.test import SimpleTe...
e8c23dc4d5ab79bdc5dda6bddd46a648bd3a46417a970e84348e62eb1b67b228
import copy import datetime import json import uuid from django.core.exceptions import NON_FIELD_ERRORS from django.core.files.uploadedfile import SimpleUploadedFile from django.core.validators import MaxValueValidator, RegexValidator from django.forms import ( BooleanField, CharField, CheckboxSelectMultiple, Choi...
2287650e40bb87e2fb95e6919a02e6a23f704e7fffcda8d7ee52263b9a9675ac
#!/usr/bin/env python import argparse import atexit import copy import gc import os import shutil import socket import subprocess import sys import tempfile import warnings from pathlib import Path try: import django except ImportError as e: raise RuntimeError( 'Django module not found, reference tests...
862b5e76b1cb5d9f2bd12f821349dea3181d5be4fbc0a35dda8f6346eb611592
# Django documentation build configuration file, created by # sphinx-quickstart on Thu Mar 27 09:06:53 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't picklable (module imports are okay...
be9646a37c5f1672acf5c76c3b2a8db5aedb2f19ded5c226e906ac73bbca61fe
import argparse import ctypes import faulthandler import hashlib import io import itertools import logging import multiprocessing import os import pickle import random import sys import textwrap import unittest import warnings from collections import defaultdict from contextlib import contextmanager from importlib impo...
f86b52bfafa5c5493da814a6740db3a14c8c5b3797c3b769b24033f3da61399f
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...
f30f3914943bf71004843328caed6e0fa7248f64718789b7ae8b755b4c7c88f9
import asyncio import difflib import json import logging import posixpath import sys import threading import unittest from collections import Counter from contextlib import contextmanager from copy import copy, deepcopy from difflib import get_close_matches from functools import wraps from unittest.suite import _DebugR...
d5810c31f64664aa445e003c5752956d477667bf0eb2eec230587c366af3c232
import functools import re import sys import types import warnings from pathlib import Path from django.conf import settings from django.http import Http404, HttpResponse, HttpResponseNotFound from django.template import Context, Engine, TemplateDoesNotExist from django.template.defaultfilters import pprint from djang...
1be090a56e237caa1b4b3e24f39490e4cc1976dbdb72efd607127ed377ab99e5
""" 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...
17c8bf4c3da8f3765d29ba054b9b27e27b1fd034e93dd5397cf4638591254923
""" 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 ####...
1fd87f922e27f7614ec62fe602500b6bfd9e17ec82a68bdf40533ec8b611c401
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 import django from django.apps i...
243bd1ef4e09f6d801e8bc87934d342d977350ee2e474639c68c7c70d02d422d
import asyncio import inspect import warnings from asgiref.sync import sync_to_async class RemovedInNextVersionWarning(DeprecationWarning): pass class RemovedInDjango50Warning(PendingDeprecationWarning): pass class warn_about_renamed_method: def __init__(self, class_name, old_method_name, new_method_...
c5fdc2912c2d041369fdaac2af73161866b12ab58252319e6ad435ad1a9aba14
import copy import os import sys from importlib import import_module from importlib.util import find_spec as importlib_find def cached_import(module_path, class_name): modules = sys.modules if module_path not in modules or ( # Module is not fully initialized. getattr(modules[module_path], '__s...
80cbdff21ed667ad22a13004ae142455386b44aa4c44a6db3f83777d181330be
""" 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...
21b462f88fb0efcb2016d9b366adc0e445cf38a2868c33d3795fa7a55861612e
"""Default variable filters.""" import random as random_module import re import types from decimal import ROUND_HALF_UP, Context, Decimal, InvalidOperation from functools import wraps from operator import itemgetter from pprint import pformat from urllib.parse import quote from django.utils import formats from django....
86f2860c9798d07049ab76080c09f9011a2aa3ab284bf9e5e726f1be7f0a5e08
""" 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 import...
cdcdfb12bdb6b0f972a20d9c829315e148e1ba55d8d8267fa95093c6744acc1d
from django.core.exceptions import ValidationError from django.forms import Form from django.forms.fields import BooleanField, IntegerField from django.forms.renderers import get_default_renderer from django.forms.utils import ErrorList, RenderableFormMixin from django.forms.widgets import CheckboxInput, HiddenInput, N...
ed84f45d349d666268b5d39c45a5e9152600a5a11e916cdeaa205a7a727d6472
import re from django.core.exceptions import ValidationError from django.forms.utils import pretty_name from django.forms.widgets import MultiWidget, Textarea, TextInput from django.utils.functional import cached_property from django.utils.html import format_html, html_safe from django.utils.translation import gettext...
9e91dff33c736fd4de23f76596a5c0f255d56c27a72ffdd9acd66985f36f8833
import ipaddress import re from pathlib import Path from urllib.parse import urlsplit, urlunsplit from django.core.exceptions import ValidationError from django.utils.deconstruct import deconstructible from django.utils.encoding import punycode from django.utils.ipv6 import is_valid_ipv6_address from django.utils.rege...
19d7bf8c1392b37e7d2791ded2e5b45ce485a6f2d06418108cd6da9ca55950da
import datetime import json import mimetypes import os import re import sys import time from email.header import Header from http.client import responses from urllib.parse import quote, urlparse from django.conf import settings from django.core import signals, signing from django.core.exceptions import DisallowedRedir...
6a388dddcc993fd56fbf8d9331eeec067b00ceeabfeaed3e72f5bb7ec748a036
"""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...
8b1f10ae12f3145bee597aa9ccb3f46d3fd88a6c2001fcfe8a438e322e8587b1
from django.apps.registry import apps as global_apps from django.db import migrations, router from .exceptions import InvalidMigrationPlan from .loader import MigrationLoader from .recorder import MigrationRecorder from .state import ProjectState class MigrationExecutor: """ End-to-end migration execution - ...
c6a5fbc2e859ac9dade2e67e66a9fa5c4971e885c60005e0c1839d63dc538e26
import copy from collections import defaultdict from contextlib import contextmanager from functools import partial from django.apps import AppConfig from django.apps.registry import Apps, apps as global_apps from django.conf import settings from django.core.exceptions import FieldDoesNotExist from django.db import mo...
a62ee988cc867f76025b220f1984c310dad8bbf89281ed8a8558e2326138f960
import datetime import importlib import os import sys from django.apps import apps from django.db.models import NOT_PROVIDED from django.utils import timezone from .loader import MigrationLoader class MigrationQuestioner: """ Give the autodetector responses to questions it might have. This base class ha...
b808242fddf947e6c8a74720b6a2c8f2572503438d905ee1ac50d57e162fa8e9
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 ...
9a4b7c3798b66f40e529896b44a5de812837d44d8a52d3ab6707b47a22397c01
""" The main QuerySet implementation. This provides the public API for the ORM. """ import copy import operator import warnings from itertools import chain import django from django.conf import settings from django.core import exceptions from django.db import ( DJANGO_VERSION_PICKLE_KEY, IntegrityError, NotSuppor...
40d4acc37a5ad8d84094bd60e87b1229f3833e8a8ecd22aced255116f876be7e
import collections.abc import copy import datetime import decimal import math 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 i...
03ff7eab0242969602a0601c0beed92b5fa25ef62ee7510fb2df052535bba1e4
import functools import inspect from functools import partial from django import forms from django.apps import apps from django.conf import SettingsReference, settings from django.core import checks, exceptions from django.db import connection, router from django.db.backends import utils from django.db.models import Q...
4f0681f669d5c6c5ff7ccad014748195c62a294edde480be9cce71a233115fd3
""" 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...
cb74a167d9c0b9eb0a9e0e20ff64869baa0b3c05920d74b6c1197b497d1605fc
""" 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 ...
5a57a5cfc7dc5a6cf90da94131716b8da5980f23ff8d728e72096c8e57545fba
import collections import json 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, ...
ae85bd2dd67ce8d91da1de9ff0eef20d6743f33e153ad44dc16c7dc8c2ce5169
""" Code to manage the creation and SQL rendering of 'where' constraints. """ from django.core.exceptions import EmptyResultSet from django.utils import tree from django.utils.functional import cached_property # Connection types AND = 'AND' OR = 'OR' class WhereNode(tree.Node): """ An SQL WHERE clause. ...
31144f6b8f118d1f00008c68dbbf3b0db91b1a0494440eda4dca6e46ef67555b
from django.db import DatabaseError, InterfaceError from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property class DatabaseFeatures(BaseDatabaseFeatures): # Oracle crashes with "ORA-00932: inconsistent datatypes: expected - got # BLOB" when grouping...
728607f8c716896ef4e4eba47f28c1e4dffde739e9649e0d67516c0128fa5dbe
import copy import datetime import re from django.db import DatabaseError from django.db.backends.base.schema import ( BaseDatabaseSchemaEditor, _related_non_m2m_objects, ) class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_column = "ALTER TABLE %(table)s ADD %(column)s %(definition)s" sql...
38524d15d9c0e93fc2a3c226ce2b8da67a1c98780a134ceca40808bf1ef3cb0d
from django.db import ProgrammingError from django.utils.functional import cached_property class BaseDatabaseFeatures: gis_enabled = False # Oracle can't group by LOB (large object) data types. allows_group_by_lob = True allows_group_by_pk = False allows_group_by_selected_pks = False empty_fet...
fd69a7e4a5f611e3d4d58c120f096cd9e3616ced0e4cde27b21671b8760ad664
import _thread import copy import threading import time import warnings from collections import deque from contextlib import contextmanager try: import zoneinfo except ImportError: from backports import zoneinfo from django.conf import settings from django.core.exceptions import ImproperlyConfigured from djan...
44184df328629a2b10ab273726822a4124f24db96465735ebe6940c90ffc6a0d
import logging from datetime import datetime from django.db.backends.ddl_references import ( Columns, Expressions, ForeignKeyName, IndexName, Statement, Table, ) from django.db.backends.utils import names_digest, split_identifier from django.db.models import Deferrable, Index from django.db.models.sql import Query...
0319b7b9e837c949c63b44f5a1449b5f570fff4fa58e74cafbd2e1f9957185e9
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...
54e55d67039653edb672494a0042203bfd8368db6578661e19626acc9f7b4d4b
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 import Index from django.utils.datastructures import OrderedSet FieldInfo = nam...
5dceceb6cfee38e07f1f7c853b3dd7a0b0eb10e0e3fd62800356ab26da2f0c3d
""" MySQL database backend for Django. Requires mysqlclient: https://pypi.org/project/mysqlclient/ """ from django.core.exceptions import ImproperlyConfigured from django.db import IntegrityError from django.db.backends import utils as backend_utils from django.db.backends.base.base import BaseDatabaseWrapper from dja...
b1e07484830a3e8e5e0962b0cc7e09bb90a3c51337c958b2ffded720de827520
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_...
cdc94d16b65224c117ad98157c8b3166583f0c76c39f3d807db8062e14143dec
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...
a12837e7da68491ef8d9702f4941e1b87f9a162c5499f7911013bea9649c2a17
""" SQLite backend for the sqlite3 module in the standard library. """ import datetime import decimal import functools import hashlib import math import operator import random import re import statistics import warnings from itertools import chain from sqlite3 import dbapi2 as Database from django.core.exceptions impo...
5f4ddb9423696f33fec3d1c45417ce3cdc80f80a096b07fca4976bbf42eae7b3
import argparse import cgi import mimetypes import os import posixpath import shutil import stat import tempfile from importlib import import_module from urllib.request import urlretrieve import django from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.core.m...
c6eb58a9612c2d89039ed39be9b7c8bc251570be6750ed00a354e315f77750ad
""" Module for abstract serializer/unserializer base classes. """ import pickle from io import StringIO from django.core.exceptions import ObjectDoesNotExist from django.db import models DEFER_FIELD = object() class PickleSerializer: """ Simple wrapper around pickle to be used in signing.dumps()/loads() and...
8040b73afbb696a0fb8a525b6f9f9d3e916cb2d0102f165ba159370993d21dd2
"File-based cache backend" import glob import hashlib import os import pickle import random import tempfile import time import zlib from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.core.files import locks from django.core.files.move import file_move_safe class FileBasedCache(BaseCac...
072b3fd4c05b9fa05be38858a306d789e07317ceec679a70d60a769c84587bad
"Database cache backend." import base64 import pickle from datetime import datetime from django.conf import settings from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.db import DatabaseError, connections, models, router, transaction from django.utils import timezone class Options: ...
1c3ee9506dc2939b3e7596cfd7d94c73009463ea1930d8e4cb52c3ca45a998ab
"""Redis cache backend.""" import random import re from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.core.serializers.base import PickleSerializer from django.utils.functional import cached_property from django.utils.module_loading import import_string class RedisSerializer(PickleSe...
7d63da2d97a3c42db1ea85283957b4803d70a29352d1d7648cf491095763259e
"Misc. utility functions/classes for admin documentation generator." import re from email.errors import HeaderParseError from email.parser import HeaderParser from inspect import cleandoc from django.urls import reverse from django.utils.regex_helper import _lazy_re_compile from django.utils.safestring import mark_sa...
99aa888404858c46c82e253ae3a33c22afbfe1113df81b6c01f47e7da7a1fb68
import inspect from importlib import import_module from inspect import cleandoc from pathlib import Path from django.apps import apps from django.contrib import admin from django.contrib.admin.views.decorators import staff_member_required from django.contrib.admindocs import utils from django.contrib.admindocs.utils i...
d5a85ffc8bb2c0f641d642fd86795bdcb775b8b038937788bccb426a0f1c6261
from psycopg2.extras import ( DateRange, DateTimeRange, DateTimeTZRange, NumericRange, ) from django.apps import AppConfig from django.db import connections from django.db.backends.signals import connection_created from django.db.migrations.writer import MigrationWriter from django.db.models import CharField, Orde...
1a10ed057ad5fe41dcf04d28d6f819fa6575ee79c313bcd858bddd5228f521ed
import base64 import binascii import functools import hashlib import importlib import math import warnings from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.signals import setting_changed from django.dispatch import receiver from django.utils.crypto import ( ...
6bae88b5b8880123e5e5a05b9b1c1802151f821bb4b37b0e19d7a82fc70d9fdd
import copy import json import re from functools import partial, 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.checks import ( BaseMo...
86de4d0c184bf14a327d46290d63b899f81dc9de9e27e98c4f53fb335ab1bb41
""" 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...
80502ccf966e5ad45926f8e05dc0bf3ac4cd3a6146ebc4d98adc5d971494476a
from django.core.serializers.base import ( PickleSerializer as BasePickleSerializer, ) from django.core.signing import JSONSerializer as BaseJSONSerializer JSONSerializer = BaseJSONSerializer PickleSerializer = BasePickleSerializer
dbde2859c01043e2cd1409a6cf406a4fbdd18f02a222d83144d332a6c938aa5b
import binascii import json from django.conf import settings from django.contrib.messages.storage.base import BaseStorage, Message from django.core import signing from django.http import SimpleCookie from django.utils.safestring import SafeData, mark_safe class MessageEncoder(json.JSONEncoder): """ Compactly...
7735d187f1f1167033c43728cb16000fef37a2afcf3d91d4e2d74fbf67c2711a
import warnings from django.contrib.postgres.fields import ArrayField from django.db.models import ( Aggregate, BooleanField, JSONField, TextField, Value, ) from django.utils.deprecation import RemovedInDjango50Warning from .mixins import OrderableAggMixin __all__ = [ 'ArrayAgg', 'BitAnd', 'BitOr', 'BoolAnd'...
c5a26339d36d7ca9ffa4cc8e67464294dff7cfb8ea5c9345694af840935565e4
""" DataSource is a wrapper for the OGR Data Source object, which provides an interface for reading vector geometry data from many different file formats (including ESRI shapefiles). When instantiating a DataSource object, use the filename of a GDAL-supported data source. For example, a SHP file or a TIGER/Line...
ebaa05a3030eded51188b39704cc49de8fd0371fa496187410bbf11a75582381
from ctypes import byref, c_int from datetime import date, datetime, time from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.prototypes import ds as capi from django.utils.encoding import force_str # For more information, see the OGR...
fd2ad5e0c0aeb4411ec4fa1514425af744a3484e1c13cbedc15593e8dbba96d7
import logging from django.contrib.gis.db.models import GeometryField from django.db import OperationalError from django.db.backends.mysql.schema import DatabaseSchemaEditor logger = logging.getLogger('django.contrib.gis') class MySQLGISSchemaEditor(DatabaseSchemaEditor): sql_add_spatial_index = 'CREATE SPATIAL...
51673b97b5ab4ccb379d5f9b3dba45c281a73bbbfdfe040f3cfaceb67c660d00
from ctypes import POINTER, c_char_p, c_int, c_ubyte from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, GEOSFuncFactory from django.contrib.gis.geos.prototypes.errcheck import ( check_geom, check_minus_one, check_string, ) # This is the return type used by binary output (WKB, HEX) routines. c_uchar_p =...