code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
from ctypes import c_double, c_int, c_uint, POINTER
from django.contrib.gis.geos.libgeos import GEOM_PTR, CS_PTR
from django.contrib.gis.geos.prototypes.errcheck import last_arg_byref, GEOSException
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
## Error-checking routines specific to coordinate seq... | [
[
1,
0,
0.012,
0.012,
0,
0.66,
0,
182,
0,
4,
0,
0,
182,
0,
0
],
[
1,
0,
0.0241,
0.012,
0,
0.66,
0.0455,
64,
0,
2,
0,
0,
64,
0,
0
],
[
1,
0,
0.0361,
0.012,
0,
0.66,
... | [
"from ctypes import c_double, c_int, c_uint, POINTER",
"from django.contrib.gis.geos.libgeos import GEOM_PTR, CS_PTR",
"from django.contrib.gis.geos.prototypes.errcheck import last_arg_byref, GEOSException",
"from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc",
"def check_cs_ptr(result, func... |
"""
This module is for the miscellaneous GEOS routines, particularly the
ones that return the area, distance, and length.
"""
from ctypes import c_int, c_double, POINTER
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_dbl
from django.contrib.gis.geos.... | [
[
8,
0,
0.0893,
0.1429,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1786,
0.0357,
0,
0.66,
0.125,
182,
0,
3,
0,
0,
182,
0,
0
],
[
1,
0,
0.2143,
0.0357,
0,
0.66,... | [
"\"\"\"\n This module is for the miscellaneous GEOS routines, particularly the\n ones that return the area, distance, and length.\n\"\"\"",
"from ctypes import c_int, c_double, POINTER",
"from django.contrib.gis.geos.libgeos import GEOM_PTR",
"from django.contrib.gis.geos.prototypes.errcheck import check_dbl"... |
"""
This module contains all of the GEOS ctypes function prototypes. Each
prototype handles the interaction between the GEOS library and Python
via ctypes.
"""
# Coordinate sequence routines.
from django.contrib.gis.geos.prototypes.coordseq import create_cs, get_cs, \
cs_clone, cs_getordinate, cs_setordinate, c... | [
[
8,
0,
0.1,
0.1667,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3,
0.1,
0,
0.66,
0.2,
928,
0,
13,
0,
0,
928,
0,
0
],
[
1,
0,
0.5167,
0.2,
0,
0.66,
0.4,
... | [
"\"\"\"\n This module contains all of the GEOS ctypes function prototypes. Each\n prototype handles the interaction between the GEOS library and Python\n via ctypes.\n\"\"\"",
"from django.contrib.gis.geos.prototypes.coordseq import create_cs, get_cs, \\\n cs_clone, cs_getordinate, cs_setordinate, cs_getx, cs_... |
"""
This module houses the GEOS ctypes prototype functions for the
unary and binary predicate operations on geometries.
"""
from ctypes import c_char, c_char_p, c_double
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
from django.contrib.gis... | [
[
8,
0,
0.0568,
0.0909,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1136,
0.0227,
0,
0.66,
0.0476,
182,
0,
3,
0,
0,
182,
0,
0
],
[
1,
0,
0.1364,
0.0227,
0,
0.66... | [
"\"\"\"\n This module houses the GEOS ctypes prototype functions for the\n unary and binary predicate operations on geometries.\n\"\"\"",
"from ctypes import c_char, c_char_p, c_double",
"from django.contrib.gis.geos.libgeos import GEOM_PTR",
"from django.contrib.gis.geos.prototypes.errcheck import check_pred... |
# 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://www.aryehleib.com/MutableLists.html
Author: Aryeh Leib Taurog.
"""
class ListMixin(obj... | [
[
8,
0,
0.021,
0.0259,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.5178,
0.9676,
0,
0.66,
1,
514,
0,
31,
0,
0,
186,
0,
99
],
[
8,
1,
0.1068,
0.1392,
1,
0.33,
... | [
"\"\"\"\nThis module contains a base type which provides list-style mutations\nwithout specific data storage methods.\n\nSee also http://www.aryehleib.com/MutableLists.html\n\nAuthor: Aryeh Leib Taurog.\n\"\"\"",
"class ListMixin(object):\n \"\"\"\n A base class which provides complete list interface.\n ... |
"""
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 os, re, sys
from ctypes import c_char_p, Structur... | [
[
8,
0,
0.0319,
0.0567,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0638,
0.0071,
0,
0.66,
0.0278,
688,
0,
3,
0,
0,
688,
0,
0
],
[
1,
0,
0.0709,
0.0071,
0,
0.66... | [
"\"\"\"\n This module houses the ctypes initialization procedures, as well\n as the notice and error handler function callbacks (get called\n when an error occurs in GEOS).\n\n This module also houses GEOS Pointer utilities, including\n get_pointer_arr(), and GEOM_PTR.\n\"\"\"",
"import os, re, sys",
"from ctyp... |
"""
GEOS Testing module.
"""
from unittest import TestSuite, TextTestRunner
import test_geos, test_io, test_geos_mutation, test_mutable_list
test_suites = [
test_geos.suite(),
test_io.suite(),
test_geos_mutation.suite(),
test_mutable_list.suite(),
]
def suite():
"Builds a test suite for the GE... | [
[
8,
0,
0.08,
0.12,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.16,
0.04,
0,
0.66,
0.1667,
88,
0,
2,
0,
0,
88,
0,
0
],
[
1,
0,
0.2,
0.04,
0,
0.66,
0.3333,
... | [
"\"\"\"\nGEOS Testing module.\n\"\"\"",
"from unittest import TestSuite, TextTestRunner",
"import test_geos, test_io, test_geos_mutation, test_mutable_list",
"test_suites = [\n test_geos.suite(),\n test_io.suite(),\n test_geos_mutation.suite(),\n test_mutable_list.suite(),\n ]",
"def suite():... |
from ctypes import c_uint, byref
from django.contrib.gis.geos.error import GEOSIndexError
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR
from django.contrib.gis.geos.linestring import LinearRing
from django.contrib.gis.geos import prototyp... | [
[
1,
0,
0.006,
0.006,
0,
0.66,
0,
182,
0,
2,
0,
0,
182,
0,
0
],
[
1,
0,
0.012,
0.006,
0,
0.66,
0.1667,
827,
0,
1,
0,
0,
827,
0,
0
],
[
1,
0,
0.0181,
0.006,
0,
0.66,... | [
"from ctypes import c_uint, byref",
"from django.contrib.gis.geos.error import GEOSIndexError",
"from django.contrib.gis.geos.geometry import GEOSGeometry",
"from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR",
"from django.contrib.gis.geos.linestring import LinearRing",
"from django.co... |
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.prototypes import prepared as capi
class PreparedGeometry(GEOSBase):
"""
A geometry that is prepared for performing certain operations.
At the moment this includes the co... | [
[
1,
0,
0.0333,
0.0333,
0,
0.66,
0,
386,
0,
1,
0,
0,
386,
0,
0
],
[
1,
0,
0.0667,
0.0333,
0,
0.66,
0.3333,
843,
0,
1,
0,
0,
843,
0,
0
],
[
1,
0,
0.1,
0.0333,
0,
0.6... | [
"from django.contrib.gis.geos.base import GEOSBase",
"from django.contrib.gis.geos.geometry import GEOSGeometry",
"from django.contrib.gis.geos.prototypes import prepared as capi",
"class PreparedGeometry(GEOSBase):\n \"\"\"\n A geometry that is prepared for performing certain operations.\n At the mo... |
"""
This module houses the GEOSCoordSeq object, which is used internally
by GEOSGeometry to house the actual coordinates of the Point,
LineString, and LinearRing geometries.
"""
from ctypes import c_double, c_uint, byref
from django.contrib.gis.geos.base import GEOSBase, numpy
from django.contrib.gis.geos.error impo... | [
[
8,
0,
0.0192,
0.0321,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0385,
0.0064,
0,
0.66,
0.1667,
182,
0,
3,
0,
0,
182,
0,
0
],
[
1,
0,
0.0449,
0.0064,
0,
0.66... | [
"\"\"\"\n This module houses the GEOSCoordSeq object, which is used internally\n by GEOSGeometry to house the actual coordinates of the Point,\n LineString, and LinearRing geometries.\n\"\"\"",
"from ctypes import c_double, c_uint, byref",
"from django.contrib.gis.geos.base import GEOSBase, numpy",
"from djan... |
from ctypes import c_void_p
from types import NoneType
from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
# Trying to import GDAL libraries, if available. Have to place in
# try/except since this package may be used outside GeoDjango.
try:
from django.contrib.gis import gdal
except ImportErro... | [
[
1,
0,
0.0192,
0.0192,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.0385,
0.0192,
0,
0.66,
0.2,
209,
0,
1,
0,
0,
209,
0,
0
],
[
1,
0,
0.0577,
0.0192,
0,
0.6... | [
"from ctypes import c_void_p",
"from types import NoneType",
"from django.contrib.gis.geos.error import GEOSException, GEOSIndexError",
"try:\n from django.contrib.gis import gdal\nexcept ImportError:\n # A 'dummy' gdal module.\n class GDALInfo(object):\n HAS_GDAL = False\n GEOJSON = Fa... |
"""
This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
inherit from this object.
"""
# Python, ctypes and types dependencies.
import re
from ctypes import addressof, byref, c_double, c_size_t
# super-class for mutable list behavior
from django.contrib.gis.geos.mutable_list import ListMixin
#... | [
[
8,
0,
0.0038,
0.0061,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0091,
0.0015,
0,
0.66,
0.0556,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0106,
0.0015,
0,
0.66... | [
"\"\"\"\n This module contains the 'base' GEOSGeometry object -- all GEOS Geometries\n inherit from this object.\n\"\"\"",
"import re",
"from ctypes import addressof, byref, c_double, c_size_t",
"from django.contrib.gis.geos.mutable_list import ListMixin",
"from django.contrib.gis.geos.base import GEOSBase,... |
from ctypes import c_uint
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos import prototypes as capi
class Point(GEOSGeometry):
_minlength = 2
_maxlength = 3
def __init__(self, x, y=None, z=None, srid=None):
... | [
[
1,
0,
0.0074,
0.0074,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.0148,
0.0074,
0,
0.66,
0.25,
827,
0,
1,
0,
0,
827,
0,
0
],
[
1,
0,
0.0222,
0.0074,
0,
0.... | [
"from ctypes import c_uint",
"from django.contrib.gis.geos.error import GEOSException",
"from django.contrib.gis.geos.geometry import GEOSGeometry",
"from django.contrib.gis.geos import prototypes as capi",
"class Point(GEOSGeometry):\n _minlength = 2\n _maxlength = 3\n\n def __init__(self, x, y=No... |
"""
The GeoDjango GEOS module. Please consult the GeoDjango documentation
for more details:
http://geodjango.org/docs/geos.html
"""
from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex
from django.contrib.gis.geos.point import Point
from django.contrib.gis.geos.linestring import LineStrin... | [
[
8,
0,
0.2143,
0.3571,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4286,
0.0714,
0,
0.66,
0.1111,
843,
0,
3,
0,
0,
843,
0,
0
],
[
1,
0,
0.5,
0.0714,
0,
0.66,
... | [
"\"\"\"\nThe GeoDjango GEOS module. Please consult the GeoDjango documentation\nfor more details: \n http://geodjango.org/docs/geos.html\n\"\"\"",
"from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex",
"from django.contrib.gis.geos.point import Point",
"from django.contrib.gis.ge... |
from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex
def fromfile(file_h):
"""
Given a string file name, returns a GEOSGeometry. The file may contain WKB,
WKT, or HEX.
"""
# If given a file name, get a real handle.
if isinstance(file_h, basestring):
file_h = ... | [
[
1,
0,
0.0435,
0.0435,
0,
0.66,
0,
843,
0,
3,
0,
0,
843,
0,
0
],
[
2,
0,
0.4783,
0.7391,
0,
0.66,
0.5,
768,
0,
1,
1,
0,
0,
0,
8
],
[
8,
1,
0.2391,
0.1739,
1,
0.29,... | [
"from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex",
"def fromfile(file_h):\n \"\"\"\n Given a string file name, returns a GEOSGeometry. The file may contain WKB,\n WKT, or HEX.\n \"\"\"\n # If given a file name, get a real handle.\n if isinstance(file_h, basestring... |
from optparse import make_option
from django.core.management.base import CommandError
from django.core.management.commands.inspectdb import Command as InspectDBCommand
class Command(InspectDBCommand):
db_module = 'django.contrib.gis.db'
gis_tables = {}
def get_field_type(self, connection, table_name, row... | [
[
1,
0,
0.0312,
0.0312,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0938,
0.0312,
0,
0.66,
0.3333,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.125,
0.0312,
0,
0... | [
"from optparse import make_option",
"from django.core.management.base import CommandError",
"from django.core.management.commands.inspectdb import Command as InspectDBCommand",
"class Command(InspectDBCommand):\n db_module = 'django.contrib.gis.db'\n gis_tables = {}\n\n def get_field_type(self, conne... |
from django.core.management.base import BaseCommand, CommandError
class ArgsCommand(BaseCommand):
"""
Command class for commands that take multiple arguments.
"""
args = '<arg arg ...>'
def handle(self, *args, **options):
if not args:
raise CommandError('Must provide the follow... | [
[
1,
0,
0.0667,
0.0667,
0,
0.66,
0,
931,
0,
2,
0,
0,
931,
0,
0
],
[
3,
0,
0.6,
0.8667,
0,
0.66,
1,
116,
0,
2,
0,
0,
564,
0,
3
],
[
8,
1,
0.3333,
0.2,
1,
0.42,
0... | [
"from django.core.management.base import BaseCommand, CommandError",
"class ArgsCommand(BaseCommand):\n \"\"\"\n Command class for commands that take multiple arguments.\n \"\"\"\n args = '<arg arg ...>'\n\n def handle(self, *args, **options):\n if not args:",
" \"\"\"\n Command clas... |
from django import forms
from django.utils.translation import ugettext_lazy as _
# While this couples the geographic forms to the GEOS library,
# it decouples from database (by not importing SpatialBackend).
from django.contrib.gis.geos import GEOSGeometry
class GeometryField(forms.Field):
"""
This is the bas... | [
[
1,
0,
0.0149,
0.0149,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0299,
0.0149,
0,
0.66,
0.3333,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0896,
0.0149,
0,
... | [
"from django import forms",
"from django.utils.translation import ugettext_lazy as _",
"from django.contrib.gis.geos import GEOSGeometry",
"class GeometryField(forms.Field):\n \"\"\"\n This is the basic form field for a Geometry. Any textual input that is\n accepted by GEOSGeometry is accepted by th... |
from django.forms import *
from django.contrib.gis.forms.fields import GeometryField
| [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
1,
0.5,
0,
0.66,
1,
391,
0,
1,
0,
0,
391,
0,
0
]
] | [
"from django.forms import *",
"from django.contrib.gis.forms.fields import GeometryField"
] |
from django.db import connection
if hasattr(connection.ops, 'spatial_version'):
from warnings import warn
warn('The `django.contrib.gis.db.backend` module was refactored and '
'renamed to `django.contrib.gis.db.backends` in 1.2. '
'All functionality of `SpatialBackend` '
'has been m... | [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
4,
0,
0.6364,
0.8182,
0,
0.66,
1,
0,
3,
0,
0,
0,
0,
0,
2
],
[
1,
1,
0.3636,
0.0909,
1,
0.13,
0... | [
"from django.db import connection",
"if hasattr(connection.ops, 'spatial_version'):\n from warnings import warn\n warn('The `django.contrib.gis.db.backend` module was refactored and '\n 'renamed to `django.contrib.gis.db.backends` in 1.2. '\n 'All functionality of `SpatialBackend` '\n ... |
from django.db import connections
from django.db.models.query import QuerySet, Q, ValuesQuerySet, ValuesListQuerySet
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField, LineStringField
from django.contrib.gis.db.models.sql import... | [
[
1,
0,
0.0013,
0.0013,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0026,
0.0013,
0,
0.66,
0.1111,
793,
0,
4,
0,
0,
793,
0,
0
],
[
1,
0,
0.0051,
0.0013,
0,
0.... | [
"from django.db import connections",
"from django.db.models.query import QuerySet, Q, ValuesQuerySet, ValuesListQuerySet",
"from django.contrib.gis.db.models import aggregates",
"from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField, LineStringField",
"from django.contrib.... |
from django.db.models.fields import Field
from django.db.models.sql.expressions import SQLEvaluator
from django.utils.translation import ugettext_lazy as _
from django.contrib.gis import forms
from django.contrib.gis.db.models.proxy import GeometryProxy
from django.contrib.gis.geometry.backend import Geometry, Geometry... | [
[
1,
0,
0.0034,
0.0034,
0,
0.66,
0,
5,
0,
1,
0,
0,
5,
0,
0
],
[
1,
0,
0.0068,
0.0034,
0,
0.66,
0.0667,
438,
0,
1,
0,
0,
438,
0,
0
],
[
1,
0,
0.0102,
0.0034,
0,
0.66... | [
"from django.db.models.fields import Field",
"from django.db.models.sql.expressions import SQLEvaluator",
"from django.utils.translation import ugettext_lazy as _",
"from django.contrib.gis import forms",
"from django.contrib.gis.db.models.proxy import GeometryProxy",
"from django.contrib.gis.geometry.bac... |
"""
The GeometryProxy object, allows for lazy-geometries. The proxy uses
Python descriptors for instantiating and setting Geometry objects
corresponding to geographic model fields.
Thanks to Robert Coup for providing this functionality (see #4322).
"""
class GeometryProxy(object):
def __init__(self, klass, field... | [
[
8,
0,
0.0625,
0.1094,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.5703,
0.875,
0,
0.66,
1,
637,
0,
3,
0,
0,
186,
0,
9
],
[
2,
1,
0.2031,
0.1094,
1,
0.26,
... | [
"\"\"\"\nThe GeometryProxy object, allows for lazy-geometries. The proxy uses\nPython descriptors for instantiating and setting Geometry objects\ncorresponding to geographic model fields.\n\nThanks to Robert Coup for providing this functionality (see #4322).\n\"\"\"",
"class GeometryProxy(object):\n def __ini... |
from django.db import connections
from django.db.models.query import sql
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql import aggregates as gis_aggregates
from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField
from django.contri... | [
[
1,
0,
0.0084,
0.0084,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0168,
0.0084,
0,
0.66,
0.1,
793,
0,
1,
0,
0,
793,
0,
0
],
[
1,
0,
0.0336,
0.0084,
0,
0.66,... | [
"from django.db import connections",
"from django.db.models.query import sql",
"from django.contrib.gis.db.models.fields import GeometryField",
"from django.contrib.gis.db.models.sql import aggregates as gis_aggregates",
"from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, Geom... |
from itertools import izip
from django.db.backends.util import truncate_name
from django.db.models.sql import compiler
from django.db.models.sql.constants import TABLE_NAME
from django.db.models.sql.query import get_proxied_model
SQLCompiler = compiler.SQLCompiler
class GeoSQLCompiler(compiler.SQLCompiler):
def ... | [
[
1,
0,
0.0036,
0.0036,
0,
0.66,
0,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0072,
0.0036,
0,
0.66,
0.0909,
446,
0,
1,
0,
0,
446,
0,
0
],
[
1,
0,
0.0108,
0.0036,
0,
... | [
"from itertools import izip",
"from django.db.backends.util import truncate_name",
"from django.db.models.sql import compiler",
"from django.db.models.sql.constants import TABLE_NAME",
"from django.db.models.sql.query import get_proxied_model",
"SQLCompiler = compiler.SQLCompiler",
"class GeoSQLCompiler... |
"""
This module holds simple classes used by GeoQuery.convert_values
to convert geospatial values from the database.
"""
class BaseField(object):
empty_strings_allowed = True
def get_internal_type(self):
"Overloaded method so OracleQuery.convert_values doesn't balk."
return None
class AreaFiel... | [
[
8,
0,
0.0926,
0.1481,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.2963,
0.1852,
0,
0.66,
0.25,
638,
0,
1,
0,
0,
186,
0,
0
],
[
14,
1,
0.2593,
0.037,
1,
0.44,
... | [
"\"\"\"\nThis module holds simple classes used by GeoQuery.convert_values\nto convert geospatial values from the database.\n\"\"\"",
"class BaseField(object):\n empty_strings_allowed = True\n def get_internal_type(self):\n \"Overloaded method so OracleQuery.convert_values doesn't balk.\"\n ret... |
from django.db.models.sql.aggregates import *
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql.conversion import GeomField
class GeoAggregate(Aggregate):
# Default SQL template for spatial aggregates.
sql_template = '%(function)s(%(field)s)'
# Conversion ... | [
[
1,
0,
0.0164,
0.0164,
0,
0.66,
0,
101,
0,
1,
0,
0,
101,
0,
0
],
[
1,
0,
0.0328,
0.0164,
0,
0.66,
0.125,
708,
0,
1,
0,
0,
708,
0,
0
],
[
1,
0,
0.0492,
0.0164,
0,
0... | [
"from django.db.models.sql.aggregates import *",
"from django.contrib.gis.db.models.fields import GeometryField",
"from django.contrib.gis.db.models.sql.conversion import GeomField",
"class GeoAggregate(Aggregate):\n # Default SQL template for spatial aggregates.\n sql_template = '%(function)s(%(field)s... |
from django.db.models.fields import Field, FieldDoesNotExist
from django.db.models.sql.constants import LOOKUP_SEP
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.sql.where import Constraint, WhereNode
from django.contrib.gis.db.models.fields import GeometryField
class GeoConstraint(Con... | [
[
1,
0,
0.0112,
0.0112,
0,
0.66,
0,
5,
0,
2,
0,
0,
5,
0,
0
],
[
1,
0,
0.0225,
0.0112,
0,
0.66,
0.1667,
971,
0,
1,
0,
0,
971,
0,
0
],
[
1,
0,
0.0337,
0.0112,
0,
0.66... | [
"from django.db.models.fields import Field, FieldDoesNotExist",
"from django.db.models.sql.constants import LOOKUP_SEP",
"from django.db.models.sql.expressions import SQLEvaluator",
"from django.db.models.sql.where import Constraint, WhereNode",
"from django.contrib.gis.db.models.fields import GeometryField... |
from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField
from django.contrib.gis.db.models.sql.query import GeoQuery
from django.contrib.gis.db.models.sql.where import GeoWhereNode
| [
[
1,
0,
0.3333,
0.3333,
0,
0.66,
0,
100,
0,
3,
0,
0,
100,
0,
0
],
[
1,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
223,
0,
1,
0,
0,
223,
0,
0
],
[
1,
0,
1,
0.3333,
0,
0.66,
... | [
"from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField",
"from django.contrib.gis.db.models.sql.query import GeoQuery",
"from django.contrib.gis.db.models.sql.where import GeoWhereNode"
] |
from django.db.models import Aggregate
from django.contrib.gis.db.models.sql import GeomField
class Collect(Aggregate):
name = 'Collect'
class Extent(Aggregate):
name = 'Extent'
class Extent3D(Aggregate):
name = 'Extent3D'
class MakeLine(Aggregate):
name = 'MakeLine'
class Union(Aggregate):
nam... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
680,
0,
1,
0,
0,
680,
0,
0
],
[
1,
0,
0.1176,
0.0588,
0,
0.66,
0.1667,
437,
0,
1,
0,
0,
437,
0,
0
],
[
3,
0,
0.2647,
0.1176,
0,
... | [
"from django.db.models import Aggregate",
"from django.contrib.gis.db.models.sql import GeomField",
"class Collect(Aggregate):\n name = 'Collect'",
" name = 'Collect'",
"class Extent(Aggregate):\n name = 'Extent'",
" name = 'Extent'",
"class Extent3D(Aggregate):\n name = 'Extent3D'",
" ... |
# Want to get everything from the 'normal' models package.
from django.db.models import *
# Geographic aggregate functions
from django.contrib.gis.db.models.aggregates import *
# The GeoManager
from django.contrib.gis.db.models.manager import GeoManager
# The geographic-enabled fields.
from django.contrib.gis.db.mod... | [
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0,
680,
0,
1,
0,
0,
680,
0,
0
],
[
1,
0,
0.3571,
0.0714,
0,
0.66,
0.3333,
920,
0,
1,
0,
0,
920,
0,
0
],
[
1,
0,
0.5714,
0.0714,
0,
... | [
"from django.db.models import *",
"from django.contrib.gis.db.models.aggregates import *",
"from django.contrib.gis.db.models.manager import GeoManager",
"from django.contrib.gis.db.models.fields import \\\n GeometryField, PointField, LineStringField, PolygonField, \\\n MultiPointField, MultiLineStrin... |
from django.db.models.manager import Manager
from django.contrib.gis.db.models.query import GeoQuerySet
class GeoManager(Manager):
"Overrides Manager to return Geographic QuerySets."
# This manager should be used for queries on related fields
# so that geometry columns on Oracle and MySQL are selected
... | [
[
1,
0,
0.0097,
0.0097,
0,
0.66,
0,
59,
0,
1,
0,
0,
59,
0,
0
],
[
1,
0,
0.0194,
0.0097,
0,
0.66,
0.5,
817,
0,
1,
0,
0,
817,
0,
0
],
[
3,
0,
0.5194,
0.9709,
0,
0.66,... | [
"from django.db.models.manager import Manager",
"from django.contrib.gis.db.models.query import GeoQuerySet",
"class GeoManager(Manager):\n \"Overrides Manager to return Geographic QuerySets.\"\n\n # This manager should be used for queries on related fields\n # so that geometry columns on Oracle and My... |
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.
d... | [
[
1,
0,
0.0312,
0.0312,
0,
0.66,
0,
412,
0,
1,
0,
0,
412,
0,
0
],
[
1,
0,
0.0938,
0.0312,
0,
0.66,
0.3333,
793,
0,
1,
0,
0,
793,
0,
0
],
[
1,
0,
0.125,
0.0312,
0,
0... | [
"from MySQLdb.constants import FIELD_TYPE",
"from django.contrib.gis.gdal import OGRGeomType",
"from django.db.backends.mysql.introspection import DatabaseIntrospection",
"class MySQLIntrospection(DatabaseIntrospection):\n # Updating the data_types_reverse dictionary with the appropriate\n # type for Ge... |
from django.db.backends.mysql.base import DatabaseOperations
from django.contrib.gis.db.backends.adapter import WKTAdapter
from django.contrib.gis.db.backends.base import BaseSpatialOperations
class MySQLOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = 'django.contrib.gis.db.models.sql.co... | [
[
1,
0,
0.0154,
0.0154,
0,
0.66,
0,
150,
0,
1,
0,
0,
150,
0,
0
],
[
1,
0,
0.0462,
0.0154,
0,
0.66,
0.3333,
423,
0,
1,
0,
0,
423,
0,
0
],
[
1,
0,
0.0615,
0.0154,
0,
... | [
"from django.db.backends.mysql.base import DatabaseOperations",
"from django.contrib.gis.db.backends.adapter import WKTAdapter",
"from django.contrib.gis.db.backends.base import BaseSpatialOperations",
"class MySQLOperations(DatabaseOperations, BaseSpatialOperations):\n\n compiler_module = 'django.contrib.... |
from django.db.backends.mysql.creation import DatabaseCreation
class MySQLCreation(DatabaseCreation):
def sql_indexes_for_field(self, model, f, style):
from django.contrib.gis.db.models.fields import GeometryField
output = super(MySQLCreation, self).sql_indexes_for_field(model, f, style)
... | [
[
1,
0,
0.0556,
0.0556,
0,
0.66,
0,
326,
0,
1,
0,
0,
326,
0,
0
],
[
3,
0,
0.5833,
0.8889,
0,
0.66,
1,
391,
0,
1,
0,
0,
625,
0,
12
],
[
2,
1,
0.6389,
0.7778,
1,
0.43... | [
"from django.db.backends.mysql.creation import DatabaseCreation",
"class MySQLCreation(DatabaseCreation):\n\n def sql_indexes_for_field(self, model, f, style):\n from django.contrib.gis.db.models.fields import GeometryField\n output = super(MySQLCreation, self).sql_indexes_for_field(model, f, sty... |
from django.db.backends.mysql.base import *
from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper
from django.contrib.gis.db.backends.mysql.creation import MySQLCreation
from django.contrib.gis.db.backends.mysql.introspection import MySQLIntrospection
from django.contrib.gis.db.backends.mysq... | [
[
1,
0,
0.0769,
0.0769,
0,
0.66,
0,
150,
0,
1,
0,
0,
150,
0,
0
],
[
1,
0,
0.1538,
0.0769,
0,
0.66,
0.2,
150,
0,
1,
0,
0,
150,
0,
0
],
[
1,
0,
0.2308,
0.0769,
0,
0.6... | [
"from django.db.backends.mysql.base import *",
"from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper",
"from django.contrib.gis.db.backends.mysql.creation import MySQLCreation",
"from django.contrib.gis.db.backends.mysql.introspection import MySQLIntrospection",
"from django.con... |
class WKTAdapter(object):
"""
This provides an adaptor for Geometries sent to the
MySQL and Oracle database backends.
"""
def __init__(self, geom):
self.wkt = geom.wkt
self.srid = geom.srid
def __eq__(self, other):
return self.wkt == other.wkt and self.srid == other.srid... | [
[
3,
0,
0.5294,
1,
0,
0.66,
0,
868,
0,
4,
0,
0,
186,
0,
0
],
[
8,
1,
0.2059,
0.2353,
1,
0.73,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
1,
0.4118,
0.1765,
1,
0.73,
0.25... | [
"class WKTAdapter(object):\n \"\"\"\n This provides an adaptor for Geometries sent to the\n MySQL and Oracle database backends.\n \"\"\"\n def __init__(self, geom):\n self.wkt = geom.wkt\n self.srid = geom.srid",
" \"\"\"\n This provides an adaptor for Geometries sent to the\n ... |
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 types.
... | [
[
1,
0,
0.0196,
0.0196,
0,
0.66,
0,
793,
0,
1,
0,
0,
793,
0,
0
],
[
1,
0,
0.0392,
0.0196,
0,
0.66,
0.3333,
774,
0,
2,
0,
0,
774,
0,
0
],
[
3,
0,
0.2157,
0.2941,
0,
... | [
"from django.contrib.gis.gdal import OGRGeomType",
"from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict",
"class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict):\n \"\"\"\n Sublcass that includes updates the `base_data_types_reverse` dict\n for geomet... |
from django.db.backends.sqlite3.base import Database
from django.contrib.gis.db.backends.adapter import WKTAdapter
class SpatiaLiteAdapter(WKTAdapter):
"SQLite adaptor for geometry objects."
def __conform__(self, protocol):
if protocol is Database.PrepareProtocol:
return str(self)
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
460,
0,
1,
0,
0,
460,
0,
0
],
[
1,
0,
0.25,
0.125,
0,
0.66,
0.5,
423,
0,
1,
0,
0,
423,
0,
0
],
[
3,
0,
0.75,
0.625,
0,
0.66,
1... | [
"from django.db.backends.sqlite3.base import Database",
"from django.contrib.gis.db.backends.adapter import WKTAdapter",
"class SpatiaLiteAdapter(WKTAdapter):\n \"SQLite adaptor for geometry objects.\"\n def __conform__(self, protocol):\n if protocol is Database.PrepareProtocol:\n return... |
from django.db.backends.sqlite3.client import DatabaseClient
class SpatiaLiteClient(DatabaseClient):
executable_name = 'spatialite'
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
3,
0,
0.7,
0.4,
0,
0.66,
1,
345,
0,
0,
0,
0,
207,
0,
0
],
[
14,
1,
0.8,
0.2,
1,
0.86,
0,
723,
... | [
"from django.db.backends.sqlite3.client import DatabaseClient",
"class SpatiaLiteClient(DatabaseClient):\n executable_name = 'spatialite'",
" executable_name = 'spatialite'"
] |
"""
The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from SpatiaLite.
"""
f_table_name = models.CharField(ma... | [
[
8,
0,
0.0333,
0.05,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0667,
0.0167,
0,
0.66,
0.25,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0833,
0.0167,
0,
0.66,
... | [
"\"\"\"\n The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.\n\"\"\"",
"from django.db import models",
"from django.contrib.gis.db.backends.base import SpatialRefSysMixin",
"class GeometryColumns(models.Model):\n \"\"\"\n The 'geometry_columns' table from SpatiaLite.\n \"\"\"\n ... |
import re
from decimal import Decimal
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter
from django.contrib.gis.geometry.backend import G... | [
[
1,
0,
0.0029,
0.0029,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0058,
0.0029,
0,
0.66,
0.0588,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.0117,
0.0029,
0,
... | [
"import re",
"from decimal import Decimal",
"from django.contrib.gis.db.backends.base import BaseSpatialOperations",
"from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction",
"from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter",
"from django.contrib.... |
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django.db.backends.sqlite3.creation import DatabaseCreation
class SpatiaLiteCreation(DatabaseCreation):
def create_test_db(self, verbosity=1, autoclobber=False):
... | [
[
1,
0,
0.0104,
0.0104,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0208,
0.0104,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0312,
0.0104,
0,
0.6... | [
"import os",
"from django.conf import settings",
"from django.core.exceptions import ImproperlyConfigured",
"from django.core.management import call_command",
"from django.db.backends.sqlite3.creation import DatabaseCreation",
"class SpatiaLiteCreation(DatabaseCreation):\n\n def create_test_db(self, ve... |
from django.db.backends.postgresql_psycopg2.introspection import DatabaseIntrospection
from django.contrib.gis.gdal import OGRGeomType
class GeoIntrospectionError(Exception):
pass
class PostGISIntrospection(DatabaseIntrospection):
# Reverse dictionary for PostGIS geometry types not populated until
# intro... | [
[
1,
0,
0.0105,
0.0105,
0,
0.66,
0,
862,
0,
1,
0,
0,
862,
0,
0
],
[
1,
0,
0.0211,
0.0105,
0,
0.66,
0.3333,
793,
0,
1,
0,
0,
793,
0,
0
],
[
3,
0,
0.0474,
0.0211,
0,
... | [
"from django.db.backends.postgresql_psycopg2.introspection import DatabaseIntrospection",
"from django.contrib.gis.gdal import OGRGeomType",
"class GeoIntrospectionError(Exception):\n pass",
"class PostGISIntrospection(DatabaseIntrospection):\n # Reverse dictionary for PostGIS geometry types not populat... |
"""
This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
"""
from psycopg2 import Binary
from psycopg2.extensions import ISQLQuote
class PostGISAdapter(object):
def __init__(self, geom):
"Initializes on the geometry."
# Getting the WKB (in string form, to allow easy pickling ... | [
[
8,
0,
0.0571,
0.0857,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1429,
0.0286,
0,
0.66,
0.3333,
202,
0,
1,
0,
0,
202,
0,
0
],
[
1,
0,
0.1714,
0.0286,
0,
0.66... | [
"\"\"\"\n This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.\n\"\"\"",
"from psycopg2 import Binary",
"from psycopg2.extensions import ISQLQuote",
"class PostGISAdapter(object):\n def __init__(self, geom):\n \"Initializes on the geometry.\"\n # Getting the WKB (in strin... |
"""
The GeometryColumns and SpatialRefSys models for the PostGIS backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from the PostGIS. See the PostGIS
documentation at Ch. 4.2.2.
... | [
[
8,
0,
0.0303,
0.0455,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0606,
0.0152,
0,
0.66,
0.25,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0758,
0.0152,
0,
0.66,
... | [
"\"\"\"\n The GeometryColumns and SpatialRefSys models for the PostGIS backend.\n\"\"\"",
"from django.db import models",
"from django.contrib.gis.db.backends.base import SpatialRefSysMixin",
"class GeometryColumns(models.Model):\n \"\"\"\n The 'geometry_columns' table from the PostGIS. See the PostGIS\... |
import re
from decimal import Decimal
from django.conf import settings
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter
from django.contrib.gi... | [
[
1,
0,
0.0017,
0.0017,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0034,
0.0017,
0,
0.66,
0.0556,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.0068,
0.0017,
0,
... | [
"import re",
"from decimal import Decimal",
"from django.conf import settings",
"from django.contrib.gis.db.backends.base import BaseSpatialOperations",
"from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction",
"from django.contrib.gis.db.backends.postgis.adapter import PostGISA... |
from django.conf import settings
from django.db.backends.postgresql.creation import DatabaseCreation
class PostGISCreation(DatabaseCreation):
geom_index_type = 'GIST'
geom_index_opts = 'GIST_GEOMETRY_OPS'
def sql_indexes_for_field(self, model, f, style):
"Return any spatial index creation SQL for ... | [
[
1,
0,
0.0167,
0.0167,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0333,
0.0167,
0,
0.66,
0.5,
575,
0,
1,
0,
0,
575,
0,
0
],
[
3,
0,
0.5333,
0.95,
0,
0.66,... | [
"from django.conf import settings",
"from django.db.backends.postgresql.creation import DatabaseCreation",
"class PostGISCreation(DatabaseCreation):\n geom_index_type = 'GIST'\n geom_index_opts = 'GIST_GEOMETRY_OPS'\n\n def sql_indexes_for_field(self, model, f, style):\n \"Return any spatial ind... |
from django.db.backends.postgresql_psycopg2.base import *
from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper as Psycopg2DatabaseWrapper
from django.contrib.gis.db.backends.postgis.creation import PostGISCreation
from django.contrib.gis.db.backends.postgis.introspection import PostGISIntrospection
f... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
485,
0,
1,
0,
0,
485,
0,
0
],
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0.2,
485,
0,
1,
0,
0,
485,
0,
0
],
[
1,
0,
0.25,
0.0833,
0,
0.66,... | [
"from django.db.backends.postgresql_psycopg2.base import *",
"from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper as Psycopg2DatabaseWrapper",
"from django.contrib.gis.db.backends.postgis.creation import PostGISCreation",
"from django.contrib.gis.db.backends.postgis.introspection import Po... |
"""
A collection of utility routines and classes used by the spatial
backends.
"""
def gqn(val):
"""
The geographic quote name function; used for quoting tables and
geometries (they use single rather than the double quotes of the
backend quotename function).
"""
if isinstance(val, basestring):
... | [
[
8,
0,
0.0446,
0.0714,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.1964,
0.1964,
0,
0.66,
0.3333,
613,
0,
1,
1,
0,
0,
0,
4
],
[
8,
1,
0.1607,
0.0893,
1,
0.14,
... | [
"\"\"\"\nA collection of utility routines and classes used by the spatial\nbackends.\n\"\"\"",
"def gqn(val):\n \"\"\"\n The geographic quote name function; used for quoting tables and\n geometries (they use single rather than the double quotes of the\n backend quotename function).\n \"\"\"\n if... |
from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler
from django.db.backends.oracle import compiler
SQLCompiler = compiler.SQLCompiler
class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):
pass
class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler):
def pla... | [
[
1,
0,
0.0227,
0.0227,
0,
0.66,
0,
973,
0,
1,
0,
0,
973,
0,
0
],
[
1,
0,
0.0455,
0.0227,
0,
0.66,
0.125,
772,
0,
1,
0,
0,
772,
0,
0
],
[
14,
0,
0.0909,
0.0227,
0,
... | [
"from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler",
"from django.db.backends.oracle import compiler",
"SQLCompiler = compiler.SQLCompiler",
"class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):\n pass",
"class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQ... |
from cx_Oracle import CLOB
from django.contrib.gis.db.backends.adapter import WKTAdapter
class OracleSpatialAdapter(WKTAdapter):
input_size = CLOB
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
554,
0,
1,
0,
0,
554,
0,
0
],
[
1,
0,
0.4,
0.2,
0,
0.66,
0.5,
423,
0,
1,
0,
0,
423,
0,
0
],
[
3,
0,
0.9,
0.4,
0,
0.66,
1,
930,... | [
"from cx_Oracle import CLOB",
"from django.contrib.gis.db.backends.adapter import WKTAdapter",
"class OracleSpatialAdapter(WKTAdapter):\n input_size = CLOB",
" input_size = CLOB"
] |
"""
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_... | [
[
8,
0,
0.0769,
0.1385,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1538,
0.0154,
0,
0.66,
0.2,
964,
0,
1,
0,
0,
964,
0,
0
],
[
1,
0,
0.1692,
0.0154,
0,
0.66,
... | [
"\"\"\"\n The GeometryColumns and SpatialRefSys models for the Oracle spatial\n backend.\n\n It should be noted that Oracle Spatial does not have database tables\n named according to the OGC standard, so the closest analogs are used.\n For example, the `USER_SDO_GEOM_METADATA` is used for the GeometryColumns\n mode... |
"""
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... | [
[
8,
0,
0.0171,
0.0307,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0341,
0.0034,
0,
0.66,
0.0667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0375,
0.0034,
0,
0.66... | [
"\"\"\"\n This module contains the spatial lookup types, and the `get_geo_where_clause`\n routine for Oracle Spatial.\n\n Please note that WKT support is broken on the XE version, and thus\n this backend will not work on such platforms. Specifically, XE lacks\n support for an internal JVM, and Java libraries are r... |
from django.db.backends.oracle.creation import DatabaseCreation
from django.db.backends.util import truncate_name
class OracleCreation(DatabaseCreation):
def sql_indexes_for_field(self, model, f, style):
"Return any spatial index creation SQL for the field."
from django.contrib.gis.db.models.field... | [
[
1,
0,
0.0238,
0.0238,
0,
0.66,
0,
513,
0,
1,
0,
0,
513,
0,
0
],
[
1,
0,
0.0476,
0.0238,
0,
0.66,
0.5,
446,
0,
1,
0,
0,
446,
0,
0
],
[
3,
0,
0.5476,
0.9286,
0,
0.6... | [
"from django.db.backends.oracle.creation import DatabaseCreation",
"from django.db.backends.util import truncate_name",
"class OracleCreation(DatabaseCreation):\n\n def sql_indexes_for_field(self, model, f, style):\n \"Return any spatial index creation SQL for the field.\"\n from django.contrib... |
from django.db.backends.oracle.base import *
from django.db.backends.oracle.base import DatabaseWrapper as OracleDatabaseWrapper
from django.contrib.gis.db.backends.oracle.creation import OracleCreation
from django.contrib.gis.db.backends.oracle.introspection import OracleIntrospection
from django.contrib.gis.db.backen... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
759,
0,
1,
0,
0,
759,
0,
0
],
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0.2,
759,
0,
1,
0,
0,
759,
0,
0
],
[
1,
0,
0.25,
0.0833,
0,
0.66,... | [
"from django.db.backends.oracle.base import *",
"from django.db.backends.oracle.base import DatabaseWrapper as OracleDatabaseWrapper",
"from django.contrib.gis.db.backends.oracle.creation import OracleCreation",
"from django.contrib.gis.db.backends.oracle.introspection import OracleIntrospection",
"from dja... |
"""
Set of "markup" template filters for Django. These filters transform plain text
markup syntaxes to HTML; currently there is support for:
* Textile, which requires the PyTextile library available at
http://loopcore.com/python-textile/
* Markdown, which requires the Python-markdown library from
... | [
[
8,
0,
0.0714,
0.1319,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1538,
0.011,
0,
0.66,
0.0714,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.1648,
0.011,
0,
0.66,
... | [
"\"\"\"\nSet of \"markup\" template filters for Django. These filters transform plain text\nmarkup syntaxes to HTML; currently there is support for:\n\n * Textile, which requires the PyTextile library available at\n http://loopcore.com/python-textile/\n\n * Markdown, which requires the Python-markdown l... |
import base64
import cPickle as pickle
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.utils.hashcompat import md5_constructor
class SessionManager(models.Manager):
def encode(self, session_dict):
"""
Returns the gi... | [
[
1,
0,
0.0149,
0.0149,
0,
0.66,
0,
177,
0,
1,
0,
0,
177,
0,
0
],
[
1,
0,
0.0299,
0.0149,
0,
0.66,
0.1429,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.0597,
0.0149,
0,
... | [
"import base64",
"import cPickle as pickle",
"from django.db import models",
"from django.utils.translation import ugettext_lazy as _",
"from django.conf import settings",
"from django.utils.hashcompat import md5_constructor",
"class SessionManager(models.Manager):\n def encode(self, session_dict):\n... |
r"""
>>> from django.conf import settings
>>> from django.contrib.sessions.backends.db import SessionStore as DatabaseSession
>>> from django.contrib.sessions.backends.cache import SessionStore as CacheSession
>>> from django.contrib.sessions.backends.cached_db import SessionStore as CacheDBSession
>>> from django.con... | [
[
8,
0,
0.4962,
0.99,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
4,
0,
0.9975,
0.0075,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
1
],
[
1,
1,
0.9975,
0.0025,
1,
0.75,
0,
... | [
"r\"\"\"\n\n>>> from django.conf import settings\n>>> from django.contrib.sessions.backends.db import SessionStore as DatabaseSession\n>>> from django.contrib.sessions.backends.cache import SessionStore as CacheSession\n>>> from django.contrib.sessions.backends.cached_db import SessionStore as CacheDBSession\n>>> f... |
import time
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
from django.utils.importlib import import_module
class SessionMiddleware(object):
def process_request(self, request):
engine = import_module(settings.SESSION_ENGINE)
... | [
[
1,
0,
0.0238,
0.0238,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0714,
0.0238,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0952,
0.0238,
0,
0.6... | [
"import time",
"from django.conf import settings",
"from django.utils.cache import patch_vary_headers",
"from django.utils.http import cookie_date",
"from django.utils.importlib import import_module",
"class SessionMiddleware(object):\n def process_request(self, request):\n engine = import_modul... |
import datetime
from django.conf import settings
from django.contrib.sessions.models import Session
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.exceptions import SuspiciousOperation
from django.db import IntegrityError, transaction, router
from django.utils.encoding impor... | [
[
1,
0,
0.0128,
0.0128,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0256,
0.0128,
0,
0.66,
0.1429,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0385,
0.0128,
0,
... | [
"import datetime",
"from django.conf import settings",
"from django.contrib.sessions.models import Session",
"from django.contrib.sessions.backends.base import SessionBase, CreateError",
"from django.core.exceptions import SuspiciousOperation",
"from django.db import IntegrityError, transaction, router",
... |
import base64
import os
import random
import sys
import time
from datetime import datetime, timedelta
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.utils.hashcompat import md5_constructor
# Us... | [
[
1,
0,
0.0035,
0.0035,
0,
0.66,
0,
177,
0,
1,
0,
0,
177,
0,
0
],
[
1,
0,
0.007,
0.0035,
0,
0.66,
0.0833,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0105,
0.0035,
0,
0... | [
"import base64",
"import os",
"import random",
"import sys",
"import time",
"from datetime import datetime, timedelta",
"try:\n import cPickle as pickle\nexcept ImportError:\n import pickle",
" import cPickle as pickle",
" import pickle",
"from django.conf import settings",
"from dja... |
"""
Cached, database-backed sessions.
"""
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DBStore
from django.core.cache import cache
class SessionStore(DBStore):
"""
Implements cached, database backed sessions.
"""
def __init__(self, session_key=None)... | [
[
8,
0,
0.0476,
0.0714,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.119,
0.0238,
0,
0.66,
0.25,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1429,
0.0238,
0,
0.66,
... | [
"\"\"\"\nCached, database-backed sessions.\n\"\"\"",
"from django.conf import settings",
"from django.contrib.sessions.backends.db import SessionStore as DBStore",
"from django.core.cache import cache",
"class SessionStore(DBStore):\n \"\"\"\n Implements cached, database backed sessions.\n \"\"\"\n... |
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import cache
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
def __init__(self, session_key=None):
self._cache = cache
super(SessionStore, self).__init__(session_key)
... | [
[
1,
0,
0.0179,
0.0179,
0,
0.66,
0,
907,
0,
2,
0,
0,
907,
0,
0
],
[
1,
0,
0.0357,
0.0179,
0,
0.66,
0.5,
734,
0,
1,
0,
0,
734,
0,
0
],
[
3,
0,
0.5268,
0.9286,
0,
0.6... | [
"from django.contrib.sessions.backends.base import SessionBase, CreateError",
"from django.core.cache import cache",
"class SessionStore(SessionBase):\n \"\"\"\n A cache-based session store.\n \"\"\"\n def __init__(self, session_key=None):\n self._cache = cache\n super(SessionStore, se... |
from django.utils.translation import ungettext, ugettext as _
from django.utils.encoding import force_unicode
from django import template
from django.template import defaultfilters
from datetime import date
import re
register = template.Library()
def ordinal(value):
"""
Converts an integer to its ordinal as a... | [
[
1,
0,
0.0098,
0.0098,
0,
0.66,
0,
389,
0,
2,
0,
0,
389,
0,
0
],
[
1,
0,
0.0196,
0.0098,
0,
0.66,
0.05,
96,
0,
1,
0,
0,
96,
0,
0
],
[
1,
0,
0.0294,
0.0098,
0,
0.66... | [
"from django.utils.translation import ungettext, ugettext as _",
"from django.utils.encoding import force_unicode",
"from django import template",
"from django.template import defaultfilters",
"from datetime import date",
"import re",
"register = template.Library()",
"def ordinal(value):\n \"\"\"\n... |
from django.conf.urls.defaults import *
from django.contrib.databrowse import views
# Note: The views in this URLconf all require a 'models' argument,
# which is a list of model classes (*not* instances).
urlpatterns = patterns('',
#(r'^$', views.homepage),
#(r'^([^/]+)/([^/]+)/$', views.model_detail),
(... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.1,
0.05,
0,
0.66,
0.5,
706,
0,
1,
0,
0,
706,
0,
0
],
[
14,
0,
0.675,
0.7,
0,
0.66,
1,
... | [
"from django.conf.urls.defaults import *",
"from django.contrib.databrowse import views",
"urlpatterns = patterns('',\n #(r'^$', views.homepage),\n #(r'^([^/]+)/([^/]+)/$', views.model_detail),\n\n (r'^([^/]+)/([^/]+)/fields/(\\w+)/$', views.choice_list),\n (r'^([^/]+)/([^/]+)/fields/(\\w+)/(.*)/$',... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import force_unicode
from dja... | [
[
1,
0,
0.0116,
0.0116,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0233,
0.0116,
0,
0.66,
0.1,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0349,
0.0116,
0,
0.66,... | [
"from django import http",
"from django.db import models",
"from django.contrib.databrowse.datastructures import EasyModel",
"from django.contrib.databrowse.sites import DatabrowsePlugin",
"from django.shortcuts import render_to_response",
"from django.utils.text import capfirst",
"from django.utils.enc... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import smart_str, force_unico... | [
[
1,
0,
0.0135,
0.0135,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.027,
0.0135,
0,
0.66,
0.1111,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0405,
0.0135,
0,
0.6... | [
"from django import http",
"from django.db import models",
"from django.contrib.databrowse.datastructures import EasyModel",
"from django.contrib.databrowse.sites import DatabrowsePlugin",
"from django.shortcuts import render_to_response",
"from django.utils.text import capfirst",
"from django.utils.enc... |
from django import http
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
import urlparse
class ObjectDetailPlugin(DatabrowsePlugin):
def model_view(self, request, model_databrowse, url):
... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0.2,
235,
0,
1,
0,
0,
235,
0,
0
],
[
1,
0,
0.2143,
0.0714,
0,
0.6... | [
"from django import http",
"from django.contrib.databrowse.datastructures import EasyModel",
"from django.contrib.databrowse.sites import DatabrowsePlugin",
"from django.shortcuts import render_to_response",
"import urlparse",
"class ObjectDetailPlugin(DatabrowsePlugin):\n def model_view(self, request,... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.shortcuts import render_to_response
from django.utils.safestring import mark_safe
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
class DatabrowsePlugi... | [
[
1,
0,
0.0067,
0.0067,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0134,
0.0067,
0,
0.66,
0.0714,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0201,
0.0067,
0,
0.... | [
"from django import http",
"from django.db import models",
"from django.contrib.databrowse.datastructures import EasyModel",
"from django.shortcuts import render_to_response",
"from django.utils.safestring import mark_safe",
"class AlreadyRegistered(Exception):\n pass",
"class NotRegistered(Exception... |
from django.http import Http404
from django.shortcuts import render_to_response
###########
# CHOICES #
###########
def choice_list(request, app_label, module_name, field_name, models):
m, f = lookup_field(app_label, module_name, field_name, models)
return render_to_response('databrowse/choice_list.html', {'m... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.1053,
0.0526,
0,
0.66,
0.3333,
852,
0,
1,
0,
0,
852,
0,
0
],
[
2,
0,
0.4737,
0.1579,
0,
... | [
"from django.http import Http404",
"from django.shortcuts import render_to_response",
"def choice_list(request, app_label, module_name, field_name, models):\n m, f = lookup_field(app_label, module_name, field_name, models)\n return render_to_response('databrowse/choice_list.html', {'model': m, 'field': f}... |
from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site
| [
[
1,
0,
1,
1,
0,
0.66,
0,
231,
0,
4,
0,
0,
231,
0,
0
]
] | [
"from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site"
] |
"""
These classes are light wrappers around Django's database API that provide
convenience functionality and permalink functions for the databrowse app.
"""
from django.db import models
from django.utils import formats
from django.utils.text import capfirst
from django.utils.encoding import smart_unicode, smart_str, i... | [
[
8,
0,
0.0116,
0.0186,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0279,
0.0047,
0,
0.66,
0.0714,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0326,
0.0047,
0,
0.66,
... | [
"\"\"\"\nThese classes are light wrappers around Django's database API that provide\nconvenience functionality and permalink functions for the databrowse app.\n\"\"\"",
"from django.db import models",
"from django.utils import formats",
"from django.utils.text import capfirst",
"from django.utils.encoding i... |
# -*- coding: utf-8 -*-
import unittest
from django.contrib.webdesign.lorem_ipsum import *
from django.template import loader, Context
class WebdesignTest(unittest.TestCase):
def test_words(self):
self.assertEqual(words(7), u'lorem ipsum dolor sit amet consectetur adipisicing')
def test_paragraphs... | [
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.2381,
0.0476,
0,
0.66,
0.3333,
74,
0,
1,
0,
0,
74,
0,
0
],
[
1,
0,
0.2857,
0.0476,
0,
0.66... | [
"import unittest",
"from django.contrib.webdesign.lorem_ipsum import *",
"from django.template import loader, Context",
"class WebdesignTest(unittest.TestCase):\n\n def test_words(self):\n self.assertEqual(words(7), u'lorem ipsum dolor sit amet consectetur adipisicing')\n\n def test_paragraphs(se... |
"""
Utility functions for generating "lorem ipsum" Latin text.
"""
import random
COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo con... | [
[
8,
0,
0.0198,
0.0297,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0495,
0.0099,
0,
0.66,
0.125,
715,
0,
1,
0,
0,
715,
0,
0
],
[
14,
0,
0.0693,
0.0099,
0,
0.66... | [
"\"\"\"\nUtility functions for generating \"lorem ipsum\" Latin text.\n\"\"\"",
"import random",
"COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut al... |
from django.contrib.webdesign.lorem_ipsum import words, paragraphs
from django import template
register = template.Library()
class LoremNode(template.Node):
def __init__(self, count, method, common):
self.count, self.method, self.common = count, method, common
def render(self, context):
try:
... | [
[
1,
0,
0.0149,
0.0149,
0,
0.66,
0,
74,
0,
2,
0,
0,
74,
0,
0
],
[
1,
0,
0.0299,
0.0149,
0,
0.66,
0.2,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.0597,
0.0149,
0,
0.66... | [
"from django.contrib.webdesign.lorem_ipsum import words, paragraphs",
"from django import template",
"register = template.Library()",
"class LoremNode(template.Node):\n def __init__(self, count, method, common):\n self.count, self.method, self.common = count, method, common\n\n def render(self, c... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
class ContentTypeManager(models.Manager):
# Cache to avoid re-looking up ContentType objects all over the place.
# This cache is shared by all the get_for_* methods.
_cache ... | [
[
1,
0,
0.0095,
0.0095,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.019,
0.0095,
0,
0.66,
0.25,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0286,
0.0095,
0,
0.66,... | [
"from django.db import models",
"from django.utils.translation import ugettext_lazy as _",
"from django.utils.encoding import smart_unicode",
"class ContentTypeManager(models.Manager):\n\n # Cache to avoid re-looking up ContentType objects all over the place.\n # This cache is shared by all the get_for_... |
from django import db
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.contenttypes.views import shortcut
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from django.test... | [
[
1,
0,
0.0141,
0.0141,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0282,
0.0141,
0,
0.66,
0.125,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0423,
0.0141,
0,
0... | [
"from django import db",
"from django.conf import settings",
"from django.contrib.contenttypes.models import ContentType",
"from django.contrib.sites.models import Site",
"from django.contrib.contenttypes.views import shortcut",
"from django.core.exceptions import ObjectDoesNotExist",
"from django.http ... |
"""
Classes allowing "generic" relations through ContentType and object-id fields.
"""
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import signals
from django.db import models, router
from django.db.models.fields.related import RelatedField, Field, ManyTo... | [
[
8,
0,
0.0048,
0.0072,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.012,
0.0024,
0,
0.66,
0.05,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0145,
0.0024,
0,
0.66,
... | [
"\"\"\"\nClasses allowing \"generic\" relations through ContentType and object-id fields.\n\"\"\"",
"from django.core.exceptions import ObjectDoesNotExist",
"from django.db import connection",
"from django.db.models import signals",
"from django.db import models, router",
"from django.db.models.fields.rel... |
from django import http
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site, get_current_site
from django.core.exceptions import ObjectDoesNotExist
def shortcut(request, content_type_id, object_id):
"Redirect to an object's page based on a content-type ID and an ... | [
[
1,
0,
0.0141,
0.0141,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0282,
0.0141,
0,
0.66,
0.25,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.0423,
0.0141,
0,
0.... | [
"from django import http",
"from django.contrib.contenttypes.models import ContentType",
"from django.contrib.sites.models import Site, get_current_site",
"from django.core.exceptions import ObjectDoesNotExist",
"def shortcut(request, content_type_id, object_id):\n \"Redirect to an object's page based on... |
from django.contrib.contenttypes.models import ContentType
from django.db.models import get_apps, get_models, signals
from django.utils.encoding import smart_unicode
def update_contenttypes(app, created_models, verbosity=2, **kwargs):
"""
Creates content types for models in the given app, removing any model
... | [
[
1,
0,
0.0167,
0.0167,
0,
0.66,
0,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.0333,
0.0167,
0,
0.66,
0.1667,
680,
0,
3,
0,
0,
680,
0,
0
],
[
1,
0,
0.05,
0.0167,
0,
0.... | [
"from django.contrib.contenttypes.models import ContentType",
"from django.db.models import get_apps, get_models, signals",
"from django.utils.encoding import smart_unicode",
"def update_contenttypes(app, created_models, verbosity=2, **kwargs):\n \"\"\"\n Creates content types for models in the given ap... |
""" models.py (even empty) currently required by the runtests.py to enable unit tests """
| [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\" models.py (even empty) currently required by the runtests.py to enable unit tests \"\"\""
] |
import unittest
from django import forms
from django.conf import settings
from django.contrib.formtools import preview, wizard, utils
from django import http
from django.test import TestCase
success_string = "Done was called!"
class TestFormPreview(preview.FormPreview):
def done(self, request, cleaned_data):
... | [
[
1,
0,
0.0037,
0.0037,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0074,
0.0037,
0,
0.66,
0.0526,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0112,
0.0037,
0,
0.... | [
"import unittest",
"from django import forms",
"from django.conf import settings",
"from django.contrib.formtools import preview, wizard, utils",
"from django import http",
"from django.test import TestCase",
"success_string = \"Done was called!\"",
"class TestFormPreview(preview.FormPreview):\n\n ... |
"""
Formtools Preview application.
"""
import cPickle as pickle
from django.conf import settings
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.utils.hashcompat import md5_constructor
from django.contrib.formtools.utils im... | [
[
8,
0,
0.0157,
0.0236,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0394,
0.0079,
0,
0.66,
0.1111,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.0551,
0.0079,
0,
0.66... | [
"\"\"\"\nFormtools Preview application.\n\"\"\"",
"import cPickle as pickle",
"from django.conf import settings",
"from django.http import Http404",
"from django.shortcuts import render_to_response",
"from django.template.context import RequestContext",
"from django.utils.hashcompat import md5_construct... |
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.utils.hashcompat import md5_constructor
from django.forms import BooleanField
def security_hash(request, form, *args):
"""
Calculates a security hash for the given Form instance.
This crea... | [
[
7,
0,
0.0641,
0.1026,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0513,
0.0256,
1,
0.23,
0,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
1,
0.1026,
0.0256,
1,
0.23,
... | [
"try:\n import cPickle as pickle\nexcept ImportError:\n import pickle",
" import cPickle as pickle",
" import pickle",
"from django.conf import settings",
"from django.utils.hashcompat import md5_constructor",
"from django.forms import BooleanField",
"def security_hash(request, form, *args):... |
"""
FormWizard class -- implements a multi-page form, validating between each
step and storing the form's state as HTML hidden fields so that no state is
stored on the server side.
"""
import cPickle as pickle
from django import forms
from django.conf import settings
from django.http import Http404
from django.shortc... | [
[
8,
0,
0.0113,
0.0189,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0264,
0.0038,
0,
0.66,
0.0833,
279,
0,
1,
0,
0,
279,
0,
0
],
[
1,
0,
0.034,
0.0038,
0,
0.66,... | [
"\"\"\"\nFormWizard class -- implements a multi-page form, validating between each\nstep and storing the form's state as HTML hidden fields so that no state is\nstored on the server side.\n\"\"\"",
"import cPickle as pickle",
"from django import forms",
"from django.conf import settings",
"from django.http ... |
from django.core.exceptions import MiddlewareNotUsed
from django.utils.http import http_date
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has a ETag or
Last-Modified header, and the request has If-None-Match or
If-Modified-Since, the response is replac... | [
[
1,
0,
0.0196,
0.0196,
0,
0.66,
0,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0392,
0.0196,
0,
0.66,
0.3333,
516,
0,
1,
0,
0,
516,
0,
0
],
[
3,
0,
0.3529,
0.5686,
0,
... | [
"from django.core.exceptions import MiddlewareNotUsed",
"from django.utils.http import http_date",
"class ConditionalGetMiddleware(object):\n \"\"\"\n Handles conditional GET operations. If the response has a ETag or\n Last-Modified header, and the request has If-None-Match or\n If-Modified-Since, t... |
"this is the locale selecting middleware that will look at accept headers"
from django.utils.cache import patch_vary_headers
from django.utils import translation
class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what translation object to install in the... | [
[
8,
0,
0.04,
0.04,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.12,
0.04,
0,
0.66,
0.3333,
53,
0,
1,
0,
0,
53,
0,
0
],
[
1,
0,
0.16,
0.04,
0,
0.66,
0.6667,
... | [
"\"this is the locale selecting middleware that will look at accept headers\"",
"from django.utils.cache import patch_vary_headers",
"from django.utils import translation",
"class LocaleMiddleware(object):\n \"\"\"\n This is a very simple middleware that parses a request\n and decides what translatio... |
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accordingly, so that cac... | [
[
1,
0,
0.0263,
0.0263,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0789,
0.0263,
0,
0.66,
0.25,
590,
0,
1,
0,
0,
590,
0,
0
],
[
1,
0,
0.1053,
0.0263,
0,
0.... | [
"import re",
"from django.utils.text import compress_string",
"from django.utils.cache import patch_vary_headers",
"re_accepts_gzip = re.compile(r'\\bgzip\\b')",
"class GZipMiddleware(object):\n \"\"\"\n This middleware compresses content if the browser allows gzip compression.\n It sets the Vary h... |
from django.conf import settings
from django import http
class XViewMiddleware(object):
"""
Adds an X-View header to internal HEAD requests -- used by the documentation system.
"""
def process_view(self, request, view_func, view_args, view_kwargs):
"""
If the request method is HEAD and ... | [
[
1,
0,
0.0526,
0.0526,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1053,
0.0526,
0,
0.66,
0.5,
294,
0,
1,
0,
0,
294,
0,
0
],
[
3,
0,
0.6053,
0.8421,
0,
0.6... | [
"from django.conf import settings",
"from django import http",
"class XViewMiddleware(object):\n \"\"\"\n Adds an X-View header to internal HEAD requests -- used by the documentation system.\n \"\"\"\n def process_view(self, request, view_func, view_args, view_kwargs):\n \"\"\"\n If th... |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import itertools
import re
import random
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils.cache import patch_vary... | [
[
8,
0,
0.0126,
0.0217,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0289,
0.0036,
0,
0.66,
0.0417,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0325,
0.0036,
0,
0.66... | [
"\"\"\"\nCross Site Request Forgery Middleware.\n\nThis module provides a middleware that implements protection\nagainst request forgeries from other sites.\n\"\"\"",
"import itertools",
"import re",
"import random",
"from django.conf import settings",
"from django.core.urlresolvers import get_callable",
... |
from django.db import transaction
class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_on_response activated - that way a save() doesn't do a direct
commit, the commit is done when a successful response is created. If an
exc... | [
[
1,
0,
0.037,
0.037,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
3,
0,
0.5556,
0.9259,
0,
0.66,
1,
538,
0,
3,
0,
0,
186,
0,
9
],
[
8,
1,
0.2407,
0.2222,
1,
0.52,
... | [
"from django.db import transaction",
"class TransactionMiddleware(object):\n \"\"\"\n Transaction middleware. If this is enabled, each view function will be run\n with commit_on_response activated - that way a save() doesn't do a direct\n commit, the commit is done when a successful response is create... |
"""
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE_CLASSES = [
'django.middleware.cache.UpdateCa... | [
[
8,
0,
0.1562,
0.3063,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3187,
0.0063,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.325,
0.0063,
0,
0.66,... | [
"\"\"\"\nCache middleware. If enabled, each Django-powered page will be cached based on\nURL. The canonical way to enable cache middleware is to set\n``UpdateCacheMiddleware`` as your first piece of middleware, and\n``FetchFromCacheMiddleware`` as the last::\n\n MIDDLEWARE_CLASSES = [\n 'django.middleware... |
import re
from django.template import Node, Variable, VariableNode, _render_value_in_context
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.utils import translation
from django.utils.encoding import force_unicode
register = Library()... | [
[
1,
0,
0.0036,
0.0036,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0109,
0.0036,
0,
0.66,
0.0476,
213,
0,
4,
0,
0,
213,
0,
0
],
[
1,
0,
0.0146,
0.0036,
0,
... | [
"import re",
"from django.template import Node, Variable, VariableNode, _render_value_in_context",
"from django.template import TemplateSyntaxError, TokenParser, Library",
"from django.template import TOKEN_TEXT, TOKEN_VAR",
"from django.utils import translation",
"from django.utils.encoding import force_... |
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
from django.utils.http import urlquote
from django.utils.hashcompat import md5_constructor
regi... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
213,
0,
5,
0,
0,
213,
0,
0
],
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0.1111,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
... | [
"from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist",
"from django.template import resolve_variable",
"from django.core.cache import cache",
"from django.utils.encoding import force_unicode",
"from django.utils.http import urlquote",
"from django.utils.hashcompa... |
# This module is DEPRECATED!
#
# You should no longer be using django.template_loader.
#
# Use django.template.loader instead.
from django.template.loader import *
| [
[
1,
0,
1,
0.1429,
0,
0.66,
0,
970,
0,
1,
0,
0,
970,
0,
0
]
] | [
"from django.template.loader import *"
] |
"""
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
from StringIO import StringIO
import decimal
import yaml
from django.db import models
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as... | [
[
8,
0,
0.0536,
0.0893,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.125,
0.0179,
0,
0.66,
0.1,
609,
0,
1,
0,
0,
609,
0,
0
],
[
1,
0,
0.1429,
0.0179,
0,
0.66,
... | [
"\"\"\"\nYAML serializer.\n\nRequires PyYaml (http://pyyaml.org/), but that's checked for in __init__.\n\"\"\"",
"from StringIO import StringIO",
"import decimal",
"import yaml",
"from django.db import models",
"from django.core.serializers.python import Serializer as PythonSerializer",
"from django.cor... |
"""
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.utils import datetime_safe
from django.utils import simpl... | [
[
8,
0,
0.0323,
0.0484,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0806,
0.0161,
0,
0.66,
0.0909,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0968,
0.0161,
0,
0.66... | [
"\"\"\"\nSerialize data to/from JSON\n\"\"\"",
"import datetime",
"import decimal",
"from StringIO import StringIO",
"from django.core.serializers.python import Serializer as PythonSerializer",
"from django.core.serializers.python import Deserializer as PythonDeserializer",
"from django.utils import dat... |
"""
XML serializer.
"""
from django.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.encoding import smart_unicode
from xml.dom import pulldom
class Serializer(base.Serializer):
"""
... | [
[
8,
0,
0.0067,
0.0101,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0168,
0.0034,
0,
0.66,
0.1111,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0202,
0.0034,
0,
0.66... | [
"\"\"\"\nXML serializer.\n\"\"\"",
"from django.conf import settings",
"from django.core.serializers import base",
"from django.db import models, DEFAULT_DB_ALIAS",
"from django.utils.xmlutils import SimplerXMLGenerator",
"from django.utils.encoding import smart_unicode",
"from xml.dom import pulldom",
... |
"""
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.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS
from dj... | [
[
8,
0,
0.0211,
0.0352,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0493,
0.007,
0,
0.66,
0.1429,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0563,
0.007,
0,
0.66,
... | [
"\"\"\"\nA Python \"serializer\". Doesn't do much serializing per se -- just converts to\nand from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for\nother serializers.\n\"\"\"",
"from django.conf import settings",
"from django.core.serializers import base",
"from django.db import m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.