hash
stringlengths
64
64
content
stringlengths
0
1.51M
e4975896936bb9a53f5e2c01f86a83e0c69f4049babc342a54212eaf63541dde
from django.apps import apps from django.contrib import auth from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager from django.contrib.auth.hashers import make_password from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.core.m...
9c02681f312f1d6326775291f95c98f3367e0f6ec3f92d8460d2943a63fa5116
import base64 import binascii import functools import hashlib import importlib import math import warnings from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.signals import setting_changed from django.dispatch import receiver from django.utils.crypto import ( ...
fc803745449844a39c9d5888dd2c356809a8db8e393ffb01e9c878656a863462
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...
0a80259fb5dade610a7796a473561892d1661ed94a7830b2b582d7493b0a84cd
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 cached_property, lazy from django.utils.html impo...
ea6da910e0ff3eaea0ac0e599ca0f21e48e23da3dd7e4049210ac41ac49ad9a2
import json from django import forms from django.contrib.admin.utils import ( display_for_field, flatten_fieldsets, help_text_for_field, label_for_field, lookup_field, quote, ) from django.core.exceptions import ObjectDoesNotExist from django.db.models.fields.related import ( ForeignObjectRel, ManyToManyRe...
c0d8c23a67728f339acce6489471246110221fd8ced337b770b6202376a798fa
from contextlib import contextmanager from django.contrib.staticfiles.testing import StaticLiveServerTestCase from django.test import modify_settings from django.test.selenium import SeleniumTestCase from django.utils.deprecation import MiddlewareMixin from django.utils.translation import gettext as _ class CSPMiddl...
e5f6a9a6e5d344d38f5c179a4543cb93faac106b92db6fe0266b2f6d59028b75
import copy import json import re from functools import partial, update_wrapper from urllib.parse import quote as urlquote from django import forms from django.conf import settings from django.contrib import messages from django.contrib.admin import helpers, widgets from django.contrib.admin.checks import ( BaseMo...
177aace9ae1eaf81b2d81ed8eeab49e37f5e64512f728f4fb3ef21d9fd3066b9
import re from functools import update_wrapper from weakref import WeakSet from django.apps import apps from django.conf import settings from django.contrib.admin import ModelAdmin, actions from django.contrib.admin.views.autocomplete import AutocompleteJsonView from django.contrib.auth import REDIRECT_FIELD_NAME from...
b6c3520d09624b2df2639e031b6178a754ab92d783b557bec48b7f43a4f1dba8
""" Built-in, globally-available admin actions. """ from django.contrib import messages from django.contrib.admin import helpers from django.contrib.admin.decorators import action from django.contrib.admin.utils import model_ngettext from django.core.exceptions import PermissionDenied from django.template.response imp...
7ce5227758dcdb0e2f56bc048a4ce5ceab395b7528f969fbe547e8c3332a9b33
""" Form Widget classes specific to the Django admin site. """ import copy import json from django import forms from django.conf import settings from django.core.exceptions import ValidationError from django.core.validators import URLValidator from django.db.models import CASCADE, UUIDField from django.urls import rev...
05adfcc85c462ee7c2f5818b3503654a039ccf9b998d5ab0e392b4ee314e7210
import datetime import decimal import json 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 djan...
c13fb7afb941741b1102eb6cfca8c2844e2de8f0281d3b4428fd45df087d39d8
""" 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...
c1f8082e419430cdccb91b3d68d361c82785b6a94ce36e8c59b098253170758e
import json import os import posixpath import re from urllib.parse import unquote, urldefrag, urlsplit, urlunsplit from django.conf import settings from django.contrib.staticfiles.utils import check_settings, matches_patterns from django.core.exceptions import ImproperlyConfigured from django.core.files.base import Co...
628db56bf2442b9d36bfe49cefa8a3b2de50b315fb33163edceb21866c1a8a6b
from django.apps import apps from .requests import RequestSite def get_current_site(request): """ Check if contrib.sites is installed and return either the current ``Site`` object or a ``RequestSite`` object based on the request. """ # Import is inside the function because its point is to avoid i...
377326a8ae30ce08565200bf3650610c5df4cefc98030a2bc0f426837d8c9b82
import functools import itertools 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 from django.db.mod...
65d3fc793b6a7c870da4907a37f462258e9c4a539acee3abcdf8d1080e70db38
# RemovedInDjango50Warning. from django.core.serializers.base import ( PickleSerializer as BasePickleSerializer, ) from django.core.signing import JSONSerializer as BaseJSONSerializer JSONSerializer = BaseJSONSerializer PickleSerializer = BasePickleSerializer
ef0c1801065fb174d9584bb55b4cedc73d3dc3e2dc9aa144eabe6bf4ee51fe34
import re from django.utils.regex_helper import _lazy_re_compile # Regular expression for recognizing HEXEWKB and WKT. A prophylactic measure # to prevent potentially malicious input from reaching the underlying C # library. Not a substitute for good web security programming practices. hex_regex = _lazy_re_compile(r...
e24e797e6254b109fa5cf26d09f1c7cdbc0831d7338557df6c1ec429c46f0d76
import binascii import json from django.conf import settings from django.contrib.messages.storage.base import BaseStorage, Message from django.core import signing from django.http import SimpleCookie from django.utils.safestring import SafeData, mark_safe class MessageEncoder(json.JSONEncoder): """ Compactly...
807fd1661005bf93702a9db5a19f0a36852ff22b4acb4d49c75b590d8ad8b6a0
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 django.db.models.lookups import PostgresOperatorLookup from .utils import AttributeSetter __all__ = [ 'RangeField', 'Intege...
99f4356e6b0717c2323406b456839a7ac6d736f51136d4af749fbc1de5d7e7b9
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange from django import forms from django.core import exceptions from django.forms.widgets import HiddenInput, MultiWidget from django.utils.translation import gettext_lazy as _ __all__ = [ 'BaseRangeField', 'IntegerRangeField', 'DecimalRangeField', ...
54ba1cc2f09af241b796dd6a98a414e9fea4ff2f3156c40c1eb61cffaf1e1ee3
import warnings from django.contrib.postgres.fields import ArrayField from django.db.models import ( Aggregate, BooleanField, JSONField, TextField, Value, ) from django.utils.deprecation import RemovedInDjango50Warning from .mixins import OrderableAggMixin __all__ = [ 'ArrayAgg', 'BitAnd', 'BitOr', 'BitXor',...
e728a3031e1322a48020f9e523f745bf8feb2781d69a05424ecfff68c95c3e3f
from django.db.models import Aggregate, FloatField, IntegerField __all__ = [ 'CovarPop', 'Corr', 'RegrAvgX', 'RegrAvgY', 'RegrCount', 'RegrIntercept', 'RegrR2', 'RegrSlope', 'RegrSXX', 'RegrSXY', 'RegrSYY', 'StatAggregate', ] class StatAggregate(Aggregate): output_field = FloatField() def __init__(s...
5c0e470fcde66efca3d6bcdee9f1f5860bc9731c121b276f6596978960e3c1b4
from django.db.models.expressions import OrderByList class OrderableAggMixin: def __init__(self, *expressions, ordering=(), **extra): if isinstance(ordering, (list, tuple)): self.order_by = OrderByList(*ordering) else: self.order_by = OrderByList(ordering) super()....
a0df0b272bb3d8d231d8f3068f3f08e307dffd638a9424990638eebc9119448c
""" Management utility to create superusers. """ import getpass import os import sys from django.contrib.auth import get_user_model from django.contrib.auth.management import get_default_username from django.contrib.auth.password_validation import validate_password from django.core import exceptions from django.core.m...
60b8c1206b26cb7f34bc4fba00949a5556ed739f52a693ac43e7ef66659d27f4
from django.apps import apps from django.core.exceptions import FieldDoesNotExist, PermissionDenied from django.http import Http404, JsonResponse from django.views.generic.list import BaseListView class AutocompleteJsonView(BaseListView): """Handle AutocompleteWidget's AJAX requests for data.""" paginate_by =...
0fae4a581230e9edb0f28de3b88418e45859c62782beb37cd0a0d93f4e5be13a
import datetime from django.conf import settings from django.contrib.admin.templatetags.admin_urls import add_preserved_filters from django.contrib.admin.utils import ( display_for_field, display_for_value, get_fields_from_path, label_for_field, lookup_field, ) from django.contrib.admin.views.main import ( ...
8d9c1ed33158a1bfa41aa5cc3b2b8f1d79152b89a30c7ced573dd2acc72bc211
import json from django import template from django.template.context import Context from .base import InclusionAdminNode register = template.Library() def prepopulated_fields_js(context): """ Create a list of prepopulated_fields that should render JavaScript for the prepopulated fields for both the adm...
08d9db9ee86fd67f455c112087455c73211b96df086729bdd9ade391579bedd1
import itertools from django.apps import apps from django.contrib.contenttypes.models import ContentType from django.core.management import BaseCommand from django.db import DEFAULT_DB_ALIAS, router from django.db.models.deletion import Collector class Command(BaseCommand): def add_arguments(self, parser): ...
60683758e77bf525e05f45895b78437590168631e987044d6a6e72ea046af1ed
import logging import string from datetime import datetime, timedelta from django.conf import settings from django.core import signing from django.utils import timezone from django.utils.crypto import get_random_string from django.utils.module_loading import import_string # session_key should not be case sensitive be...
69d6e3a3d6933d4d24a2edfcfd26f8258d8ded0677ed50628bf4b4419b96d071
# LayerMapping -- A Django Model/OGR Layer Mapping Utility """ The LayerMapping class provides a way to map the contents of OGR vector files (e.g. SHP files) to Geographic-enabled Django models. For more information, please consult the GeoDjango documentation: https://docs.djangoproject.com/en/dev/ref/contrib/gi...
a24be29fdac66b54d0c8f6b633341c1edfe1fd2963af8eb3ef39cf3bc6a49286
""" This module houses the GeoIP2 object, a wrapper for the MaxMind GeoIP2(R) Python API (https://geoip2.readthedocs.io/). This is an alternative to the Python GeoIP2 interface provided by MaxMind. GeoIP(R) is a registered trademark of MaxMind, Inc. For IP-based geolocation, this module requires the GeoLite2 Country ...
545cba268af7bd241fd30cb3c7d852e81407293705c29a6364cabd1dd3889fa5
import socket import geoip2.database from django.conf import settings from django.contrib.gis.geos import Point from django.core.exceptions import ValidationError from django.core.validators import validate_ipv46_address from django.utils._os import to_path from .resources import City, Country # Creating the settin...
a63a3a0753732a679ec6b3ef6c6119dda3040b4e291006e0de7cf125e2fe9024
import json from django.contrib.gis.gdal import CoordTransform, SpatialReference from django.core.serializers.base import SerializerDoesNotExist from django.core.serializers.json import Serializer as JSONSerializer class Serializer(JSONSerializer): """ Convert a queryset to GeoJSON, http://geojson.org/ "...
58c761e02d37264e4c82de5b4173b9c045cf16091352041d05f59a5a15bb8069
""" DataSource is a wrapper for the OGR Data Source object, which provides an interface for reading vector geometry data from many different file formats (including ESRI shapefiles). When instantiating a DataSource object, use the filename of a GDAL-supported data source. For example, a SHP file or a TIGER/Line...
b7cf6fd162fc42ec443471dffaf0455baea26c3a0eadd2b8a865d20c2a0d6460
""" The OGRGeometry is a wrapper for using the OGR Geometry class (see https://gdal.org/api/ogrgeometry_cpp.html#_CPPv411OGRGeometry). OGRGeometry may be instantiated when reading geometries from OGR Data Sources (e.g. SHP files), or when given OGC WKT (a string). While the 'full' API is not present yet, the API ...
4cfdcdd71239184ab6578b1296008db4efff4e3141c5977a6c49a59061e0a746
from ctypes import byref, c_int from datetime import date, datetime, time from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.prototypes import ds as capi from django.utils.encoding import force_str # For more information, see the OGR...
7a582156510fc7a6664142611e5dbc46f5a2aef11790d22e53a522cb54dedcbc
from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.field import Field from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api from django.utils....
5c8dff0552fc58402272fda1cc303c282644ff840cfe4e2123449f8cdc5d1aa4
""" This module houses the GDAL & SRS Exception objects, and the check_err() routine which checks the status code returned by GDAL/OGR methods. """ # #### GDAL & SRS Exceptions #### class GDALException(Exception): pass class SRSException(Exception): pass # #### GDAL/OGR error checking codes and routine...
4e9f4cba770d4148312abca1ca8e0236774059106750f20a08dfa2a97163560e
""" The GDAL/OGR library uses an Envelope structure to hold the bounding box information for a geometry. The envelope (bounding box) contains two pairs of coordinates, one for the lower left coordinate and one for the upper right coordinate: +----------o Upper right; (max_x, max_y) ...
dc53f90a36ab6645e579a954cc8fbb6a4572f2bc96efd9c278f06baf0cf443ea
from ctypes import c_void_p from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi from django.utils.encoding import force_bytes, force_str class Driver(GDALBase): """ Wrap a GDAL/OG...
ee13aac254e616fd090b2817021f030cb65ec641abffbecbed3a25cadbdc1fa5
import logging import os import re from ctypes import CDLL, CFUNCTYPE, c_char_p, c_int from ctypes.util import find_library from django.contrib.gis.gdal.error import GDALException from django.core.exceptions import ImproperlyConfigured logger = logging.getLogger('django.contrib.gis') # Custom library path set? try: ...
b79a55a208be0c5bbf6597bc4e980ae6503bd8bada1315fa1933301d95f5afcb
from ctypes import byref, c_double from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope from django.contrib.gis.gdal.error import GDALException, SRSException from django.contrib.gis.gdal.feature import Feature from django.contrib.gis.gdal.field import OGR...
a5ec1a4a2a4ae1f935cfae2717f32c87cba60b17202d2c7ab4c9b3f1b067a84c
from django.contrib.admin import ( HORIZONTAL, VERTICAL, AdminSite, ModelAdmin, StackedInline, TabularInline, action, autodiscover, display, register, site, ) from django.contrib.gis.admin.options import ( GeoModelAdmin, GISModelAdmin, OSMGeoAdmin, ) from django.contrib.gis.admin.widgets import OpenLayersWi...
3b607c917994de8b2f10d8022c562475ce9583a6475fae2b4d5d12b3de655d8e
import warnings from django.contrib.admin import ModelAdmin from django.contrib.gis.admin.widgets import OpenLayersWidget from django.contrib.gis.db import models from django.contrib.gis.forms import OSMWidget from django.contrib.gis.gdal import OGRGeomType from django.forms import Media from django.utils.deprecation ...
c2f664887b9d995cfce8e861ddeec3ab7515d8e6d6cfeca7cb78a9e90ed61ed9
""" This module houses the Geometry Collection objects: GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon """ from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin from django.contrib.gis.geos.libgeos import GEOM_PTR from ...
1892894df73f1589eb6189473cb135a036c147f40bc60d9126b134b97498219b
""" This module contains the 'base' GEOSGeometry object -- all GEOS Geometries inherit from this object. """ import re from ctypes import addressof, byref, c_double from django.contrib.gis import gdal from django.contrib.gis.geometry import hex_regex, json_regex, wkt_regex from django.contrib.gis.geos import prototy...
381b8a169579a6efee755ac900c1ff6ceb0c2f91c432e4bd2109ddb578f7d991
""" This module houses the ctypes initialization procedures, as well as the notice and error handler function callbacks (get called when an error occurs in GEOS). This module also houses GEOS Pointer utilities, including get_pointer_arr(), and GEOM_PTR. """ import logging import os from ctypes import CDLL, CFUNCT...
a09246767a2018870d2860ac6c3839cbd0856978b7937d79c3ec23d1aa6cfcd0
from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.geometry import GEOSGeometry from django.contrib.gis.geos.libgeos import GEOM_PTR from django.contrib.gis.geos.linestring import LinearRing class Polygon(GEOSGeometry): _minlength = 1 def __init__(self, *args, **kwargs): ...
664e8debefede1f313c3b2c21b742585692d1e7a26dd358d9ff9f547a79bf6e9
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures from django.db.backends.oracle.features import ( DatabaseFeatures as OracleDatabaseFeatures, ) from django.utils.functional import cached_property class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures): supports_add_srs_...
bd476512064d4638bf12f213b30589069bdddfed7eef3e6bc69720f156e76e52
from django.contrib.gis.db.models import GeometryField from django.db.backends.oracle.schema import DatabaseSchemaEditor from django.db.backends.utils import strip_quotes, truncate_name class OracleGISSchemaEditor(DatabaseSchemaEditor): sql_add_geometry_metadata = (""" INSERT INTO USER_SDO_GEOM_METADATA ...
b667be91d99b428e613b6ce56dc083e5098da72703a1ec773558253e2fa0808c
from MySQLdb.constants import FIELD_TYPE from django.contrib.gis.gdal import OGRGeomType from django.db.backends.mysql.introspection import DatabaseIntrospection class MySQLIntrospection(DatabaseIntrospection): # Updating the data_types_reverse dictionary with the appropriate # type for Geometry fields. ...
d44a31f4982bd9e320a585a15fc8174dd1a67d87eb781a36b82659190c32249e
from django.contrib.gis.db import models from django.contrib.gis.db.backends.base.adapter import WKTAdapter from django.contrib.gis.db.backends.base.operations import ( BaseSpatialOperations, ) from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.geos.geometry import GEOSGeometry...
87246dfb4682ebbde6354b4c392ac78212be445452610b681fbd014deff60e8b
import logging from django.contrib.gis.db.models import GeometryField from django.db import OperationalError from django.db.backends.mysql.schema import DatabaseSchemaEditor logger = logging.getLogger('django.contrib.gis') class MySQLGISSchemaEditor(DatabaseSchemaEditor): sql_add_spatial_index = 'CREATE SPATIAL...
2f4bca65e31516b3e3459d342ac759c55e678287ca98588415508efae7c0fb5f
""" This object provides quoting for GEOS geometries into PostgreSQL/PostGIS. """ from psycopg2 import Binary from psycopg2.extensions import ISQLQuote from django.contrib.gis.db.backends.postgis.pgraster import to_pgraster from django.contrib.gis.geos import GEOSGeometry class PostGISAdapter: def __init__(self...
40e674913c28caa7917043bf82d92e8a93035777936b740b06fd4d5fe5d03533
""" GDAL - Constant definitions """ from ctypes import ( c_double, c_float, c_int16, c_int32, c_ubyte, c_uint16, c_uint32, ) # See https://gdal.org/api/raster_c_api.html#_CPPv412GDALDataType GDAL_PIXEL_TYPES = { 0: 'GDT_Unknown', # Unknown or unspecified type 1: 'GDT_Byte', # Eight bit unsigned integer ...
a5b70923c048036f4d12fa8fef749578cdefa1db450be3b9e460b1a4c7e15b47
""" This module houses the ctypes function prototypes for GDAL DataSource (raster) related data structures. """ from ctypes import POINTER, c_bool, c_char_p, c_double, c_int, c_void_p from functools import partial from django.contrib.gis.gdal.libgdal import std_call from django.contrib.gis.gdal.prototypes.generation i...
adeb4feae8ecf169b3909c1cdb731463edfb8e6eadee397cef333e3d17bea476
""" This module houses the ctypes function prototypes for OGR DataSource related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*, OGR_Fld_* routines are relevant here. """ from ctypes import POINTER, c_char_p, c_double, c_int, c_long, c_void_p from django.contrib.gis.gdal.envelope import OGREnvelope from djan...
fb2fae6576fd698c47cb045f4016535a557a2c04b1b836b69f23790e1fd9bfa6
from ctypes import POINTER, c_char_p, c_int, c_void_p from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal, std_call from django.contrib.gis.gdal.prototypes.generation import ( const_string_output, double_output, int_output, srs_output, string_output, void_output, ) # Shortcut generation for routi...
47adae552a3951e7bc445ce77c157f132e753e07600dd4ab3055d04c6321c1f1
from ctypes import POINTER, c_char_p, c_int, c_ubyte, c_uint from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, GEOSFuncFactory from django.contrib.gis.geos.prototypes.errcheck import ( check_geom, check_minus_one, check_string, ) # This is the return type used by binary output (WKB, HEX) routines. c_u...
52f15c467bca9fd0b3316eb3f72e9a5876e6d13a0e83e02d209c46eaa13e51de
""" This module contains all of the GEOS ctypes function prototypes. Each prototype handles the interaction between the GEOS library and Python via ctypes. """ from django.contrib.gis.geos.prototypes.coordseq import ( # NOQA create_cs, cs_clone, cs_getdims, cs_getordinate, cs_getsize, cs_getx, cs_gety, cs_...
d8358957ca73198d9072e8facccf82d0c73c4742ad2db01fd8f1fcc7ce58cffe
""" Tests for django.core.servers. """ import errno import os import socket import threading from http.client import HTTPConnection from urllib.error import HTTPError from urllib.parse import urlencode from urllib.request import urlopen from django.conf import settings from django.core.servers.basehttp import Threaded...
4eeb9574e57338aa06e6466223cdab410a2a2846193481a126befb214996ca50
import datetime from io import StringIO from unittest import mock from django.core.management.base import OutputWrapper from django.db.migrations.questioner import ( InteractiveMigrationQuestioner, MigrationQuestioner, ) from django.db.models import NOT_PROVIDED from django.test import SimpleTestCase from django.t...
8bd1ddf879af7c9755c9f460085d92ad922823384ca6c3620d04e9cc429035f4
from unittest import mock from django.apps.registry import apps as global_apps from django.db import DatabaseError, connection, migrations, models from django.db.migrations.exceptions import InvalidMigrationPlan from django.db.migrations.executor import MigrationExecutor from django.db.migrations.graph import Migratio...
48ed6566427f90539e313ff8b3f506c9623463ca857e6270cecf4e09c9abf164
import datetime import importlib import io import os import sys from unittest import mock from django.apps import apps from django.core.management import CommandError, call_command from django.db import ( ConnectionHandler, DatabaseError, OperationalError, connection, connections, models, ) from django.db.back...
835457339eba3835f5bcf6180180cc2dd3a5dd315c9e4cd044c8678d41f514a6
import datetime import decimal import enum import functools import math import os import pathlib import re import sys import uuid from unittest import mock try: import zoneinfo except ImportError: from backports import zoneinfo try: import pytz except ImportError: pytz = None import custom_migration_...
91b505d5cb5d2f7b9b3b5d0fa7a0a63f94dc3cfeb3f8d8e080b6eccf5dd7758f
import compileall import os from importlib import import_module from django.db import connection, connections from django.db.migrations.exceptions import ( AmbiguityError, InconsistentMigrationHistory, NodeNotFoundError, ) from django.db.migrations.loader import MigrationLoader from django.db.migrations.recorder i...
69620670def3fe92e79dc879fcb3c32a82267b4e28ba0a7daa04ed4e2a30b3de
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.fields import FieldOperation from django.db.migrations.state import ModelState, Projec...
832d196892fe10aaafd4c224b73d7e7b3d184590ca2eebc3608ec090d1de1a4b
import functools import re from unittest import mock from django.apps import apps from django.conf import settings from django.contrib.auth.models import AbstractBaseUser from django.core.validators import RegexValidator, validate_slug from django.db import connection, migrations, models from django.db.migrations.auto...
9bd6a4f2c98eca17f51f987799dce33ed43ae914c2d640e4a1fe25bde0a282be
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....
63ff5b9b7e9337bfc5724f5e8572aa01cebf597b1bd16e38e2fe57d3fcca8191
import re from django.forms import CharField, Form, Media from django.http import HttpRequest, HttpResponse from django.middleware.csrf import ( CSRF_TOKEN_LENGTH, CsrfViewMiddleware, _unmask_cipher_token, get_token, ) from django.template import TemplateDoesNotExist, TemplateSyntaxError from django.template.backe...
cce6cd8955ecda34c1ca1c5be683f86aed43c930ed33d6823517329436afd732
from datetime import datetime from django.core.exceptions import ValidationError from django.db import models from django.db.models.functions import Lower def validate_answer_to_universe(value): if value != 42: raise ValidationError('This is not the answer to life, universe and everything!', code='not42'...
36a82a219e009a5d250a9117d48f20c84043e07c37196df5cf631ece1adc5c8f
import datetime import unittest from django.apps.registry import Apps from django.core.exceptions import ValidationError from django.db import models from django.test import TestCase from .models import ( CustomPKModel, FlexibleDatePost, ModelToValidate, Post, UniqueErrorsModel, UniqueFieldsModel, UniqueForDa...
b4b38138302dbb9697ae9891ae467d26014a41b70f72424251dd9fb54cd50772
import os import sys import unittest from types import ModuleType, SimpleNamespace from unittest import mock from django.conf import ( ENVIRONMENT_VARIABLE, USE_DEPRECATED_PYTZ_DEPRECATED_MSG, LazySettings, Settings, settings, ) from django.core.exceptions import ImproperlyConfigured from django.http import Ht...
5a0e9f87264c84b2a79927dcb12942f754ff64bbc0338759a9da5a6276776eb9
from django.test import TestCase from .models import Person class PropertyTests(TestCase): @classmethod def setUpTestData(cls): cls.a = Person.objects.create(first_name='John', last_name='Lennon') def test_getter(self): self.assertEqual(self.a.full_name, 'John Lennon') def test_set...
8bbc0fea77f7ac512686775b88ed7ba7cbcd41eb565dd7e36efa8d456d5ef309
import builtins import getpass import os import sys from datetime import date from io import StringIO from unittest import mock from django.apps import apps from django.contrib.auth import get_permission_codename, management from django.contrib.auth.management import ( create_permissions, get_default_username, ) f...
354195f2cff203a55b3da26a5f74a501d7531a51f746394e96fdf3669c651089
import sys from datetime import date from unittest import mock from django.contrib.auth import ( BACKEND_SESSION_KEY, SESSION_KEY, _clean_credentials, authenticate, get_user, signals, ) from django.contrib.auth.backends import BaseBackend, ModelBackend from django.contrib.auth.hashers import MD5PasswordHasher ...
638b8463cb1ef579b0129db1829de227be79c3d49b32aab0112f0bf068e27972
import os from django.contrib.auth import validators from django.contrib.auth.models import User from django.contrib.auth.password_validation import ( CommonPasswordValidator, MinimumLengthValidator, NumericPasswordValidator, UserAttributeSimilarityValidator, get_default_password_validators, get_password_v...
223f72472eb2456ee97f5d7126279f0af51891c0bc38b8f423e3b31031954afe
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, BCryptPasswordHasher, BCryptSHA256PasswordHasher, MD5PasswordHasher, PBKDF2PasswordHasher, ...
fc50e70f9dc52ad5a27ff9c424c63eb75177ff09084015e0331e8ed0bfee90d7
import os from django.core.exceptions import SuspiciousFileOperation from django.core.files.base import ContentFile from django.core.files.storage import FileSystemStorage, Storage from django.db.models import FileField from django.test import SimpleTestCase class AWSS3Storage(Storage): """ Simulate an AWS S...
c638db089a21f1c7b9fd9200c5c50e09ba6638be7cfded5aa0abcb5e83dbe979
import os import shutil import sys import tempfile import threading import time import unittest from datetime import datetime, timedelta from io import StringIO from pathlib import Path from urllib.request import urlopen from django.core.cache import cache from django.core.exceptions import SuspiciousFileOperation fro...
652d023d2c37bb88f8df8b84b31be8443319ecc8ba64159d5f6b43b37773e196
import string 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, re_path, resolve, reverse, ) from django.views import View from .converters import D...
0f610c0da1e98d704037ab1ec66c4de4ca5f8695acb9b2867f456975f83c3024
import threading import time from unittest import mock from multiple_database.routers import TestRouter from django.core.exceptions import FieldError from django.db import ( DatabaseError, NotSupportedError, connection, connections, router, transaction, ) from django.test import ( TransactionTestCase, ove...
5564eb4e800138f7157df9f8c26a12c9bd835013dd9b35c7585465e30724ec0c
import re from django.conf import settings from django.contrib.sessions.backends.cache import SessionStore from django.core.exceptions import ImproperlyConfigured from django.http import HttpRequest, HttpResponse, UnreadablePostError from django.middleware.csrf import ( CSRF_ALLOWED_CHARS, CSRF_SECRET_LENGTH, CSRF...
dc287eabd6ff9b44206c387f3b8d57b145633b28358b234f7328771970975510
from django.http import HttpRequest from django.template.context_processors import csrf from django.test import SimpleTestCase from .tests import CsrfFunctionTestMixin class TestContextProcessor(CsrfFunctionTestMixin, SimpleTestCase): def test_force_token_to_string(self): request = HttpRequest() ...
0aaa5e6e89d6afad7fd0a909ab8e103434f222139be3c1f93f96915996dbe877
from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.db import models class Relation(models.Model): pass class InstanceOnlyDescriptor: def __get__(self, instance, cls=None): if instance is No...
c8293a8aa5e17afa3d8a20f47b8fbf73d1c1bbfd450e2e59af41a9163da97483
import datetime import math import re from decimal import Decimal from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( Avg, Case, Count, DateField, DateTimeField, DecimalField, DurationField, Exists, F, FloatField, IntegerField, Max, Min, OuterRef, Q, St...
539ea38ee4ee350d01a1a24bc7c97e042edbc41b93ac7565ecd67bc69740deb7
import datetime from decimal import Decimal from django.db.models import ( Avg, Case, Count, Exists, F, Max, OuterRef, Q, StdDev, Subquery, Sum, Variance, When, ) from django.test import TestCase from django.test.utils import Approximate from .models import Author, Book, Publisher class FilteredAggregateTes...
88ea82cd4a4c71e1f26e777ef608f6c94fe3b5e20f340a01ac01b11c8f757150
from functools import wraps from django.db import IntegrityError, connections, transaction from django.test import TestCase, skipUnlessDBFeature from django.test.testcases import DatabaseOperationForbidden, TestData from .models import Car, Person, PossessedCar class TestTestCase(TestCase): @skipUnlessDBFeatur...
60a50caced08ab51c8a02d9288eb0db25b6c423e309411bd323f1d5812115b1f
import logging import os import unittest import warnings from io import StringIO from unittest import mock from django.conf import settings from django.contrib.staticfiles.finders import get_finder, get_finders from django.contrib.staticfiles.storage import staticfiles_storage from django.core.exceptions import Improp...
a87bc98d7a176475270a68820be82efc3efb6b8f25dbce7c2d9ec05db57869cb
from django.db import models class Car(models.Model): name = models.CharField(max_length=100) class Person(models.Model): name = models.CharField(max_length=100) cars = models.ManyToManyField(Car, through='PossessedCar') data = models.BinaryField(null=True) class PossessedCar(models.Model): ca...
d56ef6bc1144acbb3ce95999d9700107df0d4f071d61e11466dddd9632ce3dab
from unittest import mock from django.db import connections from django.test import TestCase, TransactionTestCase, override_settings from django.test.testcases import DatabaseOperationForbidden from .models import Car class TestSerializedRollbackInhibitsPostMigrate(TransactionTestCase): """ TransactionTestC...
1c2a459e2b635d8a605970bfb364a803c184894334d41b9f2cfce82c0c54f137
import datetime import os import re import unittest from unittest import mock from urllib.parse import parse_qsl, urljoin, urlparse try: import zoneinfo except ImportError: from backports import zoneinfo try: import pytz except ImportError: pytz = None from django.contrib import admin from django.con...
151155b7e7066d735f32bb8c75bd85291d06ac83a1034e2bca8d0d656561ff73
import datetime import tempfile import uuid from django.contrib import admin from django.contrib.auth.models import User from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ValidationErr...
c1a50b43c6acf45984ac88670501fec79acaa2ee63ff4325d76b928127e2de1d
import datetime from io import StringIO from wsgiref.util import FileWrapper from django import forms from django.contrib import admin from django.contrib.admin import BooleanFieldListFilter from django.contrib.admin.views.main import ChangeList from django.contrib.auth.admin import GroupAdmin, UserAdmin from django.c...
f226ea9ef532b261d0c14137168cd317e3a22947c753233fb28725069dee482d
import json from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.admin.views.main import IS_POPUP_VAR from django.contrib.auth.models import Permission, User from django.core import mail from django.template.loader import render_to_string from django.template.response import TemplateRespon...
6fe303e8b1ea33e7d3e9b9d4238a6b01205b5f95586994a88492f1dd8dd8a938
from django.contrib.admin.models import CHANGE, LogEntry from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.core.paginator import Paginator from django.test import TestCase, override_settings fro...
f0f0f84c65b39353f9248a217d33e9c02dea91c5cfdf9dacfcbd46ce9253596d
from django.contrib import admin from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.urls import path, reverse from .models import Héllo class AdminSiteWithSidebar(admin.AdminSite): pass class A...
ee27248ab61f90bdf9103cb37b9ced394c6924215153fc293afdbf9ac62f8127
import datetime import json from contextlib import contextmanager from django.contrib import admin from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.admin.views.autocomplete import AutocompleteJsonView from django.contrib.auth.models import Permission, User from django.contrib.contenttyp...
d617235be0bec395c301888ca3a7a45dcb7424ddf010fe4409d988ac4b32a9f7
import datetime import pickle import django from django.db import models from django.test import TestCase from .models import ( BinaryFieldModel, Container, Event, Group, Happening, M2MModel, MyEvent, ) class PickleabilityTestCase(TestCase): @classmethod def setUpTestData(cls): cls.happening = H...
8cb62cd624dd00015bb611a04d0758ae418d139cf0e7d4153108ac720abbbe81
import datetime from django.db import DJANGO_VERSION_PICKLE_KEY, models from django.utils.translation import gettext_lazy as _ def standalone_number(): return 1 class Numbers: @staticmethod def get_static_number(): return 2 class PreviousDjangoVersionQuerySet(models.QuerySet): def __getst...