hash
stringlengths
64
64
content
stringlengths
0
1.51M
cbcad3e4ed0820b93d274a0e0eefc28fe6cb726260acf2110683bba767c5c570
import getpass from django.contrib.auth import get_user_model from django.contrib.auth.password_validation import validate_password from django.core.exceptions import ValidationError from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS UserModel = get_user_model() ...
f081bc936c315190a439517fec2832da1a2ec1a2672f64a8deaf09a8c6a33446
""" Management utility to create superusers. """ import getpass 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.management....
ca65f5dd19dd64788b584dd5eb9be00758b8a7e021ccaf2969963f421d4e15e9
#!/usr/bin/env python import argparse import subprocess import sys from pathlib import Path try: import closure except ImportError: closure_compiler = None else: closure_compiler = closure.get_jar_filename() js_path = Path(__file__).parent.parent / 'static' / 'admin' / 'js' def main(): description =...
7a1052608d430cbab3983514636275cccc08246a1fa27b8028091210a4e62b21
from datetime import datetime, timedelta from django.conf import settings from django.contrib.admin import FieldListFilter from django.contrib.admin.exceptions import ( DisallowedModelAdminLookup, DisallowedModelAdminToField, ) from django.contrib.admin.options import ( IS_POPUP_VAR, TO_FIELD_VAR, IncorrectLoo...
8e51ca52f46dd3cc791a396e43eb7aef1dea5e87afacd56302cc7c6dac746f98
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 = 20 model_admin = None def get(self, request, *args, **kwargs): """ Return ...
920fa9ef371044a0d8fdc026a8584a501a09322b9505e52411dcfa5276fa1bb5
import datetime from django.contrib.admin.templatetags.admin_urls import add_preserved_filters from django.contrib.admin.utils import ( display_for_field, display_for_value, label_for_field, lookup_field, ) from django.contrib.admin.views.main import ( ALL_VAR, ORDER_VAR, PAGE_VAR, SEARCH_VAR, ) from django.co...
46517a05203c8349b9668260a229277001a045c71913a165572f33494d587171
import re from datetime import date, datetime from decimal import Decimal from django import template from django.conf import settings from django.template import defaultfilters from django.utils.formats import number_format from django.utils.safestring import mark_safe from django.utils.timezone import is_aware, utc ...
f2e6e31e3ba8eccd3751b8b01a42853f07d80db4986dd7a3f429cffbee2eb71b
import os from django.apps import apps from django.contrib.staticfiles.finders import get_finders from django.contrib.staticfiles.storage import staticfiles_storage from django.core.files.storage import FileSystemStorage from django.core.management.base import BaseCommand, CommandError from django.core.management.colo...
29a810135b50800221fd3d1f858cfeb42f808bf778d231b20aa23b7e25b13976
from django.apps import apps as global_apps from django.db import DEFAULT_DB_ALIAS, migrations, router, transaction from django.db.utils import IntegrityError class RenameContentType(migrations.RunPython): def __init__(self, app_label, old_model, new_model): self.app_label = app_label self.old_mod...
74fc430e910e1eca11a1e1d8a2c1e7e7da04618a37d513e6a3674cf1d4e7bb45
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 from ...management import get_contenttypes_and_models class Command(BaseCommand): ...
d0bdf20d7d3f785b4ff7f19597bf4ea517c746d27da39bce52c4426071473840
import datetime import logging import os import shutil import tempfile from django.conf import settings from django.contrib.sessions.backends.base import ( VALID_KEY_CHARS, CreateError, SessionBase, UpdateError, ) from django.contrib.sessions.exceptions import InvalidSessionKey from django.core.exceptions import I...
2771ee7741b1dd222bdc0e32b0b4e18505123d7730cd170dde4b21d9536fd9d1
import base64 import logging import string import warnings from datetime import datetime, timedelta from django.conf import settings from django.contrib.sessions.exceptions import SuspiciousSession from django.core.exceptions import SuspiciousOperation from django.utils import timezone from django.utils.crypto import ...
2f8de00e993e4456cc17ff9f96e123cf250ee672ab1220935f4c99b3b71de5e2
from django.contrib.sessions.backends.base import SessionBase from django.core import signing class SessionStore(SessionBase): def load(self): """ Load the data from the key itself instead of fetching from some external data store. Opposite of _get_session_key(), raise BadSignature ...
e25640e7fadb768f881bb0e7a9d750c93ff6248fc05e1b96f6776e070316ad06
""" This module is for inspecting OGR data sources and generating either models for GeoDjango and/or mapping dictionaries for use with the `LayerMapping` utility. """ from django.contrib.gis.gdal import DataSource from django.contrib.gis.gdal.field import ( OFTDate, OFTDateTime, OFTInteger, OFTInteger64, OFTReal, O...
7ff3201e5cb151acf5afa1447c8d85e8dcc8ee75a9f3f2d2572fc9998c886ef9
# 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...
e43e653d9c0562066255a283ede0a497dbe3fa9191075d4712078d9715008dfa
from django.contrib.gis.gdal import SpatialReference from django.db import DEFAULT_DB_ALIAS, connections def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None, database=None): """ Take a GDAL SpatialReference system and add its information to the `spatial_ref_sys` ta...
bb7f6f6d9ccd5796d0292d2729bd156c7b12466de6ebdaf6f5b670a4d6cdb376
def City(response): return { 'city': response.city.name, 'continent_code': response.continent.code, 'continent_name': response.continent.name, 'country_code': response.country.iso_code, 'country_name': response.country.name, 'dma_code': response.location.metro_code, ...
8653993a4b8a47643cc1c97edeee61e92e82518053b5842179e3ad6951a23c18
from django import forms from django.contrib.gis.gdal import GDALException from django.contrib.gis.geos import GEOSException, GEOSGeometry from django.utils.translation import gettext_lazy as _ from .widgets import OpenLayersWidget class GeometryField(forms.Field): """ This is the basic form field for a Geom...
21647ef7c218417bc9489e32dddd3d921dd9c6e159b842a0f93f5e0228391840
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/ """ def _i...
c58e67a160073405d6bdbfd07f392a411094a536f1ac9d1b865053b603bf8277
""" 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...
8421dfc50b1e7016a4219503670124102747edd83709d17863f900158916f4e8
from django.contrib.gis.gdal.error import GDALException class OGRGeomType: "Encapsulate OGR Geometry Types." wkb25bit = -2147483648 # Dictionary of acceptable OGRwkbGeometryType s and their string names. _types = { 0: 'Unknown', 1: 'Point', 2: 'LineString', 3: 'Polygo...
a371b01b9573646b1395c99e7ce320b4d1b8994d378ea8488341895003fd0bcb
""" The OGRGeometry is a wrapper for using the OGR Geometry class (see https://www.gdal.org/classOGRGeometry.html). 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 is "pythonic" unli...
01eadd27db0b7abbbd677f4f12d4c05e9d78bda6cc7305ff2c86638341320c01
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...
2981b24183565eb1099b62347881b529c77b5933995a20be6ac2231790e63bd2
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....
caff72bed04f8cb591a901e5ce0945fa02c35be9d1ef317f179c6c7a3fe8071e
""" 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...
94bd7705895a132c4336408908f9c5664d777b245bf693a438eac074fd7a42dc
""" 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) ...
13b263e33df3fbe582d88766e46bd8b4318612b76d9b5b40ab337c2e297ec918
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...
46b0109788fbf12040f57e0e992194fcc286c72334e58e90f56231de5f5634b2
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: ...
d8f3cfde5a66963200f8a72e375148e5d3503e410b4777b23e66ab3f62987d89
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...
8b0fbc4e528289e5decc6a3e17f0eb5c53efbe95c188d3b84dd1ea201fd51082
""" The Spatial Reference class, represents OGR Spatial Reference objects. Example: >>> from django.contrib.gis.gdal import SpatialReference >>> srs = SpatialReference('WGS84') >>> print(srs) GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY...
cf852b23b3f36fbdc5b13d96808317f73b0c1bf1e0ea0f3dbe492f80a3c73b3f
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.gdal import OGRGeomType from django.forms import Media spherical_mercator_srid = 3857 class GeoModelAdmin(ModelAdmin): """ The administrat...
f2e27ff6be3c0252080f361a51bfea003d1e62c95e93dcaf017f4809d0a68790
# Copyright (c) 2008-2009 Aryeh Leib Taurog, all rights reserved. # Released under the New BSD license. """ This module contains a base type which provides list-style mutations without specific data storage methods. See also http://static.aryehleib.com/oldsite/MutableLists.html Author: Aryeh Leib Taurog. """ from fun...
c94323d3602486ed4137dce968f3126a8c9fa512568b6f3692463f47a305fa46
""" This module houses the Geometry Collection objects: GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon """ from ctypes import byref, c_int, c_uint from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin from django.contr...
275a946584f12cbc4c4cfd5de7ef34f4baa878fc2686d102094819306786634b
""" 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...
023ea485d20f30c204f9c0de0ea882390e92a87a4319da393470bc7cfa128dd1
from ctypes import c_uint from django.contrib.gis import gdal from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.error import GEOSException from django.contrib.gis.geos.geometry import GEOSGeometry class Point(GEOSGeometry): _minlength = 2 _maxlength = 3 has_cs = True ...
5c125e7f33635f5c855d5ce77156044f4cccde378c8e9361e1de1ac79bce756c
""" 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...
9c0245b1a0576c833d640fe04b1541ff758d5c91f06a49a197137f5732ace164
from ctypes import byref, c_uint 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 __i...
3bc00d8f288c1b6780f76fde7cb7de72bd3a51f2c7582c5fe2277b8e80a61470
from django.contrib.gis.db.models.fields import ( ExtentField, GeometryCollectionField, GeometryField, LineStringField, ) from django.db.models.aggregates import Aggregate from django.utils.functional import cached_property __all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'] class GeoAggregate(Aggre...
9c7fb798311a18d7f880d8a1305dfe0fd5afb4895e1271510a5ff5960a742683
from collections import defaultdict, namedtuple from django.contrib.gis import forms, gdal from django.contrib.gis.db.models.proxy import SpatialProxy from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.geos import ( GeometryCollection, GEOSException, GEOSGeometry, LineString, Multi...
fcf24b6a697cc8a6bfb69d55d8f9c65ed4f973a50648aa218f3c2ce68cf3802a
from decimal import Decimal from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField from django.contrib.gis.db.models.sql import AreaField, DistanceField from django.contrib.gis.geos import GEOSGeometry from django.core.exceptions import FieldError from django.db.models import ( BooleanFiel...
0837e5f4cf4f7025eee4a7cb6d73a3c047ccbf1779b26708e324c54f92a75ec8
import cx_Oracle from django.db.backends.oracle.introspection import DatabaseIntrospection class OracleIntrospection(DatabaseIntrospection): # Associating any OBJECTVAR instances with GeometryField. Of course, # this won't work right on Oracle objects that aren't MDSYS.SDO_GEOMETRY, # but it is the only...
a53df67ff0351516303b9856322817ecf53fa23a5198885d52584ea9dcf647d9
""" The GeometryColumns and SpatialRefSys models for the Oracle spatial backend. It should be noted that Oracle Spatial does not have database tables named according to the OGC standard, so the closest analogs are used. For example, the `USER_SDO_GEOM_METADATA` is used for the GeometryColumns model and the `SDO_...
68f2b6750da34d01c87f99a18b95472d572bff88b42b2146f7d20baac6d6d907
""" This module contains the spatial lookup types, and the `get_geo_where_clause` routine for Oracle Spatial. Please note that WKT support is broken on the XE version, and thus this backend will not work on such platforms. Specifically, XE lacks support for an internal JVM, and Java libraries are required to use...
b1c55e47be588fcbecd2aff4a3bf065589fdf01c6c3822a62cedc5ea581c1877
import re from django.contrib.gis.db.models import aggregates class BaseSpatialFeatures: gis_enabled = True # Does the database contain a SpatialRefSys model to store SRID information? has_spatialrefsys_table = True # Does the backend support the django.contrib.gis.utils.add_srs_entry() utility? ...
82b5a186100d9a2da3171bdfea158b1abb3659480dbfa7fb1aa5fc9495364bd1
from django.contrib.gis.db.models import GeometryField from django.contrib.gis.db.models.functions import Distance from django.contrib.gis.measure import ( Area as AreaMeasure, Distance as DistanceMeasure, ) from django.db.utils import NotSupportedError from django.utils.functional import cached_property class Ba...
08365b2de32070645dab046dcaea7b57d70bfe3fd8a720b339d201cb40a7d59d
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures from django.db.backends.mysql.features import ( DatabaseFeatures as MySQLDatabaseFeatures, ) from django.utils.functional import cached_property class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures): has_spatialrefsys_ta...
42ea0939a1de4f1aabd1e8eef07580e409b3198a42d792adf54e6e08dc495870
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. ...
c7a50e5d0ce7bfd8d503ee356f74249593cce91a604e1e858d58c9085126f9df
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.db.models import aggregates from django.contrib.gis.geos.geometry import G...
499a5efcef2107e88628ff5de918904318e4f2995196acf8024f45ac9d7f0187
from django.contrib.gis.gdal import OGRGeomType from django.db.backends.sqlite3.introspection import ( DatabaseIntrospection, FlexibleFieldLookupDict, ) class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict): """ Sublcass that includes updates the `base_data_types_reverse` dict for geometry field t...
8a2a1d70a61600c233ff1ac96a0afed676e288ed98258fd0d2fb7fd2ec9a0f9e
""" The GeometryColumns and SpatialRefSys models for the SpatiaLite backend. """ from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin from django.db import models class SpatialiteGeometryColumns(models.Model): """ The 'geometry_columns' table from SpatiaLite. """ f_table_name = m...
b8a3a24efb51c4eb8356a722c649999c07651d6e8973e82208a32e63c6e6f3a1
""" SQL functions reference lists: https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html """ from django.contrib.gis.db.backends.base.operations import ( BaseSpatialOperations, ) from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter from django.contrib.gis.db.backends.utils import Sp...
86dcf8e4fa273150ec76248bb10260e313a5cac69775a5ddca3883349c66e962
from django.contrib.gis.gdal import OGRGeomType from django.db.backends.postgresql.introspection import DatabaseIntrospection class PostGISIntrospection(DatabaseIntrospection): postgis_oid_lookup = {} # Populated when introspection is performed. ignored_tables = DatabaseIntrospection.ignored_tables + [ ...
b4a8916733baa766099cf6cf5d178c9457008858a3f82fc7ffac3c14784bab19
""" The GeometryColumns and SpatialRefSys models for the PostGIS backend. """ from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin from django.db import models class PostGISGeometryColumns(models.Model): """ The 'geometry_columns' view from PostGIS. See the PostGIS documentation at C...
1deee656926b25d6cc1a33c08074579269b6db90ae57155cfaf8a22524ca3a29
""" PostGIS to GDAL conversion constant definitions """ # Lookup to convert pixel type values from GDAL to PostGIS GDAL_TO_POSTGIS = [None, 4, 6, 5, 8, 7, 10, 11, None, None, None, None] # Lookup to convert pixel type values from PostGIS to GDAL POSTGIS_TO_GDAL = [1, 1, 1, 3, 1, 3, 2, 5, 4, None, 6, 7, None, None] # ...
4d727f90d34909feb73c9f6525eea3abf8470ab21b72e7ff554229ceab8537b1
import re from django.conf import settings from django.contrib.gis.db.backends.base.operations import ( BaseSpatialOperations, ) from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.db.models import GeometryField, RasterField from django.contrib.gis.gdal import GDALRaster from d...
1862b73d2a215f04568681dac460571e70e465d5128b3f13c4e6a581d0c570d4
from django.db.backends.postgresql.schema import DatabaseSchemaEditor class PostGISSchemaEditor(DatabaseSchemaEditor): geom_index_type = 'GIST' geom_index_ops_nd = 'GIST_GEOMETRY_OPS_ND' rast_index_wrapper = 'ST_ConvexHull(%s)' sql_alter_column_to_3d = "ALTER COLUMN %(column)s TYPE %(type)s USING ST_...
b34ed28579cba030e1b6fce0bb555e47397193fa3af917057e5cec6e32990859
import argparse from django.contrib.gis import gdal from django.core.management.base import BaseCommand, CommandError from django.utils.inspect import get_func_args class LayerOptionAction(argparse.Action): """ Custom argparse action for the `ogrinspect` `layer_key` keyword option which may be an integer...
b69c9916872379e44dea1135c977e9d4200dcf269062a42923c44b84ab46cc10
from django.core.management.commands.inspectdb import ( Command as InspectDBCommand, ) class Command(InspectDBCommand): db_module = 'django.contrib.gis.db' def get_field_type(self, connection, table_name, row): field_type, field_params, field_notes = super().get_field_type(connection, table_name,...
d12e27d99d726e0c0c8dc79956318e52493d775bf008b91e381a6c4293394090
import json import os import sys import uuid from ctypes import ( addressof, byref, c_buffer, c_char_p, c_double, c_int, c_void_p, string_at, ) from django.contrib.gis.gdal.driver import Driver from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.prototypes import raster as capi fro...
b8f93cf39f5849110cb6242d5c69153a12129a0b05ea05cfec951fb9f4035c82
""" GDAL - Constant definitions """ from ctypes import ( c_double, c_float, c_int16, c_int32, c_ubyte, c_uint16, c_uint32, ) # See https://www.gdal.org/gdal_8h.html#a22e22ce0a55036a96f652765793fb7a4 GDAL_PIXEL_TYPES = { 0: 'GDT_Unknown', # Unknown or unspecified type 1: 'GDT_Byte', # Eight bit unsigned i...
7518a4190ebe70a0a03a3ddb8d14a720a775f7a14644633611ef41b4f406564d
from ctypes import byref, c_double, c_int, c_void_p from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.prototypes import raster as capi from django.contrib.gis.gdal.raster.base import GDALRasterBase from django.contrib.gis.shortcuts import numpy from django.utils.encoding import force...
f5474f4aa591dbc02c506ec70dd1cc446da7235fa22abd6bbb557df7cba27cff
""" This module contains functions that generate ctypes prototypes for the GDAL routines. """ from ctypes import ( POINTER, c_bool, c_char_p, c_double, c_int, c_int64, c_void_p, ) from functools import partial from django.contrib.gis.gdal.prototypes.errcheck import ( check_arg_errcode, check_const_string, ch...
7248f2a9c66dad565cb6bc3e1ef41bd62b036af85401b94ba8aba7a3d538ba9c
""" This module houses the error-checking routines used by the GDAL ctypes prototypes. """ from ctypes import c_void_p, string_at from django.contrib.gis.gdal.error import ( GDALException, SRSException, check_err, ) from django.contrib.gis.gdal.libgdal import lgdal # Helper routines for retrieving pointers and...
ccf21cf956a1b5abb55d04c00eac5036dcdc02fe8bba76e154791690c38458aa
""" 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 GDAL_VERSION, std_call from django.contrib.gis.gdal.prototype...
1a7c50e36dbd30e6793508c94ed98272cb7118f1fa1e151df40b025ac8a1ebfb
""" 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...
5764a55049e26467d59e3ffdaf5ed79de4fbc3e3a8094a642ffb2e98a2212db5
import threading from ctypes import POINTER, Structure, byref, c_byte, c_char_p, c_int, c_size_t from django.contrib.gis.geos.base import GEOSBase from django.contrib.gis.geos.libgeos import ( GEOM_PTR, GEOSFuncFactory, geos_version_tuple, ) from django.contrib.gis.geos.prototypes.errcheck import ( check_geom,...
c27aeec001c42eeabdc9f7f97720d1d65409d1c275a98b365b29eb9577f6e317
""" Tests for django.core.servers. """ import errno import os import socket from http.client import HTTPConnection from urllib.error import HTTPError from urllib.parse import urlencode from urllib.request import urlopen from django.test import LiveServerTestCase, override_settings from .models import Person TEST_ROO...
9809af6d6239e50ed0b87cd4ffb3af03af789e8f4d324564e0d3125beccf71f5
from django.urls import path from . import views urlpatterns = [ path('example_view/', views.example_view), path('streaming_example_view/', views.streaming_example_view), path('model_view/', views.model_view), path('create_model_instance/', views.create_model_instance), path('environ_view/', views...
525c04ef31ab6e366a2fe328ab59e7303ff2868f2e6591dda8a0366bb6035e23
from io import BytesIO from django.core.handlers.wsgi import WSGIRequest from django.core.servers.basehttp import WSGIRequestHandler from django.test import SimpleTestCase from django.test.client import RequestFactory class Stub: def __init__(self, **kwargs): self.__dict__.update(kwargs) def sendall...
6cea017ab0f3ad355bbeec4454dde81022cd15565aa5b9ee653e7e27871de302
from django.db import DEFAULT_DB_ALIAS, connections from django.test import LiveServerTestCase, TestCase class LiveServerThreadTest(TestCase): def run_live_server_thread(self, connections_override=None): thread = LiveServerTestCase._create_server_thread(connections_override) thread.daemon = True ...
f3ff06a8aefcfb1c569c639e3cad0897624d1c26538dfbf9ef6791b1f5771900
from urllib.request import urlopen from django.http import HttpResponse, StreamingHttpResponse from django.views.decorators.csrf import csrf_exempt from .models import Person def example_view(request): return HttpResponse('example view') def streaming_example_view(request): return StreamingHttpResponse((b...
ebbb8654be75e1567f480973f7a3542f0f7c2c04e900c81e2fe1eb8b9d981fd0
from django.db import migrations, models from django.db.migrations import operations from django.db.migrations.optimizer import MigrationOptimizer from django.db.migrations.serializer import serializer_factory from django.test import SimpleTestCase from .models import EmptyManager, UnicodeModel class OptimizerTests(...
706d3d6e5a8c45cfb839d1666c241ea52b3ce5d422f95309aa52dd5beed6d30a
import datetime from unittest import mock from django.db.migrations.questioner import ( InteractiveMigrationQuestioner, MigrationQuestioner, ) from django.test import SimpleTestCase from django.test.utils import captured_stdout, override_settings class QuestionerTests(SimpleTestCase): @override_settings( ...
6bb4144bb803fda655078c878ea87e35e6e7ddc1ef37d30146cec7beafffad01
from unittest import mock from django.apps.registry import apps as global_apps from django.db import connection from django.db.migrations.exceptions import InvalidMigrationPlan from django.db.migrations.executor import MigrationExecutor from django.db.migrations.graph import MigrationGraph from django.db.migrations.re...
217dd4da8d05756e50cc21ce1727d5a4a8a61ad31473738e20e996c27b98cfc8
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, connection, connections, models, ) from django.db.backends.base.schema impor...
5991b927e8f9f3c0d663770d504673369d2cda017e9ae383674ffdbacb442571
import datetime import decimal import enum import functools import math import os import re import uuid from unittest import mock import custom_migration_operations.more_operations import custom_migration_operations.operations from django import get_version from django.conf import SettingsReference, settings from dja...
e639bc05408086beec12efb7b11210659834d6f50a9933e9c8707357263cb77a
import compileall import os 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 import MigrationRecorder from django....
7f4922672cd7e29115b8819db7ce5c7c805585456fe2dc0edec6c8cc35588b18
from django.db.migrations.exceptions import ( CircularDependencyError, NodeNotFoundError, ) from django.db.migrations.graph import DummyNode, MigrationGraph, Node from django.test import SimpleTestCase class GraphTests(SimpleTestCase): """ Tests the digraph structure. """ def test_simple_graph(se...
f3dc4c9c745695698d97798ae78a04c04ffa33a9f1c1f07c51ece0099b3e2b3e
from django.core.exceptions import FieldDoesNotExist from django.db import connection, migrations, models, transaction from django.db.migrations.migration import Migration from django.db.migrations.operations import CreateModel from django.db.migrations.operations.fields import FieldOperation from django.db.migrations....
8268618e73efc8b89165dd23ff28c9f4d15ad8eec5b84fb97bdc82ff21ba0a5a
import os import shutil import tempfile from contextlib import contextmanager from importlib import import_module from django.apps import apps from django.db import connections from django.db.migrations.recorder import MigrationRecorder from django.test import TransactionTestCase from django.test.utils import extend_s...
813b008db1d5b85c0479f24194dc6359ae49b7b1c4259b8fba71b247f465d31a
from django.db import connection, migrations, models from django.db.migrations.state import ProjectState from django.test import override_settings from .test_operations import OperationTestBase class AgnosticRouter: """ A router that doesn't have an opinion regarding migrating. """ def allow_migrate(...
d6c9bd3fbcc6e4015a18d85e95d3248b1039a8ac96c5ae3d0c1ddf62940a9f04
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, models from django.db.migrations.autodetector imp...
9a6d62868e82e75c696a3f2a547b9fddb001cf71a13d39b8d6e69699e7b4bdb1
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....
07e2f9913b42c27236aeff0ddc72292fe9d0c2f97d4c9fbedff7dc865e8268e5
from template_tests.test_response import test_processor_name from django.template import Context, EngineHandler, RequestContext from django.template.backends.django import DjangoTemplates from django.template.library import InvalidTemplateLibrary from django.test import RequestFactory, override_settings from .test_du...
9d32cc03ce554af606efbbc7dfa64216642e4608ec4520ca6e1d9e6d55e1709a
import os import sys import tempfile import unittest import warnings from io import StringIO from unittest import mock from django.apps import apps from django.contrib.sites.models import Site from django.core import management from django.core.files.temp import NamedTemporaryFile from django.core.management import Co...
7c3c518781b1c3a7fe56d09d0d01c0eccc2f7a9727e6ea20fefd953cc28df340
""" Fixtures. Fixtures are a way of loading data into the database in bulk. Fixure data can be stored in any serializable format (including JSON and XML). Fixtures are identified by name, and are stored in either a directory named 'fixtures' in the application directory, or in one of the directories named in the ``FIX...
595998fbf1beaf82d47d7431fb8c7d3a17232ac0fea7df98839ec5c8b766ec37
from django import forms from django.core.exceptions import NON_FIELD_ERRORS from django.test import TestCase from django.utils.functional import lazy from . import ValidationAssertions from .models import ( Article, Author, GenericIPAddressTestModel, GenericIPAddrUnpackUniqueTest, ModelToValidate, ) class B...
ffb00a56a02ea5db118761c2beb73a331c3036795ad23fd8cb4058767b831f96
from django.core.exceptions import ValidationError class ValidationAssertions: def assertFailsValidation(self, clean, failed_fields, **kwargs): with self.assertRaises(ValidationError) as cm: clean(**kwargs) self.assertEqual(sorted(failed_fields), sorted(cm.exception.message_dict)) ...
95ce8d73ff78770d7301fd0ac7117446535117cc370a274dac955d2174fa3335
from django.test import SimpleTestCase from . import ValidationAssertions from .models import CustomMessagesModel class CustomMessagesTests(ValidationAssertions, SimpleTestCase): def test_custom_simple_validator_message(self): cmm = CustomMessagesModel(number=12) self.assertFieldFailsValidationWi...
7cb001fad6fa360eee97aa9f64c4200163efccf12d7068c4f26798e5864fac98
from django.test import SimpleTestCase from . import ValidationAssertions from .models import ModelToValidate class TestModelsWithValidators(ValidationAssertions, SimpleTestCase): def test_custom_validator_passes_for_correct_value(self): mtv = ModelToValidate(number=10, name='Some Name', f_with_custom_va...
8a1cd6a0ec9cd3963c49bbd9022fcaf0d402dc9842af6de95131b4519942e189
import os import sys import unittest from types import ModuleType, SimpleNamespace from unittest import mock from django.conf import ENVIRONMENT_VARIABLE, LazySettings, Settings, settings from django.core.exceptions import ImproperlyConfigured from django.http import HttpRequest from django.test import ( SimpleTes...
1796c08d22a123e165355c73f13bff2cb270f1f1e8ac046200688c4d246ed69a
import sys from types import ModuleType from django.conf import FILE_CHARSET_DEPRECATED_MSG, Settings, settings from django.test import SimpleTestCase, ignore_warnings from django.utils.deprecation import RemovedInDjango31Warning class DeprecationTests(SimpleTestCase): msg = FILE_CHARSET_DEPRECATED_MSG def ...
961b0d5a0835666299a91aee24ed2bfd341df952ee76efddcc27ec9d604b8b77
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...
f72e3931dc6c84ea994d6a789bda5e691b8222a07d380425fb55457d9ed5c7e7
from unittest import mock from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User from django.db import connections from django.test import TestCase, override_settings from django.urls import path, reverse class Router: target_db = None de...
181a6221caba36617074d72435460cfefdeb0533ae07fccb2c80f92f0ae41bd9
import datetime import itertools import os import re from importlib import import_module from unittest import mock from urllib.parse import quote from django.apps import apps from django.conf import settings from django.contrib.admin.models import LogEntry from django.contrib.auth import ( BACKEND_SESSION_KEY, RED...
74c546a4aab61cfba21db6bdf3ba17aab455501c3a5e223445de7c8fbc9ff79b
from datetime import datetime from django.conf import settings from django.contrib.auth import authenticate from django.contrib.auth.backends import RemoteUserBackend from django.contrib.auth.middleware import RemoteUserMiddleware from django.contrib.auth.models import User from django.test import TestCase, modify_set...
d7895eb989febb3e063c31fa8a0e938e1e02a93a329b30b275b7c24b16662748
from unittest import mock from django.conf.global_settings import PASSWORD_HASHERS from django.contrib.auth import get_user_model from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.hashers import get_hasher from django.contrib.auth.models import ( AbstractUser, AnonymousUser, Group...
d9fa988961265a57d9e454b0d419e8a03e328703e1e58bd1d36c81375f5d8b4a
from unittest import mock from django.contrib.auth import models from django.contrib.auth.mixins import ( LoginRequiredMixin, PermissionRequiredMixin, UserPassesTestMixin, ) from django.contrib.auth.models import AnonymousUser from django.core.exceptions import PermissionDenied from django.http import HttpResponse...
cb2f980c25cec825bccf0231661cb1ea5ae8898ea23a9c02d3250f3e14711d8b
from importlib import import_module from django.apps import apps from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models import ContentType from django.test import TestCase from django.test.utils import captured_stdout from .models import Proxy, UserProxy update_proxy_permissi...
def563b04ae9cac67d34a247aa11f79fd198582143ff601223787fba1f89648f
import builtins import getpass 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, ) from django...