hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
a3dc70bca9f6848b21b9a6789de6b811cc7e8c18714f33c32e0d96fa0ca090bc | # 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... |
a16dcfbfdf0e57a7ff1f63e2a468709b62cde188c3bba3eaeb1f9b9c27a97e9c | """
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 (
... |
fd553504f8e84cc31f68de4eb984646a4097a42f24aef3f31170d5b438bae899 | import bisect
import copy
import inspect
from collections import defaultdict
from django.apps import apps
from django.conf import settings
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
from django.db import connections
from django.db.models import Manager
from django.db.models.fields impor... |
ce0316c0c08ab9eb5b5668170215acb2c2c5d4cc2fceff8a9e1f29b34d8b2e90 | import enum
from django.utils.functional import Promise
__all__ = ['Choices', 'IntegerChoices', 'TextChoices']
class ChoicesMeta(enum.EnumMeta):
"""A metaclass for creating a enum choices."""
def __new__(metacls, classname, bases, classdict):
labels = []
for key in classdict._member_names:
... |
fe0075ab052d55706724dd7a5bdc616e856bf0b8a3dede13bc938df8d4ede441 | import collections.abc
import copy
import datetime
import decimal
import operator
import uuid
import warnings
from base64 import b64decode, b64encode
from functools import partialmethod, total_ordering
from django import forms
from django.apps import apps
from django.conf import settings
from django.core import checks... |
f49f073e13a9b88fd5e16343f3f8e5d7bfd31b4d0c36e6661e2c5c78e89f0919 | import datetime
import posixpath
from django import forms
from django.core import checks
from django.core.files.base import File
from django.core.files.images import ImageFile
from django.core.files.storage import default_storage
from django.db.models import signals
from django.db.models.fields import Field
from djang... |
4b8ed258588ca7e5a1f1d4f970b09362491828c6a65d044f148a30102edbabf8 | """
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 ... |
91fed619fada909a63688911f201aedc3ac43dd887926b29a0fcbf38e0376c69 | import datetime
import uuid
from functools import lru_cache
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.utils import strip_quotes, truncate_name
from django.db.models.expressions import Exists, ExpressionWrapper, RawSQL
from django.db.m... |
8bd406902cf507ab00d4c7273b90001a7b3970b4e79ebc361beb8e90c7517601 | 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:
... |
d7d31ac8fe69674329fbfef9a5bf82c21fe786209bd090c23aa22d6fbb7d45c4 | 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... |
a5d46e6a99ec8b258b573282b594ab4972511b7da24ba2f5a0e7b0c8f46bd9bb | from psycopg2.extras import Inet
from django.conf import settings
from django.db import NotSupportedError
from django.db.backends.base.operations import BaseDatabaseOperations
class DatabaseOperations(BaseDatabaseOperations):
cast_char_field_without_max_length = 'varchar'
explain_prefix = 'EXPLAIN'
cast_... |
82d53d4882bc0ad56e211361181a44d984644e81453c746d310cb3d087192ddd | import datetime
import decimal
import uuid
from functools import lru_cache
from itertools import chain
from django.conf import settings
from django.core.exceptions import FieldError
from django.db import utils
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.models import aggregates... |
0a4cb023b6b91efcf259e2712866a3e7800a2329dfc5232cc06820e8d555d8b3 | from django.conf import settings
from django.utils.translation import get_supported_language_variant
from django.utils.translation.trans_real import language_code_re
from . import Error, Tags, register
E001 = Error(
'You have provided an invalid value for the LANGUAGE_CODE setting: {!r}.',
id='translation.E00... |
6c27e1fe8763a85ecce971a0449722625c0dc0475b5ba4c55d53181fe38944c8 | from django.contrib.admin.decorators import register
from django.contrib.admin.filters import (
AllValuesFieldListFilter, BooleanFieldListFilter, ChoicesFieldListFilter,
DateFieldListFilter, EmptyFieldListFilter, FieldListFilter, ListFilter,
RelatedFieldListFilter, RelatedOnlyFieldListFilter, SimpleListFilt... |
e112d5771081126fedfae7a6feef64abb06123c40a1c818d44b31778a2ae0ffd | 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... |
4fac2d13a127f6726b995557169aec0c432453bf82091c84bae666196edc18f1 | """
This encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
import datetime
from django.contrib.admin.op... |
b94eb67f8e16caab74a74feabc2c954c5a5da646ef3d99a6796252876b648a8a | from unittest import mock, skipUnless
from django.conf.global_settings import PASSWORD_HASHERS
from django.contrib.auth.hashers import (
UNUSABLE_PASSWORD_PREFIX, UNUSABLE_PASSWORD_SUFFIX_LENGTH,
BasePasswordHasher, PBKDF2PasswordHasher, PBKDF2SHA1PasswordHasher,
check_password, get_hasher, identify_hasher... |
6ac926f8fd00a728c0306ef12cf958fd0df662f9da208937353fa4a88ded486a | import uuid
from django.core.exceptions import ImproperlyConfigured
from django.test import SimpleTestCase
from django.test.utils import override_settings
from django.urls import NoReverseMatch, Resolver404, path, resolve, reverse
from .converters import DynamicConverter
from .views import empty_view
included_kwargs... |
c81e83bb71bc117ea6ccfdab247c5f8ff7043862b151ed151e619533ec6c58ab | from django.urls import path, re_path, register_converter
from . import converters, views
register_converter(converters.DynamicConverter, 'to_url_value_error')
urlpatterns = [
# Different number of arguments.
path('number_of_args/0/', views.empty_view, name='number_of_args'),
path('number_of_args/1/<valu... |
da572fa836d36ead6ba54d280788c8ee0d2936098a523e827159e997d615d88f | import datetime
import re
from decimal import Decimal
from django.core.exceptions import FieldError
from django.db import connection
from django.db.models import (
Avg, Count, DecimalField, DurationField, F, FloatField, Func, IntegerField,
Max, Min, Sum, Value,
)
from django.db.models.expressions import Case, ... |
4c5fd4a3dc6534e7c63dc8466d7e8422e3631ab3fbed6613f504d23ab38d3d01 | import datetime
import sys
import unittest
from django.contrib.admin import (
AllValuesFieldListFilter, BooleanFieldListFilter, EmptyFieldListFilter,
ModelAdmin, RelatedOnlyFieldListFilter, SimpleListFilter, site,
)
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.auth.adm... |
ef4f763713c5cba45b9fc9ebe364c6011d1ce8ee58086032a96837b784c29de7 | import time
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse
from django.test import RequestFactory, SimpleTestCase, override_settings
from django.test.utils import require_jinja2
from django.urls import resolve
from django.views.generic import RedirectView, TemplateView, Vi... |
802ccd0c541305a17df3feec03628a7dab095d6594ad1af57d4c36c6bbcb321f | from django import forms
from django.contrib.admin import BooleanFieldListFilter, SimpleListFilter
from django.contrib.admin.options import VERTICAL, ModelAdmin, TabularInline
from django.contrib.admin.sites import AdminSite
from django.core.checks import Error
from django.db.models import F, Field, Model
from django.d... |
525fd81c5050fd24cc79ea1bde9064a87ee8cd8e41deb835b1de7a09fe72b06b | from django.db import connection
from django.db.models import Exists, F, IntegerField, OuterRef, Value
from django.db.utils import DatabaseError, NotSupportedError
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from .models import Number, ReservedName
@skipUnlessDBFeature('supports_select_uni... |
270362a8e801996608487c2d9b31eb04c15a54e04b4a0442f73f74aef335148f | import os
from django.template import Context, Engine, TemplateSyntaxError
from django.template.base import Node
from django.template.library import InvalidTemplateLibrary
from django.test import SimpleTestCase
from django.test.utils import extend_sys_path
from .templatetags import custom, inclusion
from .utils impor... |
85eadf71a95746231a126a64b46b92cbafb4ddf2771af45ab93bc363ecfc8b1a | from django.core.checks import Error
from django.core.checks.translation import (
check_language_settings_consistent, check_setting_language_code,
check_setting_languages, check_setting_languages_bidi,
)
from django.test import SimpleTestCase, override_settings
class TranslationCheckTests(SimpleTestCase):
... |
8227227f7787eca1ae8ad9e016aae9f5ab5faf66516c535494cf5fa32b1c0811 | import unittest
import uuid
from django.core.checks import Error, Warning as DjangoWarning
from django.db import connection, models
from django.test import SimpleTestCase, TestCase, skipIfDBFeature
from django.test.utils import isolate_apps, override_settings
from django.utils.functional import lazy
from django.utils.... |
959d92fea3c957a08b3161f45d5e7c8b544fe947a2a198f17b73bc43faaa28e7 | 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.utils import IntegrityError
from django.test import TestCas... |
10c4098f66acc8388fcb140431bfc2f3ab124492b716302bce6f0e54135f4520 | import os
import shutil
from unittest import skipIf
from django.core.exceptions import ImproperlyConfigured
from django.core.files import File
from django.core.files.images import ImageFile
from django.test import TestCase
from django.test.testcases import SerializeMixin
try:
from .models import Image
except Impr... |
ac777bb41898f4c8cad0d2d097e4783695df43e60e4f3180db99c5029bf40935 | import datetime
import pickle
import unittest
import uuid
from copy import deepcopy
from unittest import mock
from django.core.exceptions import FieldError
from django.db import DatabaseError, connection, models
from django.db.models import CharField, Q, TimeField, UUIDField
from django.db.models.aggregates import (
... |
8003b854d1b34101dadba9511fe7b60a253c3b4e738f750b1c72645528bd558e | import datetime
import re
import sys
from contextlib import contextmanager
from unittest import SkipTest, skipIf
from xml.dom.minidom import parseString
import pytz
from django.contrib.auth.models import User
from django.core import serializers
from django.db import connection
from django.db.models import F, Max, Min... |
20f711ce0966fcb704290db4034d112f3ac8480697f661c400a649cb39284250 | import datetime
import decimal
import ipaddress
import uuid
from django.db import models
from django.template import Context, Template
from django.test import SimpleTestCase
from django.utils.functional import Promise
from django.utils.translation import gettext_lazy as _
class Suit(models.IntegerChoices):
DIAMO... |
d5f507fd5a978d334517b9ff148de1f9a6cf1245a2fb60b3a3eda9c3376681b3 | from django.forms import FileInput
from .base import WidgetTest
class FileInputTest(WidgetTest):
widget = FileInput()
def test_render(self):
"""
FileInput widgets never render the value attribute. The old value
isn't useful if a form is updated or an error occurred.
"""
... |
7c9592f933786c282019eff0cd8409a249cef249de4687b9f333e1990804b628 | from datetime import date, datetime
from django.forms import DateTimeField, ValidationError
from django.test import SimpleTestCase
from django.utils.timezone import get_fixed_timezone, utc
class DateTimeFieldTest(SimpleTestCase):
def test_datetimefield_clean(self):
tests = [
(date(2006, 10, ... |
eec71d1e01cce483a8a046731602dcf1ad377fdc22ab679e4867dea73c0046ef | from datetime import date, datetime, time
from django import forms
from django.test import SimpleTestCase, override_settings
from django.utils.translation import activate, deactivate
@override_settings(TIME_INPUT_FORMATS=["%I:%M:%S %p", "%I:%M %p"], USE_L10N=True)
class LocalizedTimeTests(SimpleTestCase):
def se... |
3aec4bb0bcbf59c9f05e1976bfceed6367b3a22b90a973878726ce0f64d052c9 | 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... |
7621f338817f25f1ed5a66add95dd53d1a0bb304c16823614f80148123c11bbf | 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... |
2266f441976aa3b1e0bffac224ed7cf1647dcdb1bf0cc1146a2c48cb00039a11 | import operator
from django.template import Engine, Library
engine = Engine(app_dirs=True)
register = Library()
@register.inclusion_tag('inclusion.html')
def inclusion_no_params():
"""Expected inclusion_no_params __doc__"""
return {"result": "inclusion_no_params - Expected result"}
inclusion_no_params.any... |
49165a4be478c559fee59805b49fa8ba26d83ef8a4b611188c848484b538a283 | #!/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.'
... |
635f11cc57e73a2c55a855f057cc1d21c539c917f8f21e490f2260f1c8682c07 | # 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... |
4a20f1f2421990f18afa01d9f9cb529a5df9566820dc4ef68fbe0e23cc9e496d | import threading
import warnings
import weakref
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.inspect import func_accepts_kwargs
def _make_id(target):
if hasattr(target, '__func__'):
return (id(target.__self__), id(target.__func__))
return id(target)
NONE_ID = _mak... |
42d2984f12b4cfaa90424d4ce2afd04358f3b4971eec67ecfdb3dd3561e197af | """Django Unit Test framework."""
from django.test.client import (
AsyncClient, AsyncRequestFactory, Client, RequestFactory,
)
from django.test.testcases import (
LiveServerTestCase, SimpleTestCase, TestCase, TransactionTestCase,
skipIfDBFeature, skipUnlessAnyDBFeature, skipUnlessDBFeature,
)
from django.t... |
37df7d23933102a0afe27d0670c58d2016ab6fa34d8c3eb2b278294ef58a74fb | import ctypes
import itertools
import logging
import multiprocessing
import os
import pickle
import textwrap
import unittest
from importlib import import_module
from io import StringIO
from django.core.management import call_command
from django.db import connections
from django.test import SimpleTestCase, TestCase
fro... |
db0225d66aa7ac5b20fb4e34a2b58fa03058135ffa5cbfc0c2bcfa6c6a8f8b23 | 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... |
884a6a2448b963c8370358664f43226a96a42cfc664f88d58362565738ff5212 | import asyncio
import difflib
import json
import posixpath
import sys
import threading
import unittest
from collections import Counter
from contextlib import contextmanager
from copy import copy
from difflib import get_close_matches
from functools import wraps
from unittest.suite import _DebugResult
from unittest.util ... |
da06ae05ed52b56b2d8fc38de7e99f2a4f3e5a2da85f9bb2403abea45cb561e0 | import asyncio
import logging
import re
import sys
import time
import warnings
from contextlib import contextmanager
from functools import wraps
from io import StringIO
from itertools import chain
from types import SimpleNamespace
from unittest import TestCase, skipIf, skipUnless
from xml.dom.minidom import Node, parse... |
65283f75d81ec97ad3cbeac0bfbf19669414cf5f68abffb960e1159b15be26d5 | 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 ... |
76a8c867a89bf2a3d225b1b2c95ee84c042483f5a4b5f631fe4568b3dd2629b2 | import os
from importlib import import_module
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import module_has_submodule
MODELS_MODULE_NAME = 'models'
class AppConfig:
"""Class representing a Django application and its configuration."""
def __init__(self, app_name,... |
d5a345e0ec635541d76b6fe85fcfeafb042f06f88040e04b5c54507bd709efb0 | 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... |
0d2502a60dc60d6027d621e0957fc560c2f6235eab3468eea55732be8072b7d0 | 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... |
f8d6dedb794c1a17ca5ce82471717b4d4623304ed04ddf9cc17b296ebe9306d7 | """
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
####... |
3f722cec8fd77bf7af30a1f9868fecb07ca7b85993cc1eee4f2b272705be5e72 | "Functions that help with dynamically creating decorators for views."
from functools import partial, update_wrapper, wraps
class classonlymethod(classmethod):
def __get__(self, instance, cls=None):
if instance is not None:
raise AttributeError("This method is available only on the class, not ... |
5e4cf0ab8f1eeaa7b6de092e60c164a4290e53654b9dde842537554864a77d8b | # 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... |
c448a60615d509d094e305c40f066fb55a52f517367ed7ae60559a03b0e8e5ff | 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... |
bd9cb4eee815ded5304cfa8360bc89bae34ac4f9086de776a4d711653feb5146 | from decimal import Decimal
from django.conf import settings
from django.utils.safestring import mark_safe
def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
force_grouping=False, use_l10n=None):
"""
Get a number (as a number or string), and return it as a string,
u... |
620a45745f9a0f927dd8e7db9ba41b6f6069846b0b24ed57ba81a871a0f28c2b | import asyncio
import inspect
import warnings
from asgiref.sync import sync_to_async
class RemovedInNextVersionWarning(DeprecationWarning):
pass
class RemovedInDjango40Warning(PendingDeprecationWarning):
pass
class warn_about_renamed_method:
def __init__(self, class_name, old_method_name, new_method_... |
838d714ead533ca4acb421b4b03e3bf867cf2f2881d7cc3cc4217b75a9dfadc2 | import codecs
import datetime
import locale
import warnings
from decimal import Decimal
from urllib.parse import quote
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.functional import Promise
class DjangoUnicodeDecodeError(UnicodeDecodeError):
def __init__(self, obj, *args):
... |
438e1080f753343da656b65145fe2c902a12c4b0752d5f8e1d152c0d1a68ddd6 | """
Django's standard crypto functions and utilities.
"""
import hashlib
import hmac
import secrets
import warnings
from django.conf import settings
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.encoding import force_bytes
class InvalidAlgorithm(ValueError):
"""Algorithm is not ... |
10f2f536ce0d5ffa14cd867ec9660e7063fa4ad537f9e041547584e946ae6e08 | import logging
import logging.config # needed when logging_config doesn't start with logging.config
from copy import copy
from django.conf import settings
from django.core import mail
from django.core.mail import get_connection
from django.core.management.color import color_style
from django.utils.module_loading impo... |
15d4fb16e84b406c9a91081af59565ad42dad28182a415f554fc2a8dc0dcdf97 | import copy
import itertools
import operator
from functools import total_ordering, wraps
class cached_property:
"""
Decorator that converts a method with a single self argument into a
property cached on the instance.
A cached property can be made out of an existing method:
(e.g. ``url = cached_pr... |
5f4d3a4aa3e37607d06b49125838b87ee852eec427fc0ee3116553ff8a3d3d58 | import posixpath
from collections import defaultdict
from django.utils.safestring import mark_safe
from .base import (
Node, Template, TemplateSyntaxError, TextNode, Variable, token_kwargs,
)
from .library import Library
register = Library()
BLOCK_CONTEXT_KEY = 'block_context'
class BlockContext:
def __in... |
99c0b0651d4474a3249ab1b89ed7d38c5c360c4827f826cdc526d600e6edd144 | """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.... |
7b57219ce32c959d068e72e6041b9435bd983a1d648967fa7bc154866c954f9d | """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.... |
3f54c48284e8516ca7c516771a6906b582e28a0dfa7b15ac441a05f5bf96c32b | import re
from django.conf import settings
from django.http import HttpResponsePermanentRedirect
from django.utils.deprecation import MiddlewareMixin
class SecurityMiddleware(MiddlewareMixin):
# RemovedInDjango40Warning: when the deprecation ends, replace with:
# def __init__(self, get_response):
def _... |
c5cbd8e0974c039c21a1e76ab6dfce270486b891545d1b565f1275ef70edbef0 | from django.conf import settings
from django.conf.urls.i18n import is_language_prefix_patterns_used
from django.http import HttpResponseRedirect
from django.urls import get_script_prefix, is_valid_path
from django.utils import translation
from django.utils.cache import patch_vary_headers
from django.utils.deprecation i... |
e1d81461ecd23b123e3c46587e074e61a54f99822626684a14f4348fd1063127 | """
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE = [
'django.middleware.cache.UpdateCacheMiddl... |
2898147174a56f6f5b8e5345ee75ff88e49316db9e487e41b315d1c9dfa5c3a7 | """
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import logging
import re
import string
from urllib.parse import urlparse
from django.conf import settings
from django.core.exceptions import DisallowedHost, Improperl... |
67850bcfc33c8c7bf0dbe26cb5a0aef9e9ab5a48f627ea9b76628c4a7f764900 | """
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... |
fa466b2cadbaf672d91abbbcb8c304873f275444da49c728dc8cb991673b101b | """
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... |
98ef13553a93c3c6b647d2cf3ae7d68857e6801341880689733a9be7d3d46a5c | """
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... |
21169dfc68c96fc530425ab1af7a387ecd7b2e6a47110eddb3b83fd94d4192a6 | import datetime
import re
from django.forms.utils import flatatt, pretty_name
from django.forms.widgets import Textarea, TextInput
from django.utils.functional import cached_property
from django.utils.html import conditional_escape, format_html, html_safe
from django.utils.safestring import mark_safe
from django.utils... |
cb292b9861d24166ba4bc3b62620c8a8799048e3b1fb1e9989b09be4620e3f44 | """
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... |
e88447ac029a079faaf8010fdebfaedbfe11c391acb6199cc221374fd07ec277 | import json
from collections import UserList
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils import timezone
from django.utils.html import escape, format_html, format_html_join, html_safe
from django.utils.translation import gettext_lazy as _
def pretty_name(name... |
9ec52018ec6b9ce77b6a95e9bf4bc22bafe796c14309b816beb049b39a0d8c7a | """
Form classes
"""
import copy
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
from django.forms.fields import Field, FileField
from django.forms.utils import ErrorDict, ErrorList
from django.forms.widgets import Media, MediaDefiningClass
from django.utils.datastructures import MultiValueDict
f... |
d959ba6acdc4fc01204c674458b35ca2d99fe3a710dd61d75f08fadf33dc9aa5 | """
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... |
e6f8757bb2203cdefc5973e8efe84430f37db5072a252647bb458289b36077e1 | from django.dispatch import Signal
request_started = Signal()
request_finished = Signal()
got_request_exception = Signal()
setting_changed = Signal()
|
caf7da9aee66c0a90e25c37f007f82af18068b6faa80cd523e575a1a4085f4f1 | 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... |
b41f83e619c2fb543553df53f719636076a6073a04487955e88654cb871ecbdb | """
Multi-part parsing for file uploads.
Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to
file upload handlers for processing.
"""
import base64
import binascii
import cgi
import collections
import html
from urllib.parse import unquote
from django.conf import settings
from django.core.ex... |
58e385a9312b3c64c99d8bd8aeabe42bd54b7ce47964bfa1a53cbabbcd5df108 | 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... |
eb5f89b7b98097f751a672b9aa4da59622ebafc59d7c76760d14e86a90958e8f | 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... |
6c13d73b1effc99a20910c29ffcd8092302d9f8f648088c9bf07037e65d65fda | from functools import wraps
from django.middleware.cache import CacheMiddleware
from django.utils.cache import add_never_cache_headers, patch_cache_control
from django.utils.decorators import decorator_from_middleware_with_args
def cache_page(timeout, *, cache=None, key_prefix=None):
"""
Decorator for views ... |
255e4590fa10bb233c06b0c6ae65c05e7b3290c6a591bcdee645415abd04084b | import logging
import warnings
from functools import update_wrapper
from django.core.exceptions import ImproperlyConfigured
from django.http import (
HttpResponse, HttpResponseGone, HttpResponseNotAllowed,
HttpResponsePermanentRedirect, HttpResponseRedirect,
)
from django.template.response import TemplateRespo... |
c210daa4759073ae4bfa3b2958331e833186a3aa49ff8a58b03486436bee9308 | from django.core.exceptions import ImproperlyConfigured
from django.core.paginator import InvalidPage, Paginator
from django.db.models import QuerySet
from django.http import Http404
from django.utils.translation import gettext as _
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
class... |
5fa5b23ba1e13a8f27483985d9dc197c9fda986cf6cff2c26cfccb5470619f11 | 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... |
a98a152f05d89126cfd770c6b7cc4768dcebbbdbfeeeb865fef52ba5dcf7028b | # 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 F Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = 'j F Y H:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT... |
53f62d11c0673c83fd4448ecf435de6ea4bc57052de7048b8035ac1c569a2554 | """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... |
8a9718d96cfbc874ecfe1930175d9fa031544ac3712ed9718863ab01db067111 | 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... |
a8e95b6b7c2e8b0a0eb09699e2be8c1f7b516316f96bbf839d68ef41919c4ada | 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 - ... |
65398d0931b801ef9dd690ef0133762b785411e0a77e1eb78591395693d97f26 | import copy
from contextlib import contextmanager
from django.apps import AppConfig
from django.apps.registry import Apps, apps as global_apps
from django.conf import settings
from django.db import models
from django.db.models.fields.related import RECURSIVE_RELATIONSHIP_CONSTANT
from django.db.models.options import D... |
1584f3d07256fbe0bf39639426ebca9f96dbf1fbd363dbe65b2b8a73777a16fc | import pkgutil
import sys
from importlib import import_module, reload
from django.apps import apps
from django.conf import settings
from django.db.migrations.graph import MigrationGraph
from django.db.migrations.recorder import MigrationRecorder
from .exceptions import (
AmbiguityError, BadMigrationError, Inconsi... |
5cb4d9fee7e95495ff9cbe1e803106e43aaf07c7aa48652e56830d6759695de9 | from django.db import DatabaseError
class AmbiguityError(Exception):
"""More than one migration matches a name prefix."""
pass
class BadMigrationError(Exception):
"""There's a bad migration (unreadable/bad format/etc.)."""
pass
class CircularDependencyError(Exception):
"""There's an impossible... |
0efbe4b65de35aa99031546b4e9edd3430449ba6a7e4be67405af6e514a932e1 | 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... |
40051c858a4d6a46a6f9a2cec5e68ecddef6533a27ba4daee2c05443c68060f5 | 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 ... |
64e58d3f96c28ec57d4292f9e2ad238622a1772d8e7c4441e7e31610c46b9a41 | from django.apps.registry import Apps
from django.db import DatabaseError, models
from django.utils.functional import classproperty
from django.utils.timezone import now
from .exceptions import MigrationSchemaMissing
class MigrationRecorder:
"""
Deal with storing migration records in the database.
Becau... |
f6d6aa66ce6224b5e782da60a4dfc32ce4fc87ad5b8a614668fe3ac8a8cbffda | class MigrationOptimizer:
"""
Power the optimization process, where you provide a list of Operations
and you are returned a list of equal or shorter length - operations
are merged into one if possible.
For example, a CreateModel and an AddField can be optimized into a
new CreateModel, and Creat... |
b42e5c4534cc8759c66f4b041703a709223af7178caa12f258c0c99988b4a10c | """
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 (
... |
ed6b468cb29ac46b10a260d37b500ea66d2a264b5e1a80d6d7adf2e6e73c4b05 | from django.core.exceptions import ObjectDoesNotExist
from django.db.models import signals
from django.db.models.aggregates import * # NOQA
from django.db.models.aggregates import __all__ as aggregates_all
from django.db.models.constraints import * # NOQA
from django.db.models.constraints import __all__ as constraint... |
a4a4afd88843c1ff510dee02ae7197883e059fbc45b083ae77863c392f746e71 | import bisect
import copy
import inspect
from collections import defaultdict
from django.apps import apps
from django.conf import settings
from django.core.exceptions import FieldDoesNotExist
from django.db import connections
from django.db.models import AutoField, Manager, OrderWrt, UniqueConstraint
from django.db.mo... |
f5f987b72997ac24a7cb744869169106bfab8b5f320c5fbb0bdcc12edd9ee086 | import copy
import inspect
import warnings
from functools import partialmethod
from itertools import chain
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.core.exceptions import (
NON_FIELD_ERRORS, FieldDoesNotExist, FieldError, MultipleObjectsReturned,
... |
bc10692da0718ca59a459660a82f2e1c731342b09954acf74ed9370e53be3b6e | import copy
import inspect
from importlib import import_module
from django.db import router
from django.db.models.query import QuerySet
class BaseManager:
# To retain order, track each time a Manager instance is created.
creation_counter = 0
# Set to True for the 'objects' managers that are automaticall... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.