hash
stringlengths
64
64
content
stringlengths
0
1.51M
30a88b6db5b18f0463f663071fab75254fc3bd3d2b07637ac15083fc54e64025
from django.core.serializers.json import DjangoJSONEncoder from django.db import models from .fields import ( ArrayField, BigIntegerRangeField, CICharField, CIEmailField, CITextField, DateRangeField, DateTimeRangeField, DecimalRangeField, EnumField, HStoreField, IntegerRangeField, JSONField, SearchVectorFi...
3d8c50af816cf47c686ff8b8b3d6eadd1197dbb18e95f16477527b30b9def887
from django.db import models class Author(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() friends = models.ManyToManyField('self', blank=True) class Publisher(models.Model): name = models.CharField(max_length=255) num_awards = models.IntegerField() class Book...
12e4b864922bb7c52c50ddaccb5dbc0f571b5f8e7804243b53670b46be6c3d3d
from django.db import IntegrityError, transaction from django.test import TestCase, skipIfDBFeature from .models import Bar, Business, Employee, Foo class BasicCustomPKTests(TestCase): @classmethod def setUpTestData(cls): cls.dan = Employee.objects.create( employee_code=123, first_name="D...
d98ac01f82549eaf6bf3e4d8dd3093f5bc783ffea6b5167969aa396d685114b6
from django import forms from django.contrib import admin from django.db import models from .models import ( Author, BinaryTree, CapoFamiglia, Chapter, Child, ChildModel1, ChildModel2, Consigliere, EditablePKBook, ExtraTerrestrial, Fashionista, FootNote, Holder, Holder2, Holder3, Holder4, Holder5, Inner, I...
3e96d7abd670543165b6a418d6b005fdee9589262c811c705cbe8f2788c01aac
""" A series of tests to establish that the command-line management tools work as advertised - especially with regards to the handling of the DJANGO_SETTINGS_MODULE and default settings.py files. """ import os import re import shutil import socket import subprocess import sys import tempfile import unittest from io imp...
b3ba8facc32f06a5c4edc6d4d843f9dce8915f3322434d9836b75e7a8498cdff
import unittest from django.core.checks import Error, Warning from django.core.checks.model_checks import _check_lazy_references from django.db import connection, connections, models from django.db.models.functions import Lower from django.db.models.signals import post_init from django.test import SimpleTestCase, Test...
b297239b8de2587f1f6fc7725cf22f96dd7886ea574d50569640a11cc258e4c7
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.test import SimpleTestCase, TestCase, skipUnlessDBFeature from .models import ( ChildModel, Product, UniqueConst...
3b4d789892e5e5cd70abfdf5ac79345324b5ffe89155934c03fbeb8d9fb1ad92
from django.db import models class Product(models.Model): price = models.IntegerField(null=True) discounted_price = models.IntegerField(null=True) class Meta: required_db_features = { 'supports_table_check_constraints', } constraints = [ models.CheckConstra...
845d1138df321ec54dc6d0a7e6115e5fc0d6d6961edbd64e5ac8c4d333cb696e
""" Tests for F() query expression syntax. """ import uuid from django.db import models class Manager(models.Model): name = models.CharField(max_length=50) class Employee(models.Model): firstname = models.CharField(max_length=50) lastname = models.CharField(max_length=50) salary = models.IntegerFie...
02b62020deefff05bf5c0354843dc31a8d0f0821501b2924f68c4b9f65a14637
""" The lookup API This demonstrates features of the database API. """ from django.db import models from django.db.models.lookups import IsNull class Alarm(models.Model): desc = models.CharField(max_length=100) time = models.TimeField() def __str__(self): return '%s (%s)' % (self.time, self.des...
b065e702d07bdb6488b8956b1a3f581544248bd7b7dbda9b9e0ad5494991d66d
from django.contrib.auth.models import User from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.db import models class Review(models.Model): source = models.CharField(max_length=100) content_type = mo...
069641773d105f8a8b36e9162a68cad07b5acc7c1de842bc1c5e0452f3063156
import gettext import os import re from datetime import datetime, timedelta from importlib import import_module import pytz from django import forms from django.conf import settings from django.contrib import admin from django.contrib.admin import widgets from django.contrib.admin.tests import AdminSeleniumTestCase f...
1d7c318c2841edb13e6ae3c9cefd6a380518c83ddade0a09196ebbcc2c016d33
import os import unittest from django.core.files.uploadedfile import ( SimpleUploadedFile, TemporaryUploadedFile, ) from django.forms import ( ClearableFileInput, FileInput, ImageField, ValidationError, Widget, ) from django.test import SimpleTestCase from . import FormFieldAssertionsMixin try: from PIL ...
535cbc0609bdeea412b7bbe95c11a7fd2b97120806e4198b1a1855cf3c8eb564
import re from django.forms import RegexField, ValidationError from django.test import SimpleTestCase class RegexFieldTest(SimpleTestCase): def test_regexfield_1(self): f = RegexField('^[0-9][A-F][0-9]$') self.assertEqual('2A2', f.clean('2A2')) self.assertEqual('3F3', f.clean('3F3')) ...
4886b997fa964d50354a5dfd12fe8ba8c57f82dbab4681ce82da777961e87b5d
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...
63688958abcfff9504576dc4f1ea2902e6a3aa514738facec2a9e7f3e72b0646
import decimal from django.core.management.color import no_style from django.db import NotSupportedError, connection, transaction from django.db.backends.base.operations import BaseDatabaseOperations from django.db.models import DurationField from django.test import ( SimpleTestCase, TestCase, TransactionTestCase,...
4f24fd33cfb774145710d4096d5790ba3b5ff11a18d456803c3a8a8c20cca8c3
""" Sphinx plugins for Django documentation. """ import json import os import re from docutils import nodes from docutils.parsers.rst import Directive from docutils.statemachine import ViewList from sphinx import addnodes from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.directives.code import CodeBlo...
575e85c731de895ce5ed43ac4d036880d816b53366aebcabb7e3533bcfdeec44
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 ...
1a13e29090741a421cb1de7c863cc779dc05c7e8ed24cf2369ad2074157ff9ef
from django.db import models from django.db.migrations.operations.base import Operation from django.db.migrations.state import ModelState from django.db.models.options import normalize_together from django.utils.functional import cached_property from .fields import ( AddField, AlterField, FieldOperation, RemoveFie...
8fefd0ff1761acb7784de9ecdb73d6290e99ecab2a4deabb2b995deb0fd50111
from django.core.exceptions import FieldDoesNotExist from django.db.models import NOT_PROVIDED from django.utils.functional import cached_property from .base import Operation from .utils import field_is_referenced, field_references, get_references class FieldOperation(Operation): def __init__(self, model_name, n...
fd763324c3bfbcad7a82cb225a4a25090e4e225e6c262b0f1e7a028575c360fc
from collections import namedtuple from django.db.models.fields.related import RECURSIVE_RELATIONSHIP_CONSTANT def resolve_relation(model, app_label=None, model_name=None): """ Turn a model class or model reference string and return a model tuple. app_label and model_name are used to resolve the scope o...
67b5b4aece288ad87f90cb4984dcd207d726b58eb823a5d760dfbf0bdc125909
from django.core.exceptions import FieldDoesNotExist from django.db import ( IntegrityError, connection, migrations, models, transaction, ) from django.db.migrations.migration import Migration from django.db.migrations.operations import CreateModel from django.db.migrations.operations.fields import FieldOperation f...
29c8d0c41ed6aa05e4cf77bf9dc9d114ae5d060033e1250d6bac49a3b268b52e
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....
b918c84087fff4ab5138102ac16309187c1968a3beba39daeacc20285ae1262f
import os from io import StringIO from unittest import mock from admin_scripts.tests import AdminScriptTestCase from django.apps import apps from django.core import management from django.core.management import BaseCommand, CommandError, find_commands from django.core.management.utils import ( find_command, get_r...
4a55bddd7890abbc5008360807b70205c038f4919f9ea43b45cd77742827da5e
from django.core.exceptions import ImproperlyConfigured from django.core.handlers.wsgi import WSGIHandler, WSGIRequest, get_script_name from django.core.signals import request_finished, request_started from django.db import close_old_connections, connection from django.test import ( RequestFactory, SimpleTestCase, ...
69c54d27a972ece6976f77a49ca5e4d9cd190ed3b32a92818bd4510e2db42931
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...
badb874b7a47458dc972f129dace4470706229d092d2bda7c9d9d035c4f937c5
import decimal from django.db import NotSupportedError, connection from django.db.backends.base.operations import BaseDatabaseOperations from django.db.models import DurationField from django.test import ( SimpleTestCase, TestCase, override_settings, skipIfDBFeature, ) from django.utils import timezone class Sim...
1434501baa9e8809663e73c0a433fff50eaf7f32042d5ec90e5f18c283747f74
""" 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 ( ...
2deaa8e695b267f18343271e9ed7f9f344c5e7705fc71acc3622d91524efd6e8
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: ...
1e8f2f83791522e88741028cde1fe574d16976cb7057aea1cad262e3a0fd65b6
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 DatabaseError, NotSupportedError, models from django.db.backends.base.operations import BaseDatabaseOperations from...
5033672ce511f4b6d94560effb269a8fc298be36425857d5c640db93184dcdad
"""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,...
5c1e14898d4a88373ab57d1253197ba917c10da0dddc7757061d1696602af5c7
from django.contrib.admin import ModelAdmin, TabularInline from django.contrib.admin.helpers import InlineAdminForm from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models import ContentType from django.test import Requ...
f9718ed518a1d48cce6d3c65fd304a8312f8233e67199ae0fbb4d4c120d3ecc9
import unittest from django.core.management.color import no_style from django.db import connection from ..models import Person, Tag @unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests') class OperationsTests(unittest.TestCase): def test_sequence_name_truncation(self): seq_name = connectio...
240a15a3cfab5fe65743e37e238bb557da9bb469b13d0358828a39b160afb4e4
import unittest from django.core.management.color import no_style from django.db import connection from django.test import TestCase from ..models import Person, Tag @unittest.skipUnless(connection.vendor == 'sqlite', 'SQLite tests.') class SQLiteOperationsTests(TestCase): def test_sql_flush(self): self....
a15d9880839055893ea15d271b36456d4d5c456d332e1b9497e1cdcf197c56c9
import decimal from django.core.management.color import no_style from django.db import NotSupportedError, connection, transaction from django.db.backends.base.operations import BaseDatabaseOperations from django.db.models import DurationField from django.test import ( SimpleTestCase, TestCase, TransactionTestCase,...
624dc27e68862086fa6f985dc8c999f0e34bea9dc0f1b5040064c9a388a327be
from django.utils.version import get_version VERSION = (3, 2, 0, 'alpha', 0) __version__ = get_version(VERSION) def setup(set_prefix=True): """ Configure the settings (this happens as a side effect of accessing the first setting), configure logging and populate the app registry. Set the thread-local...
2d24f459a92536df3edbaa2df90b5c7e910a86ec2aba6944f11c07c66e6683e3
#!/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.' ...
8016cecb6700ac2889fa491b690d7e78988ad541dc7f06a683bd7fb3ebd04a3f
# 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...
e1c2a9ea8a3162febff72da272993c3f6c0f9913440a67ea6793f0003077e8f9
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...
e730da1525beca74e84e63120120758ec7c43b2b7d3ce1043ab9cf7a8c749d78
import asyncio import difflib import json import posixpath import sys import threading import unittest import warnings 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 _Debug...
744a95716a8d4381e5596dc41acd5c8d0e8865de4e5cc1cbbc109ef5b832d267
""" Views and functions for serving static files. These are only to be used during development, and SHOULD NOT be used in a production setting. """ import mimetypes import posixpath import re from pathlib import Path from django.http import ( FileResponse, Http404, HttpResponse, HttpResponseNotModified, ) from dja...
f82c2bd3a1b20245481d28f76a13f1df68a6e7e5648782e03ed1b692b20a92ca
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...
7eecf87e01f3f35e894505239f06e2a765a07c3b9f5fbd09e9e3e69fbdd4c814
import functools import re import sys import types from pathlib import Path from django.conf import settings from django.http import Http404, HttpResponse, HttpResponseNotFound from django.template import Context, Engine, TemplateDoesNotExist from django.template.defaultfilters import pprint from django.urls import re...
f2e5ad93ee2fe435d8d4c479854f001701f5a46fa3fcefb5ca1f6b1e122c4af8
""" 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 ####...
26ca2c6185dc44daa71d2082d956a3716e6d0b82a793151be603989835114646
# These classes override date and datetime to ensure that strftime('%Y') # returns four digits (with leading zeros) on years < 1000. # https://bugs.python.org/issue13305 # # Based on code submitted to comp.lang.python by Andrew Dalke # # >>> datetime_safe.date(10, 8, 2).strftime("%Y/%m/%d was a %A") # '0010/08/02 was a...
b093ffba4204a5e370b3926fbca4f0827506a4e5500b9ddcfa29699a9eba9dcd
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...
d12459a6f55313d2898dfa03933f7ea3debabda6501421dab376696b59406ac5
import html.entities import re import unicodedata import warnings from gzip import GzipFile from io import BytesIO from django.utils.deprecation import RemovedInDjango40Warning from django.utils.functional import SimpleLazyObject, keep_lazy_text, lazy from django.utils.regex_helper import _lazy_re_compile from django....
2403d4288b1eb7c7ee170413d85623c9347cce3256bf742995a04dd270157614
class CyclicDependencyError(ValueError): pass def topological_sort_as_sets(dependency_graph): """ Variation of Kahn's algorithm (1962) that returns sets. Take a dependency graph as a dictionary of node => dependencies. Yield sets of items in topological order, where the first set contains al...
b4db356825740a5247272d9062eaab4a857656f33103abd08883e42852cb3d2c
import asyncio import inspect import warnings from asgiref.sync import sync_to_async class RemovedInDjango40Warning(DeprecationWarning): pass class RemovedInDjango41Warning(PendingDeprecationWarning): pass RemovedInNextVersionWarning = RemovedInDjango40Warning class warn_about_renamed_method: def _...
b2e2ad6396a3cf09a8d25363f7b043e379be8cbebd82b54f670e709d71cadd4e
""" PHP date() style date formatting See http://www.php.net/date for format strings Usage: >>> import datetime >>> d = datetime.datetime.now() >>> df = DateFormat(d) >>> print(df.format('jS F Y H:i')) 7th October 2003 11:39 >>> """ import calendar import datetime import time from email.utils import format_datetime as ...
2876e582f970c5b51c8a0366bdde580d7a1ad679d407f590ade57a476aae2a5a
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...
1648078c7e656ddf62d17fa872426554ae9301af22ab6daa477635aab9e62c36
"""JsLex: a lexer for Javascript""" # Originally from https://bitbucket.org/ned/jslex import re class Tok: """ A specification for a token class. """ num = 0 def __init__(self, name, regex, next=None): self.id = Tok.num Tok.num += 1 self.name = name self.regex = re...
01ca5a91123f00e89500dedce2bc1abb15dadae8dffeaf2d312ab010525e80c0
""" 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...
b1b495fd2974eda5c515cf25459e780e7fa7f402217c3f6cb06295df690fcb75
"""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....
e8f959367f98a84100478526411f1a72c47a0b2aa365e2b2be8a05e40c282537
"""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....
cb38b568c29066da710653aa0a5e9a1acfa6e08d3bad476003f93fdb0ad538ee
""" This module converts requested URLs to callback view functions. URLResolver is the main class here. Its resolve() method takes a URL (as a string) and returns a ResolverMatch object which provides access to all attributes of the resolved URL match. """ import functools import inspect import re import string from i...
7e35e2363dbce61af71b23428b616f87269617d32c594dc92fbbf9a832d20b07
""" HTML Widget classes """ import copy import datetime import warnings from collections import defaultdict from itertools import chain from django.conf import settings from django.forms.utils import to_current_timezone from django.templatetags.static import static from django.utils import datetime_safe, formats from...
b666974d7daabf14520ff4b5036cd4dc15c185420174295d902f63abbc4b3b46
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...
0b8133136dc3e360a4f02f7288ddc46e7e0adcf4716dc79e8a8bf1e16a215eb9
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...
0256ed7d33177cdb174650f62e898e500060a45556594bb0674cdd867da23bb7
import cgi import codecs import copy import warnings from io import BytesIO from itertools import chain from urllib.parse import quote, urlencode, urljoin, urlsplit from django.conf import settings from django.core import signing from django.core.exceptions import ( DisallowedHost, ImproperlyConfigured, RequestDat...
907cbdfe681e6ee50701b00c16b149d5b69d58426f6de647fd8319035142ff34
import warnings from django.urls import include, re_path from django.utils.deprecation import RemovedInDjango40Warning from django.views import defaults __all__ = ['handler400', 'handler403', 'handler404', 'handler500', 'include', 'url'] handler400 = defaults.bad_request handler403 = defaults.permission_denied handl...
c0261308a2bddef02e86c8e2879b14da723aafad68562b5f005cee033e523c02
""" LANG_INFO is a dictionary structure to provide meta information about languages. About name_local: capitalize it as if your language name was appearing inside a sentence in your language. The 'fallback' key can be used to specify a special fallback logic which doesn't follow the traditional 'fr-ca' -> 'fr' fallbac...
12d9d92ebd1b8b6fb24a18327ce22c78d55152d590129d7ed0de455b9810bf8b
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j E Y ж.' TIME_FORMAT = 'G:i' DATETIME_FORMAT = 'j E Y ж. G:i' YEAR_MONTH_FORMAT = 'F Y ж.' MONTH_D...
c5ab938354fd16d5a3adcdb1c1e714fcc1c5d151549cb81253905bfd25eee39b
"""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...
495a5f280f1d7f8d707fb43e5aa365b8e4415a12f8a47880bf914db9f58ff4ba
import warnings from io import StringIO from django.template.base import TRANSLATOR_COMMENT_MARK, Lexer, TokenType from django.utils.regex_helper import _lazy_re_compile from . import TranslatorCommentWarning, trim_whitespace dot_re = _lazy_re_compile(r'\S') def blankout(src, char): """ Change every non-wh...
531b576146d1042fc6d7c63026e440c74a641c0c469e78db6754ed6c1a2b92a2
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 ...
5f028616dd09e0facb543a295b937105cc2ae0bb768959977cb3c8962d5cd627
""" 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...
cd7f5851a89b79eedc65c1686bdac2bdb2f38eaa563c01e72c9e7bef22a28fd6
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...
9a3e3cd1f9c359373b966c91a2a7aa2d2b396a52c0abc59cc1923a43c2a4cefc
import copy import datetime import inspect from decimal import Decimal from django.core.exceptions import EmptyResultSet, FieldError from django.db import NotSupportedError, connection from django.db.models import fields from django.db.models.constants import LOOKUP_SEP from django.db.models.query_utils import Q from ...
d5827e0de182b692778e44aa89b6d2e56f2ed2d59b90ff2982bd4a3b46168edd
""" 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 ...
7d89d842b042b0d553bfd1f6f8385cd8685cf82b6a9a2ef8532d49c02c086175
import collections import re from functools import partial from itertools import chain from django.core.exceptions import EmptyResultSet, FieldError from django.db import DatabaseError, NotSupportedError from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import OrderBy, Random, RawSQL,...
13ae27e129838354d5cefab0887a9ed6457a1c4cb708936a4825326c8be565a5
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...
e980919c4bf71e1108633b2fce5770d04ceab25265dab4f4a7153b9001ed0758
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: ...
ead194780716b71aea0f48bf3a508a330b441baa3e72d479b0fe33f00107e15c
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...
75f6b3aff74878145ae7bb112a24f6e53c8b682e07b8d6e1de6e39392fae72c4
import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.utils import timezone from django.utils.duration import duration_microseconds from django.utils.encoding import force_str class DatabaseOperations(BaseDatabaseOperations): compiler_modul...
6a115090614d7582c22a774df2ae45867b4722f8b5a3bd16f8698fa0826479f3
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...
bf01168b52404d3669faec51a98d0f0e099dfe5e1bf2645796786b18c7315105
import re from collections import namedtuple import sqlparse from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) from django.db.models import Index from django.utils.regex_helper import _lazy_re_compile FieldInfo = namedtuple('FieldInfo', BaseFi...
92e6b726d6ccf5895cab19c9b183cfeacda2e0af011b98521a8f15f939e5d082
from itertools import chain from django.utils.itercompat import is_iterable class Tags: """ Built-in tags for internal checks. """ admin = 'admin' async_support = 'async_support' caches = 'caches' compatibility = 'compatibility' database = 'database' models = 'models' security...
1a7ac0841ae5159e295114e6ba3fc5edacb504bfb3f618de8dfdebd567fac965
""" Base classes for writing management commands (named commands which can be executed through ``django-admin`` or ``manage.py``). """ import os import sys import warnings from argparse import ArgumentParser, HelpFormatter from io import TextIOBase import django from django.core import checks from django.core.exceptio...
4f5afe8f963c85598feaf166f018090075c928cd9389ca0601bfb647c1260c9e
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.management.utils ...
4842a53cfbd86aed058103efe3013a583cca2bf00aa065d51449277c1035f3cf
""" A Python "serializer". Doesn't do much serializing per se -- just converts to and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for other serializers. """ from django.apps import apps from django.core.serializers import base from django.db import DEFAULT_DB_ALIAS, models from django...
86164690674745fe425e9110f5d995c405f408e6992787ceac6f1bda0049ac29
""" XML serializer. """ from xml.dom import pulldom from xml.sax import handler from xml.sax.expatreader import ExpatParser as _ExpatParser from django.apps import apps from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.core.serializers import base from django.db import...
52844409c369c522d05ff4e3c0b8582c58c63952b37eaefbfec0ee824e644a04
import asyncio import logging import types from asgiref.sync import async_to_sync, sync_to_async from django.conf import settings from django.core.exceptions import ImproperlyConfigured, MiddlewareNotUsed from django.core.signals import request_finished from django.db import connections, transaction from django.urls ...
4e7a2712d06dde59d2a345734922b5f68eab39c47dd922115e788e77f92bd79d
import mimetypes from email import ( charset as Charset, encoders as Encoders, generator, message_from_string, ) from email.errors import HeaderParseError from email.header import Header from email.headerregistry import Address, parser from email.message import Message from email.mime.base import MIMEBase from emai...
5654f482e0edda3ef32e7f5cae41d23abc37d4a0e2fce08fea09ac83a5f71cc8
import sys import time from importlib import import_module from django.apps import apps 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 django.db import DEFAULT_DB_ALIAS, c...
168ad45ee0e55435d6aedeb178ca3a6c2f04dd7a02f60d81933146f2582a5198
from django.apps import apps from django.core import checks from django.core.checks.registry import registry from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = "Checks the entire Django project for potential problems." requires_system_checks = [] def add...
7a35e328e260235638d6574729a737e25058641e2eb0a6b983c88d8c60989071
import errno import os import re import socket import sys from datetime import datetime from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.core.servers.basehttp import ( WSGIServer, get_internal_wsgi_application, run, ) from django.utils import autoreload...
f1f10726dc3e9389d7f1f80b0367041c4892d8f613d909a19bce899d916c6cc3
from django.core.management import call_command from django.core.management.base import BaseCommand from django.db import connection class Command(BaseCommand): help = 'Runs a development server with data from the given fixture(s).' requires_system_checks = [] def add_arguments(self, parser): pa...
b713e0be6030d83113913252c062695630589142926fe1ef1dda0f0be7f05a62
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...
faf6c518ed97947b912af5038abe53d1b1f0bb0bd0c92c1b33b4b15eedb3061f
import codecs import concurrent.futures import glob import os from django.core.management.base import BaseCommand, CommandError from django.core.management.utils import ( find_command, is_ignored_path, popen_wrapper, ) def has_bom(fn): with open(fn, 'rb') as f: sample = f.read(4) return sample.st...
0bcca29446a30c32af923765e17313ddcf33d28c74f2a7e87d333296efc6def2
import functools import glob import gzip import os import sys import warnings import zipfile from itertools import product from django.apps import apps from django.conf import settings from django.core import serializers from django.core.exceptions import ImproperlyConfigured from django.core.management.base import Ba...
48183b899a4ae59efe7987382a437230dc91b0047c5d87fce34f77ea38f347e8
import sys from django.conf import settings from django.core.management.base import BaseCommand from django.core.management.utils import get_command_line_option from django.test.utils import get_runner class Command(BaseCommand): help = 'Discover and run tests in the specified modules or the current directory.' ...
e2cd53ec355b80ee2a38d42a80d4aab1df7ebf1cfbbd17e1c9748cdc9325d8d1
from django.conf import settings from django.core.cache import caches from django.core.cache.backends.db import BaseDatabaseCache from django.core.management.base import BaseCommand, CommandError from django.db import ( DEFAULT_DB_ALIAS, DatabaseError, connections, models, router, transaction, ) class Command(Bas...
ff125eb2bd904de2555eb1691683aa0dedbd0f3cfbc5d02407815b8008e8d541
import subprocess from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections class Command(BaseCommand): help = ( "Runs the command-line client for specified database, or the " "default database if none is provided." ) requires_s...
e1430415a7e643204538d890c9ced276f239584e4f227e48ccf7975c950529a3
import glob import os import re import sys from functools import total_ordering from itertools import dropwhile import django from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.files.temp import NamedTemporaryFile from django.core.management.base import BaseComman...
ee4c9e8694e36ee7e6af16150b0f9252f9b500583c4fc523a9615c0236cba4ac
import keyword import re from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections from django.db.models.constants import LOOKUP_SEP class Command(BaseCommand): help = "Introspects the database tables in the given database and outputs a Django model mod...
4c2357ceea22fb93afef4884866bd9ab2c79afeb0d0e1725c50a7e4fe941678f
import os import sys import warnings from itertools import takewhile from django.apps import apps from django.conf import settings from django.core.management.base import ( BaseCommand, CommandError, no_translations, ) from django.db import DEFAULT_DB_ALIAS, OperationalError, connections, router from django.db.mig...
1fce8706f95c84dce5abca13dc961b00fb53085143918d0a686ed3f73dec68a3
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...
b421066d5e7e3723baaa42c85e397e317f244fd0607d692226ece091f3b532ca
"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...
5758125eaae4739abd838d95ecf51ac06256f5117312a3b08af7d477d1b04ac3
from django.db import NotSupportedError from django.db.models import Index from django.utils.functional import cached_property __all__ = [ 'BloomIndex', 'BrinIndex', 'BTreeIndex', 'GinIndex', 'GistIndex', 'HashIndex', 'SpGistIndex', ] class PostgresIndex(Index): @cached_property def max_name_length(...