hash
stringlengths
64
64
content
stringlengths
0
1.51M
63914dea269535e156e0738ad50e36e013d3c41a6ba3d97e9712ec13dad46b71
""" Portable file locking utilities. Based partially on an example by Jonathan Feignberg in the Python Cookbook [1] (licensed under the Python Software License) and a ctypes port by Anatoly Techtonik for Roundup [2] (license [3]). [1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203 [2] https://sourcefor...
373b787cd68af4f8701e227c87607141dd0c592117087f5b7cf28442d3551f09
from itertools import chain from django.utils.itercompat import is_iterable class Tags: """ Built-in tags for internal checks. """ admin = 'admin' caches = 'caches' compatibility = 'compatibility' database = 'database' models = 'models' security = 'security' signals = 'signals...
e088c567dbb9f141603ccd5969e754ad50b9cafc097c1ad634bdf1dcbb2b5186
import inspect import types from collections import defaultdict from itertools import chain from django.apps import apps from django.core.checks import Error, Tags, register @register(Tags.models) def check_all_models(app_configs=None, **kwargs): db_table_models = defaultdict(list) indexes = defaultdict(list...
df20abbf8c46c716a2f1ad61258b66319537758c447ba93341f9f835e85db0d1
from django.conf import settings 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.E001', ) E002 = Error( 'You have provided an invalid language code...
57ce0d52922d7608064c65b4eaa3bf56143b771cd804f6edb2b3750b32c88c1d
from .messages import ( CRITICAL, DEBUG, ERROR, INFO, WARNING, CheckMessage, Critical, Debug, Error, Info, Warning, ) from .registry import Tags, register, run_checks, tag_exists # Import these to force registration of checks import django.core.checks.caches # NOQA isort:skip import django.core.checks.databas...
b44f9436fcf44bf528a5523a12ce95d58bc5f0a491b056428e8f7bccb9c067b9
import functools import os import pkgutil import sys from collections import defaultdict from difflib import get_close_matches from importlib import import_module import django from django.apps import apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.managem...
d2cf0925c2910f154ecd2a7c09e7eff32bb068c63680d20aabaad4e32c67a8a3
""" Base classes for writing management commands (named commands which can be executed through ``django-admin`` or ``manage.py``). """ import os import sys from argparse import ArgumentParser, HelpFormatter from io import TextIOBase import django from django.core import checks from django.core.exceptions import Improp...
03c75475103fcf87f5388121105ca1e52ec3e8c8974e985ce8db489cdecfef75
import fnmatch import os from pathlib import Path from subprocess import PIPE, Popen from django.apps import apps as installed_apps from django.utils.crypto import get_random_string from django.utils.encoding import DEFAULT_LOCALE_ENCODING from .base import CommandError, CommandParser def popen_wrapper(args, stdout...
8fa649bcfbb7229af0d0af442fc12ee61be287f9c92dffcac8e064614ae9d8ac
import cgi import mimetypes import os import posixpath import shutil import stat import tempfile from importlib import import_module from os import path from urllib.request import urlretrieve import django from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.co...
0f157118584567f683327de6c276ef5f958453db323882fe476df908b6ad7f0e
from django.apps import apps from django.db import models def sql_flush(style, connection, only_django=False, reset_sequences=True, allow_cascade=False): """ Return a list of the SQL statements used to flush the database. If only_django is True, only include the table names that have associated Djang...
de6f2061a8981a9b61454d8f14f92e2b1645bdf937f80f29463e0babb7a31d3c
""" Sets up the terminal color scheme. """ import functools import os import sys from django.utils import termcolors def supports_color(): """ Return True if the running system's terminal supports color, and False otherwise. """ plat = sys.platform supported_platform = plat != 'Pocket PC' an...
5309733d2e9cd0a2a984ed635f7f530ce1c54fae32666da8965b8c6830fdb53d
""" Module for abstract serializer/unserializer base classes. """ from io import StringIO from django.core.exceptions import ObjectDoesNotExist from django.db import models DEFER_FIELD = object() class SerializerDoesNotExist(KeyError): """The requested serializer was not found.""" pass class Serialization...
5be6f2fa4b71adeb2bf45741ba9e64613990b95521811c9b0071e88618b0fe4d
""" YAML serializer. Requires PyYaml (https://pyyaml.org/), but that's checked for in __init__. """ import collections import decimal from io import StringIO import yaml from django.core.serializers.base import DeserializationError from django.core.serializers.python import ( Deserializer as PythonDeserializer,...
29cb1235c0986cea39a9bd6c35132c7b12298a0feaf1fd21e1ab0e2edf2a9c36
""" 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...
a99e680f2fc0575ea263b7f5520a9c27b81af30a00d656fd49573db2bd3a6c55
""" 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...
fadbc5d129b99944c46a02cc6ae8921d0c973e6e9b6f63ace10c0fc41687024f
import re from io import BytesIO from django.conf import settings from django.core import signals from django.core.handlers import base from django.http import HttpRequest, QueryDict, parse_cookie from django.urls import set_script_prefix from django.utils.encoding import repercent_broken_unicode from django.utils.fun...
7b012cb80b87103dec5751b875847b1ba6ed28925a188cf9ec56e44d1cceb584
import logging import sys from functools import wraps from django.conf import settings from django.core import signals from django.core.exceptions import ( PermissionDenied, RequestDataTooBig, SuspiciousOperation, TooManyFieldsSent, ) from django.http import Http404 from django.http.multipartparser import Mult...
b0d335ba6ee12e6c898db7800279a4d2f6c43eea88675be900552189f75cf8cd
import logging import types 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 import get_resolver, set_urlconf from django.utils.log import log_resp...
dd20d90cb516ee43b3ea142afa8f32338e5df103a1858914d666d43aa3f6a71f
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...
7c472c7be120f16f8dacb3e42212b1e83093a0be3afbb05e26d32b15ded3833c
from django.conf import settings from .. import Tags, Warning, register SECRET_KEY_MIN_LENGTH = 50 SECRET_KEY_MIN_UNIQUE_CHARACTERS = 5 W001 = Warning( "You do not have 'django.middleware.security.SecurityMiddleware' " "in your MIDDLEWARE so the SECURE_HSTS_SECONDS, " "SECURE_CONTENT_TYPE_NOSNIFF, " ...
1fa91abbf73f00e50b5b18ce3305f795c3bfe707ae799a6a41701ac23bc24479
import time from importlib import import_module from django.apps import apps from django.core.checks import Tags, run_checks from django.core.management.base import ( BaseCommand, CommandError, no_translations, ) from django.core.management.sql import ( emit_post_migrate_signal, emit_pre_migrate_signal, ) from...
cfb2bbb3942da4c293f3899bc153c7d1cfea4af1a0a1ad9b81b49a1447a83807
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 = False def ...
218500f325d9b3af1ff33358792200fd516c55fb93041fa9fb6160769775948d
from importlib import import_module from django.apps import apps from django.core.management.base import BaseCommand, CommandError from django.core.management.color import no_style from django.core.management.sql import emit_post_migrate_signal, sql_flush from django.db import DEFAULT_DB_ALIAS, connections class Com...
16c5739ceba381ab2a1c8ba462545ee49a8896294c15f3871ceaa9f76c51a726
import warnings from django.apps import apps from django.core import serializers from django.core.management.base import BaseCommand, CommandError from django.core.management.utils import parse_apps_and_model_labels from django.db import DEFAULT_DB_ALIAS, router class ProxyModelWarning(Warning): pass class Com...
630b87ab99889339e287e22c812091b1002aa1def03150b3a325e9c01fe13b94
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...
e449d7d9a1110fc3a928ecefbef040416b3799f3b086674129b3c5eb2bc899cc
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...
5797a560b7d7d805b5e7a782ba9c38739e3f41a96e579cefe41dc04f8d73e219
from django.apps import apps from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections, migrations from django.db.migrations.loader import AmbiguityError, MigrationLoader from django.db.migrations.migration import SwappableTupl...
da09ae1b25d80a0a4f84e5774c9c528f63f1b52be0aea268245f9b512a144054
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...
2ec88fe578380162ed734bd2d098a769a0002a305b2d49df0aad296b4af8145c
import socket from django.core.mail import mail_admins, mail_managers, send_mail from django.core.management.base import BaseCommand from django.utils import timezone class Command(BaseCommand): help = "Sends a test email to the email addresses specified as arguments." missing_args_message = "You must specif...
cadfd657fa527cbf3e0f9fc37bd232e909a65a21f366d21a918d5e3fd150c242
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...
319f0a5df08352eabeca71f1511ac79396893a61a0d147bb6d9c351b4bfd9d68
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.' ...
c51539fa27178b4e725c8d5fa830c0610c25b248265830675c5589a28b99901c
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, connections, models, router, transaction, ) from django.db.utils import Databa...
65f6cce967b0734ee0cd4ea44b8a6ae7f592115c84f7ff1084666400986b6362
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_system_checks = Fals...
22f0d5a4e20061156d6350d01210e89bea4fb07e1a0c02cdf17e843a0b93e61f
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...
ec06f84d8e03eb9f47b3dfc7d26654e78d937e89f39c71600aa7287ad673c8c5
from django.apps import apps from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections from django.db.migrations.executor import MigrationExecutor from django.db.migrations.loader import AmbiguityError class Command(BaseCommand): help = "Prints the SQL s...
118b64cd5823feeb54a20b10ff2eeaa02a4c42f017635bb829c86d715747ee15
import sys from django.apps import apps from django.core.management.base import BaseCommand from django.db import DEFAULT_DB_ALIAS, connections from django.db.migrations.loader import MigrationLoader class Command(BaseCommand): help = "Shows all available migrations for the current project" def add_argument...
7e72f49378f9d640784de54745ca6ac30b59c0b1a77a18cc610585953a69a5dd
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...
0f6552bdc13851842b0e3ac41ef497a75525ada67ff619eabccb017e46744233
import os import sys 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, connections, router from django.db.migrations import Migration from djan...
b56eb0488abf4f11ab792341127075640a8a006fe2eb14a739803299ea883ac9
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...
1cf9e47840638b9a5019cd364de4a99e8d8063db986efad4a00989225bbb4728
"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...
856ebffeb2ff458064bd0546474edf750f723c374783e03efeb173dbb7cac678
"Memcached cache backend" import pickle import re import time from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.utils.functional import cached_property class BaseMemcachedCache(BaseCache): def __init__(self, server, params, library, value_not_found_exception): super().__...
52e5ef21ab17a5163597c404094f12a133ba0c6c4bd8b699044f3f4f1f419043
"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: ...
da00d07480befb93d357978be88e0ef8ffed1f8021b38fc33ce2c646840c7210
"Base Cache class." import time import warnings from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import import_string class InvalidCacheBackendError(ImproperlyConfigured): pass class CacheKeyWarning(RuntimeWarning): pass # Stub class to ensure not passing in a `tim...
d27bee92e13950fbae61a18d953875c5bb71c45f54ef8c9cd23bdc086b5a2f58
"Thread-safe in-memory cache backend." import pickle import time from collections import OrderedDict from threading import Lock from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache # Global in-memory store of cache data. Keyed by name, to provide # multiple named local memory caches. _caches = {} _e...
d49568df1736699c430469ebb139c1c1fafb23b0f05b9bd0fda8f9ac7dff9a49
"""Email backend that writes messages to a file.""" import datetime import os from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.mail.backends.console import ( EmailBackend as ConsoleEmailBackend, ) class EmailBackend(ConsoleEmailBackend): def __init__(...
c09dc8b18f78bacb773ed5c352ef957f9f41b9151920a6f48af27b602a1c28bd
"""SMTP email backend class.""" import smtplib import ssl import threading from django.conf import settings from django.core.mail.backends.base import BaseEmailBackend from django.core.mail.message import sanitize_address from django.core.mail.utils import DNS_NAME class EmailBackend(BaseEmailBackend): """ A...
148e10a051a06388fd515b78677f96e0cf070c17501f3ab5d3dcbb806d8dbb9b
from urllib.parse import urlencode from urllib.request import urlopen from django.apps import apps as django_apps from django.conf import settings from django.core import paginator from django.core.exceptions import ImproperlyConfigured from django.urls import NoReverseMatch, reverse from django.utils import translati...
f06ee04be923906b952bfb8da0989b55290cce89a7f76db5e47c5f4a378f58a2
"Misc. utility functions/classes for admin documentation generator." import re from email.errors import HeaderParseError from email.parser import HeaderParser from django.urls import reverse from django.utils.safestring import mark_safe try: import docutils.core import docutils.nodes import docutils.pars...
de9d6e478af41a06b505fb155f6bf669f575f577bf54e4b04e3f4117e7bdb307
import inspect from importlib import import_module from pathlib import Path from django.apps import apps from django.conf import settings 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.uti...
ebfc6afc14639f3ea91566aaf89fef0a25d3fc57819fed6374137b8fd7cde7eb
from django.db.models import Index from django.db.utils import NotSupportedError from django.utils.functional import cached_property __all__ = [ 'BrinIndex', 'BTreeIndex', 'GinIndex', 'GistIndex', 'HashIndex', 'SpGistIndex', ] class PostgresIndex(Index): @cached_property def max_name_length(self): ...
3e062b978d97c4a28297a01ff78a68642fc5633f0284656c73ec03ad77afb5d5
from django.db.models import CharField, Field, FloatField, TextField from django.db.models.expressions import CombinedExpression, Func, Value from django.db.models.functions import Cast, Coalesce from django.db.models.lookups import Lookup class SearchVectorExact(Lookup): lookup_name = 'exact' def process_rh...
623f2138fd4784c5a3888d22e83ad3c65f807c3a422dbfa9f1009a88eb2f64e5
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, Text...
10f5b8f89b60315ff1e3f028b06e02f872d7dcae0ef65b3d133c3d7f4ee21ddf
from django.db.migrations.serializer import BaseSerializer class RangeSerializer(BaseSerializer): def serialize(self): module = self.value.__class__.__module__ # Ranges are implemented in psycopg2._range but the public import # location is psycopg2.extras. module = 'psycopg2.extras...
9c8190bd7256aa4221214e771bab016c3a6424c657167785505135c39fdcc0cb
from django.db.models import Lookup, Transform from django.db.models.lookups import Exact, FieldGetDbPrepValueMixin from .search import SearchVector, SearchVectorExact, SearchVectorField class PostgresSimpleLookup(FieldGetDbPrepValueMixin, Lookup): def as_sql(self, qn, connection): lhs, lhs_params = self...
180bf29a79ef7a4aec9256d2e9b7c4610a9d6ebb63832d9fabfb7769b80892d6
from calendar import timegm from django.contrib.sites.shortcuts import get_current_site from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from django.http import Http404, HttpResponse from django.template import TemplateDoesNotExist, loader from django.utils import feedgenerator from django.u...
dc783aab1351faecc401551336b99b4e19c378f8835e041f3f00d68ab876b9e6
import inspect import warnings from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.utils.deprecation import RemovedInDjango31Warning UserModel = get_user_model() class BaseBackend: def authenticate(self, request, **kwargs): return None def ge...
093fe9729aad3422798ee646e1c564d329fc6a6221be41457fb18bf72b3c73a4
import inspect import re from django.apps import apps as django_apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.middleware.csrf import rotate_token from django.utils.crypto import constant_time_compare from django.utils.module_loading import i...
fff58d951939adbb50a4963ee72cd2e87281464d3260a289a20486437cc0dd75
from django.contrib import auth from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.core.mail import send_mail from django.db import models from django.db.models.manager imp...
27167a6843e26c0bc0a0335322522b603cfcfd5f14650b3c28e60a4544c97caa
from datetime import date from django.conf import settings from django.utils.crypto import constant_time_compare, salted_hmac from django.utils.http import base36_to_int, int_to_base36 class PasswordResetTokenGenerator: """ Strategy object used to generate and check tokens for the password reset mechanis...
04b0dc05eb1a5bfc2999be96790a3928b6c8834333485c4c061bb6185777adbb
import base64 import binascii import functools import hashlib import importlib 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 ( constant_tim...
61b56da0d6164a4a0b58a78f789d0f97abbac2b85aa31792f1d4ddde7ee15f0b
from django.conf import settings from django.contrib import admin, messages from django.contrib.admin.options import IS_POPUP_VAR from django.contrib.admin.utils import unquote from django.contrib.auth import update_session_auth_hash from django.contrib.auth.forms import ( AdminPasswordChangeForm, UserChangeForm, U...
817992dcc7bfc537ca4d37f93d2411c67d2c3c9983a74e3862b9dc5ebe7143b5
""" This module allows importing AbstractBaseUser even when django.contrib.auth is not in INSTALLED_APPS. """ import unicodedata from django.contrib.auth import password_validation from django.contrib.auth.hashers import ( check_password, is_password_usable, make_password, ) from django.db import models from djang...
ce82375205dd3acc560b315ea0e155c133d19e0bf59084620bb2396827ce043d
import unicodedata from django import forms from django.contrib.auth import ( authenticate, get_user_model, password_validation, ) from django.contrib.auth.hashers import ( UNUSABLE_PASSWORD_PREFIX, identify_hasher, ) from django.contrib.auth.models import User from django.contrib.auth.tokens import default_to...
040c6fd7f62e1017cf2f54eea6b3f717a1e0dd296c9eba11a4366c7d9ccfa4d4
from urllib.parse import urlparse, urlunparse from django.conf import settings # Avoid shadowing the login() and logout() views below. from django.contrib.auth import ( REDIRECT_FIELD_NAME, get_user_model, login as auth_login, logout as auth_logout, update_session_auth_hash, ) from django.contrib.auth.decorato...
07f55ad9465716ed1aae5e5d82d06c7b4e0220f6100f9512e4551206778276ee
import functools import gzip import re from difflib import SequenceMatcher from pathlib import Path from django.conf import settings from django.core.exceptions import ( FieldDoesNotExist, ImproperlyConfigured, ValidationError, ) from django.utils.functional import lazy from django.utils.html import format_html, f...
e12535245e437380375936dd738e4fc46bac3bcafaae0ced806e6811bfc984ac
import re from django.core import validators from django.utils.deconstruct import deconstructible from django.utils.translation import gettext_lazy as _ @deconstructible class ASCIIUsernameValidator(validators.RegexValidator): regex = r'^[\w.@+-]+\Z' message = _( 'Enter a valid username. This value m...
05acc14038ccce45c1490f54d25db02b80085ba94cd2d9388b6aa4241cdefb89
import json from django import forms from django.conf import settings from django.contrib.admin.utils import ( display_for_field, flatten_fieldsets, help_text_for_field, label_for_field, lookup_field, ) from django.core.exceptions import ObjectDoesNotExist from django.db.models.fields.related import ManyToMany...
5e922dd3643624c360dfd9a65e6f4a7cde394b5d483c0bc624f31662a6f8ceb0
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 from django.db.model...
060278ff85f8eca3b443cb43ceaf18b33870dbfce1ca348b35ef22f2227a549c
import json from django.conf import settings from django.contrib.admin.utils import quote from django.contrib.contenttypes.models import ContentType from django.db import models from django.urls import NoReverseMatch, reverse from django.utils import timezone from django.utils.text import get_text_list from django.uti...
094ccd8ccba6cd15e5244cf53f21f2551ad670596916c5b0e837ec1d054bb928
import copy import json import operator import re from functools import partial, reduce, update_wrapper from urllib.parse import quote as urlquote from django import forms from django.conf import settings from django.contrib import messages from django.contrib.admin import helpers, widgets from django.contrib.admin.ch...
90e99507a06d81dd207de9e1d18d27052a5717a5c91d5caf4b35006cd046b88e
import re from functools import update_wrapper from weakref import WeakSet from django.apps import apps from django.contrib.admin import ModelAdmin, actions from django.contrib.auth import REDIRECT_FIELD_NAME from django.core.exceptions import ImproperlyConfigured from django.db.models.base import ModelBase from djang...
ca39226d322bbf198757b100041238c00dcd6f60a1229360252413a3128da5dc
""" 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.deletion import CASCADE from django.urls import rever...
e9761bc3f351d40785c25b707754952990d56b8e6c98120df9eec4d0c4f7ed4f
import datetime import decimal import re from collections import defaultdict from django.core.exceptions import FieldDoesNotExist from django.db import models, router from django.db.models.constants import LOOKUP_SEP from django.db.models.deletion import Collector from django.forms.utils import pretty_name from django...
ef31c21be3a0f1b4f2861de7779706f0a4ebcc751de21344719759a685b561ed
""" 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...
7cf698e9c1d4fee4c8614a1593cea362dfd22beb1b27320722f503700936a15f
import functools import os from django.apps import apps from django.conf import settings from django.contrib.staticfiles import utils from django.core.checks import Error from django.core.exceptions import ImproperlyConfigured from django.core.files.storage import ( FileSystemStorage, Storage, default_storage, ) f...
f4baa8f148aa5e96522b20dad8961cecb3a5c2d2482438ed92070a797ef44b6e
from urllib.parse import urlparse from urllib.request import url2pathname from django.conf import settings from django.contrib.staticfiles import utils from django.contrib.staticfiles.views import serve from django.core.handlers.exception import response_for_exception from django.core.handlers.wsgi import WSGIHandler,...
28b6b5f494b7286271c105e7e840d185d84e53e97c9f3924685d5288ee0b9a37
import fnmatch import os from django.conf import settings from django.core.exceptions import ImproperlyConfigured def matches_patterns(path, patterns=None): """ Return True or False depending on whether the ``path`` should be ignored (if it matches any pattern in ``ignore_patterns``). """ return ...
e376c76131d53168f0794fedab35e904a129ec4b47aeeffbaf0af6c3b53e0199
""" 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 os import posixpath from django.conf import settings from django.contrib.staticfiles import finders from django.http import Http404 from django.views import static...
8840c08a5fdb2666f59fe3739cc8248b099a560af495b79871ead2906d0f73b6
import hashlib import json import os import posixpath import re import warnings 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.cache import ( InvalidCacheBackendError, ...
873df5d03859bac12f2d4c4225722930c73f653c2e73e1d83cd1c3a3521d1d80
from django import forms from django.conf import settings from django.contrib.flatpages.models import FlatPage from django.utils.translation import gettext, gettext_lazy as _ class FlatpageForm(forms.ModelForm): url = forms.RegexField( label=_("URL"), max_length=100, regex=r'^[-\w/\.~]+$',...
cb0903b991d9c2efe4671e9fae3005b7b3000779a8ebe98b89cc81cb0d7711f6
from django.conf import settings from django.contrib.flatpages.models import FlatPage from django.contrib.sites.shortcuts import get_current_site from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect from django.shortcuts import get_object_or_404 from django.template import loader from django.uti...
9d76d60ec2aea24a76f9bc319eb0e1c36c80db6d7007230eb06693c70c17e01f
import string from django.core.exceptions import ImproperlyConfigured, ValidationError from django.db import models from django.db.models.signals import pre_delete, pre_save from django.http.request import split_domain_port from django.utils.translation import gettext_lazy as _ SITE_CACHE = {} def _simple_domain_na...
e54922f858d68efcdef02b3ca0474bcbeb9cfc507bc5562f5ef9a6b67936591c
from collections import defaultdict from django.apps import apps from django.db import models from django.utils.translation import gettext_lazy as _ class ContentTypeManager(models.Manager): use_in_migrations = True def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Cac...
075575f402d305a737252574b21d67a375a3ec9dd726e1973db521110df65af6
import functools import itertools import operator from collections import defaultdict from django.contrib.contenttypes.models import ContentType from django.core import checks from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, models, router, transaction fr...
725ab610d350dee8c4bae739807483bdacf7d245961de96740f63ab7352ed2ab
import pickle from django.core.signing import JSONSerializer as BaseJSONSerializer class PickleSerializer: """ Simple wrapper around pickle to be used in signing.dumps and signing.loads. """ protocol = pickle.HIGHEST_PROTOCOL def dumps(self, obj): return pickle.dumps(obj, self.protoc...
2caf46ffa2910cdfadff86504c19f8166cb4717bac81f23e5331890d9c8c0e7a
import time from importlib import import_module from django.conf import settings from django.contrib.sessions.backends.base import UpdateError from django.core.exceptions import SuspiciousOperation from django.utils.cache import patch_vary_headers from django.utils.deprecation import MiddlewareMixin from django.utils....
44afb9182514690b41b830f7940a2b692ec6d397f3621479a7469c2abce94151
from ctypes import c_void_p class CPointerBase: """ Base class for objects that have a pointer access property that controls access to the underlying C pointer. """ _ptr = None # Initially the pointer is NULL. ptr_type = c_void_p destructor = None null_ptr_exception_class = AttributeE...
e374e649ae342d1dcb82e1385437814e125980efeb6ed7eb4f963a0d0ed10624
from django.contrib.syndication.views import Feed as BaseFeed from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed class GeoFeedMixin: """ This mixin provides the necessary routines for SyndicationFeed subclasses to produce simple GeoRSS or W3C Geo elements. """ def georss_coords(self...
95179d52db72cae8318a29c166945426e033d9851845c8a27ae8f3ccdd06e9ab
# Copyright (c) 2007, Robert Coup <robert.coup@onetrackmind.co.nz> # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, #...
82a7c2a6877e5a9de714173c9a95a16cfd90496b1613be0827e865726f3fed26
from django.contrib.sitemaps import ping_google from django.core.management.base import BaseCommand class Command(BaseCommand): help = "Ping Google with an updated sitemap, pass optional url of sitemap" def add_arguments(self, parser): parser.add_argument('sitemap_url', nargs='?') parser.add_...
21bcb2660f1c4d4fb5f5979183a2e774b7d12b44a87af0f0a8ab6bab3855a7a7
from django.contrib.messages.storage.base import BaseStorage from django.contrib.messages.storage.cookie import CookieStorage from django.contrib.messages.storage.session import SessionStorage class FallbackStorage(BaseStorage): """ Try to store all messages in the first backend. Store any unstored messag...
ddf5f5074a2be7577bf515d5377370edbc723d835288babce80c81f10e36c8cf
import json from django.contrib.postgres import lookups from django.contrib.postgres.forms import SimpleArrayField from django.contrib.postgres.validators import ArrayMaxLengthValidator from django.core import checks, exceptions from django.db.models import Field, IntegerField, Transform from django.db.models.lookups ...
764b06699f04215f05b278bb768ef338af9fbc44a06011a86a03520d3e8f45cc
import datetime import json from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange, Range from django.contrib.postgres import forms, lookups from django.db import models from .utils import AttributeSetter __all__ = [ 'RangeField', 'IntegerRangeField', 'BigIntegerRangeField', 'DecimalRangeField...
0dcdebba7ada53f05da7cba92bc440c13a3c297b14239a122de97c9e0e191ef9
import warnings from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange from django import forms from django.core import exceptions from django.forms.widgets import MultiWidget from django.utils.deprecation import RemovedInDjango31Warning from django.utils.translation import gettext_lazy as _ __all__ = ...
c3a1a2c6a87f66d189c24a43d53b582ce00a112a65ced2e523a6eb02dfc509ca
from django.contrib.postgres.fields import ArrayField, JSONField from django.db.models.aggregates import Aggregate from .mixins import OrderableAggMixin __all__ = [ 'ArrayAgg', 'BitAnd', 'BitOr', 'BoolAnd', 'BoolOr', 'JSONBAgg', 'StringAgg', ] class ArrayAgg(OrderableAggMixin, Aggregate): function = 'ARRAY_...
481263c5b729142191696643724db5b6cf90f7cb957cf131804d54e4923512a8
from django.db.models.expressions import F, OrderBy class OrderableAggMixin: def __init__(self, expression, ordering=(), **extra): if not isinstance(ordering, (list, tuple)): ordering = [ordering] ordering = ordering or [] # Transform minus sign prefixed strings into an OrderB...
250d9ca949d3a28a832a56792dc5d00db42577dc50982deea79ff00969f52c58
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0009_alter_user_last_name_max_length'), ] operations = [ migrations.AlterField( model_name='group', name='name', field=models.CharField(max_lengt...
feb6339968bb23802157bc7ac727ad609317a73e41a3c9a38369ac9992cdecd4
import sys from django.core.management.color import color_style from django.db import migrations, transaction from django.db.models import Q from django.db.utils import IntegrityError WARNING = """ A problem arose migrating proxy model permissions for {old} to {new}. Permission(s) for {new} already existed...
f439393f11eb7e7a583a5a0f7350a523b28c2ca219b4b07e78a1a177771fb66f
""" Creates permissions for all installed apps that need permissions. """ import getpass import unicodedata from django.apps import apps as global_apps from django.contrib.auth import get_permission_codename from django.contrib.contenttypes.management import create_contenttypes from django.core import exceptions from ...
6d35ca54c7b3cb0b27d4a036315c8359e1ef4cd6b62abc08c67da8947ee8ff92
from django import db from django.contrib import auth UserModel = auth.get_user_model() def check_password(environ, username, password): """ Authenticate against Django's auth database. mod_wsgi docs specify None, True, False as return value depending on whether the user exists and authenticates. ...