code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
from django.contrib.redirects.models import Redirect
from django import http
from django.conf import settings
class RedirectFallbackMiddleware(object):
def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a redirect for non-404 re... | [
[
1,
0,
0.037,
0.037,
0,
0.66,
0,
909,
0,
1,
0,
0,
909,
0,
0
],
[
1,
0,
0.0741,
0.037,
0,
0.66,
0.3333,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.1111,
0.037,
0,
0.66... | [
"from django.contrib.redirects.models import Redirect",
"from django import http",
"from django.conf import settings",
"class RedirectFallbackMiddleware(object):\n def process_response(self, request, response):\n if response.status_code != 404:\n return response # No need to check for a r... |
from django.contrib import admin
from django.contrib.redirects.models import Redirect
class RedirectAdmin(admin.ModelAdmin):
list_display = ('old_path', 'new_path')
list_filter = ('site',)
search_fields = ('old_path', 'new_path')
radio_fields = {'site': admin.VERTICAL}
admin.site.register(Redirect, R... | [
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.2727,
0.0909,
0,
0.66,
0.3333,
909,
0,
1,
0,
0,
909,
0,
0
],
[
3,
0,
0.6364,
0.4545,
0,
... | [
"from django.contrib import admin",
"from django.contrib.redirects.models import Redirect",
"class RedirectAdmin(admin.ModelAdmin):\n list_display = ('old_path', 'new_path')\n list_filter = ('site',)\n search_fields = ('old_path', 'new_path')\n radio_fields = {'site': admin.VERTICAL}",
" list_d... |
# Empty models.py to allow for specifying admindocs as a test label.
| [] | [] |
from django.db import models
class CustomField(models.Field):
description = "A custom field type"
class DescriptionLackingField(models.Field):
pass
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
3,
0,
0.5,
0.2857,
0,
0.66,
0.5,
771,
0,
0,
0,
0,
922,
0,
0
],
[
14,
1,
0.5714,
0.1429,
1,
0.69,
... | [
"from django.db import models",
"class CustomField(models.Field):\n description = \"A custom field type\"",
" description = \"A custom field type\"",
"class DescriptionLackingField(models.Field):\n pass"
] |
import unittest
import fields
from django.contrib.admindocs import views
from django.db.models import fields as builtin_fields
class TestFieldType(unittest.TestCase):
def setUp(self):
pass
def test_field_name(self):
self.assertRaises(AttributeError,
views.get_readable_field_data_t... | [
[
1,
0,
0.0333,
0.0333,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0667,
0.0333,
0,
0.66,
0.25,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.1,
0.0333,
0,
0.66,
... | [
"import unittest",
"import fields",
"from django.contrib.admindocs import views",
"from django.db.models import fields as builtin_fields",
"class TestFieldType(unittest.TestCase):\n def setUp(self):\n pass\n\n def test_field_name(self):\n self.assertRaises(AttributeError,\n vi... |
from django.conf.urls.defaults import *
from django.contrib.admindocs import views
urlpatterns = patterns('',
url('^$',
views.doc_index,
name='django-admindocs-docroot'
),
url('^bookmarklets/$',
views.bookmarklets,
name='django-admindocs-bookmarklets'
),
url('^tags/$... | [
[
1,
0,
0.0244,
0.0244,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0488,
0.0244,
0,
0.66,
0.5,
601,
0,
1,
0,
0,
601,
0,
0
],
[
14,
0,
0.5488,
0.9268,
0,
0.... | [
"from django.conf.urls.defaults import *",
"from django.contrib.admindocs import views",
"urlpatterns = patterns('',\n url('^$',\n views.doc_index,\n name='django-admindocs-docroot'\n ),\n url('^bookmarklets/$',\n views.bookmarklets,\n name='django-admindocs-bookmarklets'"
] |
"Misc. utility functions/classes for admin documentation generator."
import re
from email.Parser import HeaderParser
from email.Errors import HeaderParseError
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.utils.encoding import smart_str
try:
import docutils.... | [
[
8,
0,
0.0095,
0.0095,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0286,
0.0095,
0,
0.66,
0.0714,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0381,
0.0095,
0,
0.66... | [
"\"Misc. utility functions/classes for admin documentation generator.\"",
"import re",
"from email.Parser import HeaderParser",
"from email.Errors import HeaderParseError",
"from django.utils.safestring import mark_safe",
"from django.core.urlresolvers import reverse",
"from django.utils.encoding import... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
SITE_CACHE = {}
class SiteManager(models.Manager):
def get_current(self):
"""
Returns the current ``Site`` based on the SITE_ID in the
project's settings. The ``Site`` object is cached the first
... | [
[
1,
0,
0.0105,
0.0105,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0211,
0.0105,
0,
0.66,
0.1667,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.0526,
0.0105,
0,
0... | [
"from django.db import models",
"from django.utils.translation import ugettext_lazy as _",
"SITE_CACHE = {}",
"class SiteManager(models.Manager):\n\n def get_current(self):\n \"\"\"\n Returns the current ``Site`` based on the SITE_ID in the\n project's settings. The ``Site`` object is ... |
from django.conf import settings
from django.contrib.sites.models import Site, RequestSite, get_current_site
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from django.test import TestCase
class SitesFrameworkTests(TestCase):
def setUp(self):
Site(id=settings.SI... | [
[
1,
0,
0.0179,
0.0179,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0357,
0.0179,
0,
0.66,
0.2,
890,
0,
3,
0,
0,
890,
0,
0
],
[
1,
0,
0.0536,
0.0179,
0,
0.6... | [
"from django.conf import settings",
"from django.contrib.sites.models import Site, RequestSite, get_current_site",
"from django.core.exceptions import ObjectDoesNotExist",
"from django.http import HttpRequest",
"from django.test import TestCase",
"class SitesFrameworkTests(TestCase):\n\n def setUp(self... |
from django.conf import settings
from django.db import models
from django.db.models.fields import FieldDoesNotExist
class CurrentSiteManager(models.Manager):
"Use this to limit objects to those associated with the current site."
def __init__(self, field_name=None):
super(CurrentSiteManager, self).__ini... | [
[
1,
0,
0.0244,
0.0244,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0488,
0.0244,
0,
0.66,
0.3333,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0732,
0.0244,
0,
0.... | [
"from django.conf import settings",
"from django.db import models",
"from django.db.models.fields import FieldDoesNotExist",
"class CurrentSiteManager(models.Manager):\n \"Use this to limit objects to those associated with the current site.\"\n def __init__(self, field_name=None):\n super(Current... |
from django.contrib import admin
from django.contrib.sites.models import Site
class SiteAdmin(admin.ModelAdmin):
list_display = ('domain', 'name')
search_fields = ('domain', 'name')
admin.site.register(Site, SiteAdmin) | [
[
1,
0,
0.1111,
0.1111,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.2222,
0.1111,
0,
0.66,
0.3333,
890,
0,
1,
0,
0,
890,
0,
0
],
[
3,
0,
0.6667,
0.3333,
0,
... | [
"from django.contrib import admin",
"from django.contrib.sites.models import Site",
"class SiteAdmin(admin.ModelAdmin):\n list_display = ('domain', 'name')\n search_fields = ('domain', 'name')",
" list_display = ('domain', 'name')",
" search_fields = ('domain', 'name')",
"admin.site.register(S... |
"""
Creates the default Site object.
"""
from django.db.models import signals
from django.contrib.sites.models import Site
from django.contrib.sites import models as site_app
def create_default_site(app, created_models, verbosity, db, **kwargs):
if Site in created_models:
if verbosity >= 2:
pr... | [
[
8,
0,
0.1176,
0.1765,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2941,
0.0588,
0,
0.66,
0.2,
680,
0,
1,
0,
0,
680,
0,
0
],
[
1,
0,
0.3529,
0.0588,
0,
0.66,
... | [
"\"\"\"\nCreates the default Site object.\n\"\"\"",
"from django.db.models import signals",
"from django.contrib.sites.models import Site",
"from django.contrib.sites import models as site_app",
"def create_default_site(app, created_models, verbosity, db, **kwargs):\n if Site in created_models:\n ... |
from django.contrib.admin.filterspecs import FilterSpec
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.util import quote
from django.core.exceptions import SuspiciousOperation
from django.core.paginator import Paginator, InvalidPage
from django.db import models
from django.... | [
[
1,
0,
0.004,
0.004,
0,
0.66,
0,
229,
0,
1,
0,
0,
229,
0,
0
],
[
1,
0,
0.0079,
0.004,
0,
0.66,
0.0476,
84,
0,
1,
0,
0,
84,
0,
0
],
[
1,
0,
0.0119,
0.004,
0,
0.66,
... | [
"from django.contrib.admin.filterspecs import FilterSpec",
"from django.contrib.admin.options import IncorrectLookupParameters",
"from django.contrib.admin.util import quote",
"from django.core.exceptions import SuspiciousOperation",
"from django.core.paginator import Paginator, InvalidPage",
"from django... |
import base64
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django import http, template
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.sho... | [
[
1,
0,
0.0137,
0.0137,
0,
0.66,
0,
177,
0,
1,
0,
0,
177,
0,
0
],
[
7,
0,
0.0479,
0.0548,
0,
0.66,
0.0909,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0411,
0.0137,
1,
0.79... | [
"import base64",
"try:\n from functools import wraps\nexcept ImportError:\n from django.utils.functional import wraps # Python 2.4 fallback.",
" from functools import wraps",
" from django.utils.functional import wraps # Python 2.4 fallback.",
"from django import http, template",
"from djang... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.contrib.admin.util import quote
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django.utils.safestring import mark... | [
[
1,
0,
0.0185,
0.0185,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.037,
0.0185,
0,
0.66,
0.0909,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.0556,
0.0185,
0,
0.6... | [
"from django.db import models",
"from django.contrib.contenttypes.models import ContentType",
"from django.contrib.auth.models import User",
"from django.contrib.admin.util import quote",
"from django.utils.translation import ugettext_lazy as _",
"from django.utils.encoding import smart_unicode",
"from ... |
#!/usr/bin/env python
import os
import optparse
import subprocess
import sys
here = os.path.dirname(__file__)
def main():
usage = "usage: %prog [file1..fileN]"
description = """With no file paths given this script will automatically
compress all jQuery-based files of the admin app. Requires the Google Closure... | [
[
1,
0,
0.0426,
0.0213,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0638,
0.0213,
0,
0.66,
0.1667,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0851,
0.0213,
0,
... | [
"import os",
"import optparse",
"import subprocess",
"import sys",
"here = os.path.dirname(__file__)",
"def main():\n usage = \"usage: %prog [file1..fileN]\"\n description = \"\"\"With no file paths given this script will automatically\ncompress all jQuery-based files of the admin app. Requires the ... |
"""
FilterSpec encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
from django.db import models
from djan... | [
[
8,
0,
0.0223,
0.0391,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0503,
0.0056,
0,
0.66,
0.0588,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0559,
0.0056,
0,
0.66,
... | [
"\"\"\"\nFilterSpec encapsulates the logic for displaying filters in the Django admin.\nFilters are specified in models with the \"list_filter\" option.\n\nEach filter subclass knows how to display a filter for a field that passes a\ncertain test -- e.g. being a DateField or ForeignKey.\n\"\"\"",
"from django.db ... |
from django import template
register = template.Library()
def prepopulated_fields_js(context):
"""
Creates a list of prepopulated_fields that should render Javascript for
the prepopulated fields for both the admin form and inlines.
"""
prepopulated_fields = []
if context['add'] and 'adminform'... | [
[
1,
0,
0.0238,
0.0238,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.0714,
0.0238,
0,
0.66,
0.2,
276,
3,
0,
0,
0,
77,
10,
1
],
[
2,
0,
0.2857,
0.3571,
0,
0.... | [
"from django import template",
"register = template.Library()",
"def prepopulated_fields_js(context):\n \"\"\"\n Creates a list of prepopulated_fields that should render Javascript for\n the prepopulated fields for both the admin form and inlines.\n \"\"\"\n prepopulated_fields = []\n if conte... |
from django.template import Library
from django.utils.encoding import iri_to_uri
register = Library()
def admin_media_prefix():
"""
Returns the string contained in the setting ADMIN_MEDIA_PREFIX.
"""
try:
from django.conf import settings
except ImportError:
return ''
return iri... | [
[
1,
0,
0.0667,
0.0667,
0,
0.66,
0,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.1333,
0.0667,
0,
0.66,
0.25,
96,
0,
1,
0,
0,
96,
0,
0
],
[
14,
0,
0.2667,
0.0667,
0,
0.6... | [
"from django.template import Library",
"from django.utils.encoding import iri_to_uri",
"register = Library()",
"def admin_media_prefix():\n \"\"\"\n Returns the string contained in the setting ADMIN_MEDIA_PREFIX.\n \"\"\"\n try:\n from django.conf import settings\n except ImportError:\n ... |
from django import template
from django.contrib.admin.models import LogEntry
register = template.Library()
class AdminLogNode(template.Node):
def __init__(self, limit, varname, user):
self.limit, self.varname, self.user = limit, varname, user
def __repr__(self):
return "<GetAdminLog Node>"
... | [
[
1,
0,
0.0175,
0.0175,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0351,
0.0175,
0,
0.66,
0.2,
408,
0,
1,
0,
0,
408,
0,
0
],
[
14,
0,
0.0702,
0.0175,
0,
0.... | [
"from django import template",
"from django.contrib.admin.models import LogEntry",
"register = template.Library()",
"class AdminLogNode(template.Node):\n def __init__(self, limit, varname, user):\n self.limit, self.varname, self.user = limit, varname, user\n\n def __repr__(self):\n return ... |
import datetime
from django.conf import settings
from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE
from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
from django.cor... | [
[
1,
0,
0.0032,
0.0032,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0097,
0.0032,
0,
0.66,
0.0286,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.013,
0.0032,
0,
0... | [
"import datetime",
"from django.conf import settings",
"from django.contrib.admin.util import lookup_field, display_for_field, label_for_field",
"from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE",
"from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SE... |
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models.related import RelatedObject
from django.forms.forms import pretty_name
from django.utils import formats
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.text impo... | [
[
1,
0,
0.0029,
0.0029,
0,
0.66,
0,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0059,
0.0029,
0,
0.66,
0.0455,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0088,
0.0029,
0,
0.... | [
"from django.core.exceptions import ObjectDoesNotExist",
"from django.db import models",
"from django.db.models.related import RelatedObject",
"from django.forms.forms import pretty_name",
"from django.utils import formats",
"from django.utils.html import escape",
"from django.utils.safestring import ma... |
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.forms.models import (BaseModelForm, BaseModelFormSet, fields_for_model,
_get_foreign_key)
from django.contrib.admin.options import flatten_fieldsets, BaseModelAdmin
from django.contrib.admin.options import HORIZONTAL, V... | [
[
1,
0,
0.0026,
0.0026,
0,
0.66,
0,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0053,
0.0026,
0,
0.66,
0.0714,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0092,
0.0053,
0,
0.... | [
"from django.core.exceptions import ImproperlyConfigured",
"from django.db import models",
"from django.forms.models import (BaseModelForm, BaseModelFormSet, fields_for_model,\n _get_foreign_key)",
"from django.contrib.admin.options import flatten_fieldsets, BaseModelAdmin",
"from django.contrib.admin.op... |
from django import forms
from django.conf import settings
from django.contrib.admin.util import flatten_fieldsets, lookup_field
from django.contrib.admin.util import display_for_field, label_for_field
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from d... | [
[
1,
0,
0.0029,
0.0029,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0058,
0.0029,
0,
0.66,
0.037,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0087,
0.0029,
0,
0... | [
"from django import forms",
"from django.conf import settings",
"from django.contrib.admin.util import flatten_fieldsets, lookup_field",
"from django.contrib.admin.util import display_for_field, label_for_field",
"from django.contrib.contenttypes.models import ContentType",
"from django.core.exceptions im... |
from django import forms, template
from django.forms.formsets import all_valid
from django.forms.models import modelform_factory, modelformset_factory, inlineformset_factory
from django.forms.models import BaseInlineFormSet
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin import widg... | [
[
1,
0,
0.0007,
0.0007,
0,
0.66,
0,
294,
0,
2,
0,
0,
294,
0,
0
],
[
1,
0,
0.0015,
0.0007,
0,
0.66,
0.0278,
42,
0,
1,
0,
0,
42,
0,
0
],
[
1,
0,
0.0022,
0.0007,
0,
0.... | [
"from django import forms, template",
"from django.forms.formsets import all_valid",
"from django.forms.models import modelform_factory, modelformset_factory, inlineformset_factory",
"from django.forms.models import BaseInlineFormSet",
"from django.contrib.contenttypes.models import ContentType",
"from dj... |
import re
from django import http, template
from django.contrib.admin import ModelAdmin
from django.contrib.admin import actions
from django.contrib.auth import authenticate, login
from django.views.decorators.csrf import csrf_protect
from django.db.models.base import ModelBase
from django.core.exceptions import Improp... | [
[
1,
0,
0.0019,
0.0019,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0037,
0.0019,
0,
0.66,
0.0476,
294,
0,
2,
0,
0,
294,
0,
0
],
[
1,
0,
0.0056,
0.0019,
0,
... | [
"import re",
"from django import http, template",
"from django.contrib.admin import ModelAdmin",
"from django.contrib.admin import actions",
"from django.contrib.auth import authenticate, login",
"from django.views.decorators.csrf import csrf_protect",
"from django.db.models.base import ModelBase",
"f... |
"""
Form Widget classes specific to the Django admin site.
"""
import django.utils.copycompat as copy
from django import forms
from django.forms.widgets import RadioFieldRenderer
from django.forms.util import flatatt
from django.utils.html import escape
from django.utils.text import truncate_words
from django.utils.t... | [
[
8,
0,
0.0066,
0.0099,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0165,
0.0033,
0,
0.66,
0.037,
125,
0,
1,
0,
0,
125,
0,
0
],
[
1,
0,
0.0231,
0.0033,
0,
0.66,... | [
"\"\"\"\nForm Widget classes specific to the Django admin site.\n\"\"\"",
"import django.utils.copycompat as copy",
"from django import forms",
"from django.forms.widgets import RadioFieldRenderer",
"from django.forms.util import flatatt",
"from django.utils.html import escape",
"from django.utils.text ... |
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
from django.contrib.admin.options import StackedInline, TabularInline
from django.contrib.admin.sites import AdminSite, site
def autodiscover():
"""
Auto-discover INSTALLED_A... | [
[
1,
0,
0.0278,
0.0278,
0,
0.66,
0,
140,
0,
1,
0,
0,
140,
0,
0
],
[
1,
0,
0.0556,
0.0278,
0,
0.66,
0.25,
84,
0,
3,
0,
0,
84,
0,
0
],
[
1,
0,
0.0833,
0.0278,
0,
0.66... | [
"from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME",
"from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL",
"from django.contrib.admin.options import StackedInline, TabularInline",
"from django.contrib.admin.sites import AdminSite, site",
"def autodiscover():\n \"\"\"\n ... |
"""
Built-in, globally-available admin actions.
"""
from django import template
from django.core.exceptions import PermissionDenied
from django.contrib.admin import helpers
from django.contrib.admin.util import get_deleted_objects, model_ngettext
from django.shortcuts import render_to_response
from django.utils.encodi... | [
[
8,
0,
0.0274,
0.0411,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0685,
0.0137,
0,
0.66,
0.0833,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0822,
0.0137,
0,
0.66... | [
"\"\"\"\nBuilt-in, globally-available admin actions.\n\"\"\"",
"from django import template",
"from django.core.exceptions import PermissionDenied",
"from django.contrib.admin import helpers",
"from django.contrib.admin.util import get_deleted_objects, model_ngettext",
"from django.shortcuts import render... |
import cStringIO, zipfile
from django.conf import settings
from django.http import HttpResponse
from django.template import loader
def compress_kml(kml):
"Returns compressed KMZ from the given KML string."
kmz = cStringIO.StringIO()
zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DEFLATED)
zf.writestr('doc.... | [
[
1,
0,
0.0312,
0.0312,
0,
0.66,
0,
764,
0,
2,
0,
0,
764,
0,
0
],
[
1,
0,
0.0625,
0.0312,
0,
0.66,
0.1429,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0938,
0.0312,
0,
... | [
"import cStringIO, zipfile",
"from django.conf import settings",
"from django.http import HttpResponse",
"from django.template import loader",
"def compress_kml(kml):\n \"Returns compressed KMZ from the given KML string.\"\n kmz = cStringIO.StringIO()\n zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DE... |
from django.db import connection
if (hasattr(connection.ops, 'spatial_version') and
not connection.ops.mysql):
# Getting the `SpatialRefSys` and `GeometryColumns`
# models for the default spatial backend. These
# aliases are provided for backwards-compatibility.
SpatialRefSys = connection.ops.spat... | [
[
1,
0,
0.1111,
0.1111,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
4,
0,
0.6667,
0.7778,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
3
],
[
14,
1,
0.8889,
0.1111,
1,
0.68,
... | [
"from django.db import connection",
"if (hasattr(connection.ops, 'spatial_version') and\n not connection.ops.mysql):\n # Getting the `SpatialRefSys` and `GeometryColumns`\n # models for the default spatial backend. These\n # aliases are provided for backwards-compatibility.\n SpatialRefSys = conne... |
from django.core import urlresolvers
from django.contrib.sitemaps import Sitemap
class GeoRSSSitemap(Sitemap):
"""
A minimal hook to produce sitemaps for GeoRSS feeds.
"""
def __init__(self, feed_dict, slug_dict=None):
"""
This sitemap object initializes on a feed dictionary (as would b... | [
[
1,
0,
0.0189,
0.0189,
0,
0.66,
0,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.0377,
0.0189,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
3,
0,
0.5283,
0.9245,
0,
0.6... | [
"from django.core import urlresolvers",
"from django.contrib.sitemaps import Sitemap",
"class GeoRSSSitemap(Sitemap):\n \"\"\"\n A minimal hook to produce sitemaps for GeoRSS feeds.\n \"\"\"\n def __init__(self, feed_dict, slug_dict=None):\n \"\"\"\n This sitemap object initializes on ... |
from django.core import urlresolvers
from django.contrib.sitemaps import Sitemap
from django.contrib.gis.db.models.fields import GeometryField
from django.db import models
class KMLSitemap(Sitemap):
"""
A minimal hook to produce KML sitemaps.
"""
geo_format = 'kml'
def __init__(self, locations=Non... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0.2,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
0.6... | [
"from django.core import urlresolvers",
"from django.contrib.sitemaps import Sitemap",
"from django.contrib.gis.db.models.fields import GeometryField",
"from django.db import models",
"class KMLSitemap(Sitemap):\n \"\"\"\n A minimal hook to produce KML sitemaps.\n \"\"\"\n geo_format = 'kml'\n\n... |
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.contrib.gis.db.models.fields import GeometryField
from django.db import... | [
[
1,
0,
0.009,
0.009,
0,
0.66,
0,
779,
0,
2,
0,
0,
779,
0,
0
],
[
1,
0,
0.018,
0.009,
0,
0.66,
0.0769,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.027,
0.009,
0,
0.66,
... | [
"from django.http import HttpResponse, Http404",
"from django.template import loader",
"from django.contrib.sites.models import get_current_site",
"from django.core import urlresolvers",
"from django.core.paginator import EmptyPage, PageNotAnInteger",
"from django.contrib.gis.db.models.fields import Geome... |
# Geo-enabled Sitemap classes.
from django.contrib.gis.sitemaps.georss import GeoRSSSitemap
from django.contrib.gis.sitemaps.kml import KMLSitemap, KMZSitemap
| [
[
1,
0,
0.5,
0.25,
0,
0.66,
0,
81,
0,
1,
0,
0,
81,
0,
0
],
[
1,
0,
0.75,
0.25,
0,
0.66,
1,
933,
0,
2,
0,
0,
933,
0,
0
]
] | [
"from django.contrib.gis.sitemaps.georss import GeoRSSSitemap",
"from django.contrib.gis.sitemaps.kml import KMLSitemap, KMZSitemap"
] |
from django.contrib.gis.geos import \
GEOSGeometry as Geometry, \
GEOSException as GeometryException
| [
[
1,
0,
0.6667,
1,
0,
0.66,
0,
886,
0,
2,
0,
0,
886,
0,
0
]
] | [
"from django.contrib.gis.geos import \\\n GEOSGeometry as Geometry, \\\n GEOSException as GeometryException"
] |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
geom_backend = getattr(settings, 'GEOMETRY_BACKEND', 'geos')
try:
module = import_module('.%s' % geom_backend, 'django.contrib.gis.geometry.backend')
except ImportError, e:
... | [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.5,
0.25,
0,
0.66,
0.5,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.75,
0.25,
0,
0.66,
1,
... | [
"from django.conf import settings",
"from django.core.exceptions import ImproperlyConfigured",
"from django.utils.importlib import import_module"
] |
import re
# Regular expression for recognizing HEXEWKB and WKT. A prophylactic measure
# to prevent potentially malicious input from reaching the underlying C
# library. Not a substitute for good Web security programming practices.
hex_regex = re.compile(r'^[0-9A-F]+$', re.I)
wkt_regex = re.compile(r'^(SRID=(?P<srid... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
14,
0,
0.5,
0.0833,
0,
0.66,
0.3333,
439,
3,
2,
0,
0,
821,
10,
1
],
[
14,
0,
0.75,
0.4167,
0,
0.... | [
"import re",
"hex_regex = re.compile(r'^[0-9A-F]+$', re.I)",
"wkt_regex = re.compile(r'^(SRID=(?P<srid>\\d+);)?'\n r'(?P<wkt>'\n r'(?P<type>POINT|LINESTRING|LINEARRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION)'\n r'[ACEG... |
from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point
from django.contrib.gis.maps.google.gmap import GoogleMapException
from math import pi, sin, cos, log, exp, atan
# Constants used for degree to radian conversion, and vice-versa.
DTOR = pi / 180.
RTOD = 180. / pi
class GoogleZoom(object):
... | [
[
1,
0,
0.0062,
0.0062,
0,
0.66,
0,
886,
0,
4,
0,
0,
886,
0,
0
],
[
1,
0,
0.0124,
0.0062,
0,
0.66,
0.2,
633,
0,
1,
0,
0,
633,
0,
0
],
[
1,
0,
0.0186,
0.0062,
0,
0.6... | [
"from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point",
"from django.contrib.gis.maps.google.gmap import GoogleMapException",
"from math import pi, sin, cos, log, exp, atan",
"DTOR = pi / 180.",
"RTOD = 180. / pi",
"class GoogleZoom(object):\n \"\"\"\n GoogleZoom is a utility... |
from django.utils.safestring import mark_safe
from django.contrib.gis.geos import fromstr, Point, LineString, LinearRing, Polygon
class GEvent(object):
"""
A Python wrapper for the Google GEvent object.
Events can be attached to any object derived from GOverlayBase with the
add_event() call.
For ... | [
[
1,
0,
0.0033,
0.0033,
0,
0.66,
0,
375,
0,
1,
0,
0,
375,
0,
0
],
[
1,
0,
0.0066,
0.0033,
0,
0.66,
0.1429,
886,
0,
5,
0,
0,
886,
0,
0
],
[
3,
0,
0.0897,
0.1561,
0,
... | [
"from django.utils.safestring import mark_safe",
"from django.contrib.gis.geos import fromstr, Point, LineString, LinearRing, Polygon",
"class GEvent(object):\n \"\"\"\n A Python wrapper for the Google GEvent object.\n\n Events can be attached to any object derived from GOverlayBase with the\n add_e... |
"""
This module houses the GoogleMap object, used for generating
the needed javascript to embed Google Maps in a Web page.
Google(R) is a registered trademark of Google, Inc. of Mountain View, California.
Example:
* In the view:
return render_to_response('template.html', {'google' : GoogleMap(key="... | [
[
8,
0,
0.4836,
0.9508,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.9672,
0.0164,
0,
0.66,
0.3333,
633,
0,
2,
0,
0,
633,
0,
0
],
[
1,
0,
0.9836,
0.0164,
0,
0.66... | [
"\"\"\"\n This module houses the GoogleMap object, used for generating\n the needed javascript to embed Google Maps in a Web page.\n\n Google(R) is a registered trademark of Google, Inc. of Mountain View, California.\n\n Example:",
"from django.contrib.gis.maps.google.gmap import GoogleMap, GoogleMapSet",
... |
from django.conf import settings
from django.contrib.gis import geos
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
class GoogleMapException(Exception): pass
from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker, GIcon
# The default Google ... | [
[
1,
0,
0.0044,
0.0044,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0088,
0.0044,
0,
0.66,
0.125,
735,
0,
1,
0,
0,
735,
0,
0
],
[
1,
0,
0.0133,
0.0044,
0,
0... | [
"from django.conf import settings",
"from django.contrib.gis import geos",
"from django.template.loader import render_to_string",
"from django.utils.safestring import mark_safe",
"class GoogleMapException(Exception): pass",
"from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker,... |
from django.contrib.syndication.feeds import Feed as BaseFeed, FeedDoesNotExist
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
class GeoFeedMixin(object):
"""
This mixin provides the necessary routines for SyndicationFeed subclasses
to produce simple GeoRSS or W3C Geo elements.
"""
... | [
[
1,
0,
0.0074,
0.0074,
0,
0.66,
0,
211,
0,
2,
0,
0,
211,
0,
0
],
[
1,
0,
0.0148,
0.0074,
0,
0.66,
0.1667,
366,
0,
2,
0,
0,
366,
0,
0
],
[
3,
0,
0.2963,
0.5407,
0,
... | [
"from django.contrib.syndication.feeds import Feed as BaseFeed, FeedDoesNotExist",
"from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed",
"class GeoFeedMixin(object):\n \"\"\"\n This mixin provides the necessary routines for SyndicationFeed subclasses\n to produce simple GeoRSS or W3C Geo ... |
"""
Utilities for manipulating Geometry WKT.
"""
def precision_wkt(geom, prec):
"""
Returns WKT text of the geometry according to the given precision (an
integer or a string). If the precision is an integer, then the decimal
places of coordinates WKT will be truncated to that number:
>>> pnt =... | [
[
8,
0,
0.0364,
0.0545,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.5455,
0.9273,
0,
0.66,
1,
39,
0,
2,
1,
0,
0,
0,
19
],
[
8,
1,
0.2273,
0.2545,
1,
0.63,
0... | [
"\"\"\"\n Utilities for manipulating Geometry WKT.\n\"\"\"",
"def precision_wkt(geom, prec):\n \"\"\"\n Returns WKT text of the geometry according to the given precision (an \n integer or a string). If the precision is an integer, then the decimal\n places of coordinates WKT will be truncated to that... |
"""
This module houses the GeoIP object, a ctypes wrapper for the MaxMind GeoIP(R)
C API (http://www.maxmind.com/app/c). This is an alternative to the GPL
licensed Python GeoIP interface provided by MaxMind.
GeoIP(R) is a registered trademark of MaxMind, LLC of Boston, Massachusetts.
For IP-based geolocation, t... | [
[
8,
0,
0.0568,
0.1108,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1136,
0.0028,
0,
0.66,
0.0294,
688,
0,
2,
0,
0,
688,
0,
0
],
[
1,
0,
0.1163,
0.0028,
0,
0.66... | [
"\"\"\"\n This module houses the GeoIP object, a ctypes wrapper for the MaxMind GeoIP(R)\n C API (http://www.maxmind.com/app/c). This is an alternative to the GPL\n licensed Python GeoIP interface provided by MaxMind.\n\n GeoIP(R) is a registered trademark of MaxMind, LLC of Boston, Massachusetts.\n\n For IP-based... |
"""
This module is for inspecting OGR data sources and generating either
models for GeoDjango and/or mapping dictionaries for use with the
`LayerMapping` utility.
Author: Travis Pinney, Dane Springmeyer, & Justin Bronn
"""
from itertools import izip
# Requires GDAL to use.
from django.contrib.gis.gdal import DataSourc... | [
[
8,
0,
0.0178,
0.0311,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0356,
0.0044,
0,
0.66,
0.1667,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0444,
0.0044,
0,
0.66... | [
"\"\"\"\nThis module is for inspecting OGR data sources and generating either\nmodels for GeoDjango and/or mapping dictionaries for use with the\n`LayerMapping` utility.\n\nAuthor: Travis Pinney, Dane Springmeyer, & Justin Bronn\n\"\"\"",
"from itertools import izip",
"from django.contrib.gis.gdal import DataSo... |
"""
This module includes some utility functions for inspecting the layout
of a GDAL data source -- the functionality is analogous to the output
produced by the `ogrinfo` utility.
"""
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.gdal.geometries import GEO_CLASSES
def ogrinfo(data_source, num_... | [
[
8,
0,
0.0566,
0.0943,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1321,
0.0189,
0,
0.66,
0.25,
793,
0,
1,
0,
0,
793,
0,
0
],
[
1,
0,
0.1509,
0.0189,
0,
0.66,
... | [
"\"\"\"\nThis module includes some utility functions for inspecting the layout\nof a GDAL data source -- the functionality is analogous to the output\nproduced by the `ogrinfo` utility.\n\"\"\"",
"from django.contrib.gis.gdal import DataSource",
"from django.contrib.gis.gdal.geometries import GEO_CLASSES",
"d... |
"""
This module contains useful utilities for GeoDjango.
"""
# Importing the utilities that depend on GDAL, if available.
from django.contrib.gis.gdal import HAS_GDAL
if HAS_GDAL:
from django.contrib.gis.utils.ogrinfo import ogrinfo, sample
from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect
... | [
[
8,
0,
0.08,
0.12,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2,
0.04,
0,
0.66,
0.25,
793,
0,
1,
0,
0,
793,
0,
0
],
[
4,
0,
0.42,
0.4,
0,
0.66,
0.5,
0... | [
"\"\"\"\n This module contains useful utilities for GeoDjango.\n\"\"\"",
"from django.contrib.gis.gdal import HAS_GDAL",
"if HAS_GDAL:\n from django.contrib.gis.utils.ogrinfo import ogrinfo, sample\n from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect\n from django.contrib.gis.utils.srs... |
from django.contrib.gis.gdal import SpatialReference
from django.db import connections, DEFAULT_DB_ALIAS
def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,
database=DEFAULT_DB_ALIAS):
"""
This function takes a GDAL SpatialReference system and adds its information
... | [
[
1,
0,
0.013,
0.013,
0,
0.66,
0,
793,
0,
1,
0,
0,
793,
0,
0
],
[
1,
0,
0.026,
0.013,
0,
0.66,
0.3333,
40,
0,
2,
0,
0,
40,
0,
0
],
[
2,
0,
0.5065,
0.9221,
0,
0.66,
... | [
"from django.contrib.gis.gdal import SpatialReference",
"from django.db import connections, DEFAULT_DB_ALIAS",
"def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,\n database=DEFAULT_DB_ALIAS):\n \"\"\"\n This function takes a GDAL SpatialReference system and adds ... |
from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap
from models import City, Country
from feeds import feed_dict
sitemaps = {'kml' : KMLSitemap([City, Country]),
'kmz' : KMZSitemap([City, Country]),
'georss' : GeoRSSSitemap(feed_dict),
}
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
123,
0,
3,
0,
0,
123,
0,
0
],
[
1,
0,
0.25,
0.125,
0,
0.66,
0.3333,
495,
0,
2,
0,
0,
495,
0,
0
],
[
1,
0,
0.375,
0.125,
0,
0.66,
... | [
"from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap",
"from models import City, Country",
"from feeds import feed_dict",
"sitemaps = {'kml' : KMLSitemap([City, Country]),\n 'kmz' : KMZSitemap([City, Country]),\n 'georss' : GeoRSSSitemap(feed_dict),\n ... |
from django.contrib.gis.db import models
from django.contrib.gis.tests.utils import mysql, spatialite
# MySQL spatial indices can't handle NULL geometries.
null_flag = not mysql
class Country(models.Model):
name = models.CharField(max_length=30)
mpoly = models.MultiPolygonField() # SRID, by default, is 4326
... | [
[
1,
0,
0.0222,
0.0222,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
1,
0,
0.0444,
0.0222,
0,
0.66,
0.125,
185,
0,
2,
0,
0,
185,
0,
0
],
[
14,
0,
0.1111,
0.0222,
0,
... | [
"from django.contrib.gis.db import models",
"from django.contrib.gis.tests.utils import mysql, spatialite",
"null_flag = not mysql",
"class Country(models.Model):\n name = models.CharField(max_length=30)\n mpoly = models.MultiPolygonField() # SRID, by default, is 4326\n objects = models.GeoManager()\... |
import re
from django.db import connection
from django.contrib.gis import gdal
from django.contrib.gis.geos import fromstr, GEOSGeometry, \
Point, LineString, LinearRing, Polygon, GeometryCollection
from django.contrib.gis.measure import Distance
from django.contrib.gis.tests.utils import \
no_mysql, no_oracle,... | [
[
1,
0,
0.0014,
0.0014,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0027,
0.0014,
0,
0.66,
0.0833,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0041,
0.0014,
0,
0.... | [
"import re",
"from django.db import connection",
"from django.contrib.gis import gdal",
"from django.contrib.gis.geos import fromstr, GEOSGeometry, \\\n Point, LineString, LinearRing, Polygon, GeometryCollection",
"from django.contrib.gis.measure import Distance",
"from django.contrib.gis.tests.utils i... |
from django.contrib.gis import feeds
from django.contrib.gis.tests.utils import mysql
from models import City, Country
class TestGeoRSS1(feeds.Feed):
link = '/city/'
title = 'Test GeoDjango Cities'
def items(self):
return City.objects.all()
def item_link(self, item):
return '/city/%s/... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
735,
0,
1,
0,
0,
735,
0,
0
],
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0.1,
185,
0,
1,
0,
0,
185,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
0.6... | [
"from django.contrib.gis import feeds",
"from django.contrib.gis.tests.utils import mysql",
"from models import City, Country",
"class TestGeoRSS1(feeds.Feed):\n link = '/city/'\n title = 'Test GeoDjango Cities'\n\n def items(self):\n return City.objects.all()\n\n def item_link(self, item):... |
from django.conf.urls.defaults import *
from feeds import feed_dict
urlpatterns = patterns('',
(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feed_dict}),
)
from sitemaps import sitemaps
urlpatterns += patterns('django.contrib.gis.sitemaps.views',
(r'^sitemap.xml$', 'index', ... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0.3333,
11,
0,
1,
0,
0,
11,
0,
0
],
[
14,
0,
0.3571,
0.2143,
0,
0... | [
"from django.conf.urls.defaults import *",
"from feeds import feed_dict",
"urlpatterns = patterns('',\n (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feed_dict}),\n)",
"from sitemaps import sitemaps"
] |
from django.contrib.gis.db import models
class City3D(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(dim=3)
objects = models.GeoManager()
def __unicode__(self):
return self.name
class Interstate2D(models.Model):
name = models.CharField(max_length=30)
l... | [
[
1,
0,
0.0145,
0.0145,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
3,
0,
0.087,
0.1014,
0,
0.66,
0.1,
877,
0,
1,
0,
0,
996,
0,
3
],
[
14,
1,
0.058,
0.0145,
1,
0.98... | [
"from django.contrib.gis.db import models",
"class City3D(models.Model):\n name = models.CharField(max_length=30)\n point = models.PointField(dim=3)\n objects = models.GeoManager()\n\n def __unicode__(self):\n return self.name",
" name = models.CharField(max_length=30)",
" point = mod... |
import os
import re
from django.utils.unittest import TestCase
from django.contrib.gis.db.models import Union, Extent3D
from django.contrib.gis.geos import GEOSGeometry, Point, Polygon
from django.contrib.gis.utils import LayerMapping, LayerMapError
from models import City3D, Interstate2D, Interstate3D, \
Intersta... | [
[
1,
0,
0.0043,
0.0043,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0087,
0.0043,
0,
0.66,
0.0625,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.013,
0.0043,
0,
0... | [
"import os",
"import re",
"from django.utils.unittest import TestCase",
"from django.contrib.gis.db.models import Union, Extent3D",
"from django.contrib.gis.geos import GEOSGeometry, Point, Polygon",
"from django.contrib.gis.utils import LayerMapping, LayerMapError",
"from models import City3D, Intersta... |
# Create your views here.
| [] | [] |
from django.contrib.gis.db import models
class SouthTexasCity(models.Model):
"City model on projected coordinate system for South Texas."
name = models.CharField(max_length=30)
point = models.PointField(srid=32140)
objects = models.GeoManager()
def __unicode__(self): return self.name
class SouthTe... | [
[
1,
0,
0.02,
0.02,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
3,
0,
0.11,
0.12,
0,
0.66,
0.1429,
516,
0,
1,
0,
0,
996,
0,
3
],
[
8,
1,
0.08,
0.02,
1,
0.33,
0,... | [
"from django.contrib.gis.db import models",
"class SouthTexasCity(models.Model):\n \"City model on projected coordinate system for South Texas.\"\n name = models.CharField(max_length=30)\n point = models.PointField(srid=32140)\n objects = models.GeoManager()\n def __unicode__(self): return self.nam... |
import os
from decimal import Decimal
from django.db import connection
from django.db.models import Q
from django.contrib.gis.geos import GEOSGeometry, Point, LineString
from django.contrib.gis.measure import D # alias for Distance
from django.contrib.gis.tests.utils import oracle, postgis, spatialite, no_oracle, no_s... | [
[
1,
0,
0.0028,
0.0028,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0056,
0.0028,
0,
0.66,
0.1111,
349,
0,
1,
0,
0,
349,
0,
0
],
[
1,
0,
0.0112,
0.0028,
0,
... | [
"import os",
"from decimal import Decimal",
"from django.db import connection",
"from django.db.models import Q",
"from django.contrib.gis.geos import GEOSGeometry, Point, LineString",
"from django.contrib.gis.measure import D # alias for Distance",
"from django.contrib.gis.tests.utils import oracle, po... |
from django.contrib.gis.db import models
class City(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(geography=True)
objects = models.GeoManager()
def __unicode__(self): return self.name
class Zipcode(models.Model):
code = models.CharField(max_length=10)
poly = m... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
3,
0,
0.25,
0.25,
0,
0.66,
0.3333,
801,
0,
1,
0,
0,
996,
0,
3
],
[
14,
1,
0.2,
0.05,
1,
0.64,
0,... | [
"from django.contrib.gis.db import models",
"class City(models.Model):\n name = models.CharField(max_length=30)\n point = models.PointField(geography=True)\n objects = models.GeoManager()\n def __unicode__(self): return self.name",
" name = models.CharField(max_length=30)",
" point = models.... |
"""
Tests for geography support in PostGIS 1.5+
"""
import os
from django.contrib.gis import gdal
from django.contrib.gis.measure import D
from django.test import TestCase
from models import City, County, Zipcode
class GeographyTest(TestCase):
def test01_fixture_load(self):
"Ensure geography features load... | [
[
8,
0,
0.023,
0.0345,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.046,
0.0115,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0575,
0.0115,
0,
0.66,
... | [
"\"\"\"\nTests for geography support in PostGIS 1.5+\n\"\"\"",
"import os",
"from django.contrib.gis import gdal",
"from django.contrib.gis.measure import D",
"from django.test import TestCase",
"from models import City, County, Zipcode",
"class GeographyTest(TestCase):\n\n def test01_fixture_load(se... |
from django.contrib.gis.db import models
class State(models.Model):
name = models.CharField(max_length=20)
objects = models.GeoManager()
class County(models.Model):
name = models.CharField(max_length=25)
state = models.ForeignKey(State)
mpoly = models.MultiPolygonField(srid=4269) # Multipolygon in... | [
[
1,
0,
0.0152,
0.0152,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
3,
0,
0.0606,
0.0455,
0,
0.66,
0.0833,
110,
0,
0,
0,
0,
996,
0,
2
],
[
14,
1,
0.0606,
0.0152,
1,
... | [
"from django.contrib.gis.db import models",
"class State(models.Model):\n name = models.CharField(max_length=20)\n objects = models.GeoManager()",
" name = models.CharField(max_length=20)",
" objects = models.GeoManager()",
"class County(models.Model):\n name = models.CharField(max_length=25)... |
import os
import unittest
from decimal import Decimal
from django.utils.copycompat import copy
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.tests.utils import mysql
from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, InvalidDecimal, MissingForeignKey
from models i... | [
[
1,
0,
0.0037,
0.0037,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0075,
0.0037,
0,
0.66,
0.0667,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0112,
0.0037,
0,
0.... | [
"import os",
"import unittest",
"from decimal import Decimal",
"from django.utils.copycompat import copy",
"from django.contrib.gis.gdal import DataSource",
"from django.contrib.gis.tests.utils import mysql",
"from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, InvalidDecimal,... |
from django.contrib.gis.db import models
from django.contrib.localflavor.us.models import USStateField
class Location(models.Model):
point = models.PointField()
objects = models.GeoManager()
def __unicode__(self): return self.point.wkt
class City(models.Model):
name = models.CharField(max_length=50)
... | [
[
1,
0,
0.0204,
0.0204,
0,
0.66,
0,
964,
0,
1,
0,
0,
964,
0,
0
],
[
1,
0,
0.0408,
0.0204,
0,
0.66,
0.1111,
676,
0,
1,
0,
0,
676,
0,
0
],
[
3,
0,
0.1122,
0.0816,
0,
... | [
"from django.contrib.gis.db import models",
"from django.contrib.localflavor.us.models import USStateField",
"class Location(models.Model):\n point = models.PointField()\n objects = models.GeoManager()\n def __unicode__(self): return self.point.wkt",
" point = models.PointField()",
" objects ... |
from django.test import TestCase
from django.contrib.gis.geos import GEOSGeometry, Point, MultiPoint
from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.tests.utils import mysql, oracle, no_mysql, no_oracle, no_spati... | [
[
1,
0,
0.0035,
0.0035,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0106,
0.0035,
0,
0.66,
0.1667,
886,
0,
3,
0,
0,
886,
0,
0
],
[
1,
0,
0.0141,
0.0035,
0,
... | [
"from django.test import TestCase",
"from django.contrib.gis.geos import GEOSGeometry, Point, MultiPoint",
"from django.contrib.gis.db.models import Collect, Count, Extent, F, Union",
"from django.contrib.gis.geometry.backend import Geometry",
"from django.contrib.gis.tests.utils import mysql, oracle, no_my... |
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
# function that will pass a test.
def pass_test(*args): return
def no_backend(test_func, backend):
"Use this decorator to disable test on specified backend."
if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1] == backend:
... | [
[
1,
0,
0.0385,
0.0385,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0769,
0.0385,
0,
0.66,
0.0833,
40,
0,
1,
0,
0,
40,
0,
0
],
[
2,
0,
0.1923,
0.0385,
0,
0.... | [
"from django.conf import settings",
"from django.db import DEFAULT_DB_ALIAS",
"def pass_test(*args): return",
"def pass_test(*args): return",
"def no_backend(test_func, backend):\n \"Use this decorator to disable test on specified backend.\"\n if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('... |
import unittest
from django.conf import settings
from django.test.simple import build_suite, DjangoTestSuiteRunner
def run_tests(*args, **kwargs):
from django.test.simple import run_tests as base_run_tests
return base_run_tests(*args, **kwargs)
def run_gis_tests(test_labels, verbosity=1, interactive=True, ... | [
[
1,
0,
0.0071,
0.0071,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0213,
0.0071,
0,
0.66,
0.1429,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0284,
0.0071,
0,
0.... | [
"import unittest",
"from django.conf import settings",
"from django.test.simple import build_suite, DjangoTestSuiteRunner",
"def run_tests(*args, **kwargs):\n from django.test.simple import run_tests as base_run_tests\n return base_run_tests(*args, **kwargs)",
" from django.test.simple import run_t... |
# Copyright (c) 2007, Robert Coup <robert.coup@onetrackmind.co.nz>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#... | [
[
8,
0,
0.0982,
0.0268,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1131,
0.003,
0,
0.66,
0.1429,
272,
0,
0,
0,
0,
0,
5,
0
],
[
1,
0,
0.1161,
0.003,
0,
0.66,
... | [
"\"\"\"\nDistance and Area objects to allow for sensible and convienient calculation\nand conversions.\n\nAuthors: Robert Coup, Justin Bronn\n\nInspired by GeoPy (http://exogen.case.edu/projects/geopy/)\nand Geoff Biggs' PhD work on dimensioned units for robotics.",
"__all__ = ['A', 'Area', 'D', 'Distance']",
"... |
"""
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... | [
[
8,
0,
0.1406,
0.2734,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2891,
0.0078,
0,
0.66,
0.1429,
182,
0,
2,
0,
0,
182,
0,
0
],
[
1,
0,
0.3125,
0.0078,
0,
0.66... | [
"\"\"\"\n DataSource is a wrapper for the OGR Data Source object, which provides\n an interface for reading vector geometry data from many different file\n formats (including ESRI shapefiles).\n\n When instantiating a DataSource object, use the filename of a\n GDAL-supported data source. For example, a SHP file or... |
"""
This module houses the OGR & SRS Exception objects, and the
check_err() routine which checks the status code returned by
OGR methods.
"""
#### OGR & SRS Exceptions ####
class GDALException(Exception): pass
class OGRException(Exception): pass
class SRSException(Exception): pass
class OGRIndexError(OGRException, K... | [
[
8,
0,
0.0732,
0.122,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.1707,
0.0244,
0,
0.66,
0.1429,
355,
0,
0,
0,
0,
645,
0,
0
],
[
3,
0,
0.1951,
0.0244,
0,
0.66,... | [
"\"\"\"\n This module houses the OGR & SRS Exception objects, and the\n check_err() routine which checks the status code returned by\n OGR methods.\n\"\"\"",
"class GDALException(Exception): pass",
"class OGRException(Exception): pass",
"class SRSException(Exception): pass",
"class OGRIndexError(OGRExceptio... |
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 OGRException
from django.contrib.gis.gdal.prototypes import ds as capi
# For more information, see the OGR C API source code:
# http://www.gdal.org/ogr/... | [
[
1,
0,
0.0056,
0.0056,
0,
0.66,
0,
182,
0,
2,
0,
0,
182,
0,
0
],
[
1,
0,
0.0112,
0.0056,
0,
0.66,
0.0526,
426,
0,
3,
0,
0,
426,
0,
0
],
[
1,
0,
0.0169,
0.0056,
0,
... | [
"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 OGRException",
"from django.contrib.gis.gdal.prototypes import ds as capi",
"class Field(GDALBase):\n \"A class that wraps an O... |
# Needed ctypes routines
from ctypes import c_double, byref
# Other GDAL imports.
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope
from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException
from django.contrib.gis.gdal.feature... | [
[
1,
0,
0.0094,
0.0047,
0,
0.66,
0,
182,
0,
2,
0,
0,
182,
0,
0
],
[
1,
0,
0.0236,
0.0047,
0,
0.66,
0.1,
771,
0,
1,
0,
0,
771,
0,
0
],
[
1,
0,
0.0283,
0.0047,
0,
0.6... | [
"from ctypes import c_double, byref",
"from django.contrib.gis.gdal.base import GDALBase",
"from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope",
"from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException",
"from django.contrib.gis.gdal.feature import Feature",
"fr... |
import re
from datetime import date
from ctypes import c_char, c_char_p, c_double, c_int, c_ubyte, c_void_p, POINTER
from django.contrib.gis.gdal.envelope import OGREnvelope
from django.contrib.gis.gdal.libgdal import lgdal, GEOJSON
from django.contrib.gis.gdal.prototypes.errcheck import check_bool, check_envelope
from... | [
[
1,
0,
0.0094,
0.0094,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0189,
0.0094,
0,
0.66,
0.0182,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0283,
0.0094,
0,
... | [
"import re",
"from datetime import date",
"from ctypes import c_char, c_char_p, c_double, c_int, c_ubyte, c_void_p, POINTER",
"from django.contrib.gis.gdal.envelope import OGREnvelope",
"from django.contrib.gis.gdal.libgdal import lgdal, GEOJSON",
"from django.contrib.gis.gdal.prototypes.errcheck import c... |
"""
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 check_err, OGRException, SRSException
from django.contrib.gis.gdal.libgdal import lgdal
# Helper routines for retrieving pointers and/or values f... | [
[
8,
0,
0.0197,
0.0315,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0394,
0.0079,
0,
0.66,
0.0625,
182,
0,
2,
0,
0,
182,
0,
0
],
[
1,
0,
0.0472,
0.0079,
0,
0.66... | [
"\"\"\"\n This module houses the error-checking routines used by the GDAL\n ctypes prototypes.\n\"\"\"",
"from ctypes import c_void_p, string_at",
"from django.contrib.gis.gdal.error import check_err, OGRException, SRSException",
"from django.contrib.gis.gdal.libgdal import lgdal",
"def arg_byref(args, offs... |
"""
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 c_char_p, c_double, c_int, c_long, c_void_p, POINTER
from django.contrib.gis.gdal.envelope import OGREnvelope
from djan... | [
[
8,
0,
0.0423,
0.0704,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0845,
0.0141,
0,
0.66,
0.0196,
182,
0,
6,
0,
0,
182,
0,
0
],
[
1,
0,
0.0986,
0.0141,
0,
0.66... | [
"\"\"\"\n This module houses the ctypes function prototypes for OGR DataSource\n related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*, \n OGR_Fld_* routines are relevant here.\n\"\"\"",
"from ctypes import c_char_p, c_double, c_int, c_long, c_void_p, POINTER",
"from django.contrib.gis.gdal.envelope imp... |
"""
This module contains functions that generate ctypes prototypes for the
GDAL routines.
"""
from ctypes import c_char_p, c_double, c_int, c_void_p
from django.contrib.gis.gdal.prototypes.errcheck import \
check_arg_errcode, check_errcode, check_geom, check_geom_offset, \
check_pointer, check_srs, check_str... | [
[
8,
0,
0.021,
0.0336,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0504,
0.0084,
0,
0.66,
0.0909,
182,
0,
4,
0,
0,
182,
0,
0
],
[
1,
0,
0.0672,
0.0252,
0,
0.66,... | [
"\"\"\"\n This module contains functions that generate ctypes prototypes for the\n GDAL routines.\n\"\"\"",
"from ctypes import c_char_p, c_double, c_int, c_void_p",
"from django.contrib.gis.gdal.prototypes.errcheck import \\\n check_arg_errcode, check_errcode, check_geom, check_geom_offset, \\\n check_po... |
from ctypes import c_char_p, c_int, c_void_p, POINTER
from django.contrib.gis.gdal.libgdal import lgdal, std_call
from django.contrib.gis.gdal.prototypes.generation import \
const_string_output, double_output, int_output, \
srs_output, string_output, void_output
## Shortcut generation for routines with known p... | [
[
1,
0,
0.0139,
0.0139,
0,
0.66,
0,
182,
0,
4,
0,
0,
182,
0,
0
],
[
1,
0,
0.0278,
0.0139,
0,
0.66,
0.0294,
460,
0,
2,
0,
0,
460,
0,
0
],
[
1,
0,
0.0556,
0.0417,
0,
... | [
"from ctypes import c_char_p, c_int, c_void_p, POINTER",
"from django.contrib.gis.gdal.libgdal import lgdal, std_call",
"from django.contrib.gis.gdal.prototypes.generation import \\\n const_string_output, double_output, int_output, \\\n srs_output, string_output, void_output",
"def srs_double(f):\n \... |
from django.contrib.gis.gdal.error import OGRException
#### OGRGeomType ####
class OGRGeomType(object):
"Encapulates OGR Geometry Types."
wkb25bit = -2147483648
# Dictionary of acceptable OGRwkbGeometryType s and their string names.
_types = {0 : 'Unknown',
1 : 'Point',
2 ... | [
[
1,
0,
0.0118,
0.0118,
0,
0.66,
0,
76,
0,
1,
0,
0,
76,
0,
0
],
[
3,
0,
0.5235,
0.9647,
0,
0.66,
1,
85,
0,
6,
0,
0,
186,
0,
17
],
[
8,
1,
0.0588,
0.0118,
1,
0.2,
... | [
"from django.contrib.gis.gdal.error import OGRException",
"class OGRGeomType(object):\n \"Encapulates OGR Geometry Types.\"\n\n wkb25bit = -2147483648\n\n # Dictionary of acceptable OGRwkbGeometryType s and their string names.\n _types = {0 : 'Unknown',\n 1 : 'Point',",
" \"Encapulat... |
"""
Module for executing all of the GDAL tests. None
of these tests require the use of the database.
"""
from unittest import TestSuite, TextTestRunner
# Importing the GDAL test modules.
import test_driver, test_ds, test_envelope, test_geom, test_srs
test_suites = [test_driver.suite(),
test_ds.suite()... | [
[
8,
0,
0.1,
0.16,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2,
0.04,
0,
0.66,
0.2,
88,
0,
2,
0,
0,
88,
0,
0
],
[
1,
0,
0.32,
0.04,
0,
0.66,
0.4,
924,... | [
"\"\"\"\nModule for executing all of the GDAL tests. None\nof these tests require the use of the database.\n\"\"\"",
"from unittest import TestSuite, TextTestRunner",
"import test_driver, test_ds, test_envelope, test_geom, test_srs",
"test_suites = [test_driver.suite(),\n test_ds.suite(),\n ... |
# The GDAL C library, OGR exception, and the Field object
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import OGRException, OGRIndexError
from django.contrib.gis.gdal.field import Field
from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType
from django.contrib.gi... | [
[
1,
0,
0.0182,
0.0091,
0,
0.66,
0,
771,
0,
1,
0,
0,
771,
0,
0
],
[
1,
0,
0.0273,
0.0091,
0,
0.66,
0.1667,
76,
0,
2,
0,
0,
76,
0,
0
],
[
1,
0,
0.0364,
0.0091,
0,
0.... | [
"from django.contrib.gis.gdal.base import GDALBase",
"from django.contrib.gis.gdal.error import OGRException, OGRIndexError",
"from django.contrib.gis.gdal.field import Field",
"from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType",
"from django.contrib.gis.gdal.srs import SpatialReferenc... |
"""
The OGRGeometry is a wrapper for using the OGR Geometry class
(see http://www.gdal.org/ogr/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" u... | [
[
8,
0,
0.0278,
0.0543,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.057,
0.0014,
0,
0.66,
0.0476,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0583,
0.0014,
0,
0.66,... | [
"\"\"\"\n The OGRGeometry is a wrapper for using the OGR Geometry class\n (see http://www.gdal.org/ogr/classOGRGeometry.html). OGRGeometry\n may be instantiated when reading geometries from OGR Data Sources\n (e.g. SHP files), or when given OGC WKT (a string).\n\n While the 'full' API is not present yet, the API i... |
import os, re, sys
from ctypes import c_char_p, CDLL
from ctypes.util import find_library
from django.contrib.gis.gdal.error import OGRException
# Custom library path set?
try:
from django.conf import settings
lib_path = settings.GDAL_LIBRARY_PATH
except (AttributeError, EnvironmentError, ImportError):
lib... | [
[
1,
0,
0.0096,
0.0096,
0,
0.66,
0,
688,
0,
3,
0,
0,
688,
0,
0
],
[
1,
0,
0.0192,
0.0096,
0,
0.66,
0.0417,
182,
0,
2,
0,
0,
182,
0,
0
],
[
1,
0,
0.0288,
0.0096,
0,
... | [
"import os, re, sys",
"from ctypes import c_char_p, CDLL",
"from ctypes.util import find_library",
"from django.contrib.gis.gdal.error import OGRException",
"try:\n from django.conf import settings\n lib_path = settings.GDAL_LIBRARY_PATH\nexcept (AttributeError, EnvironmentError, ImportError):\n li... |
# prerequisites imports
from ctypes import c_void_p
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import OGRException
from django.contrib.gis.gdal.prototypes import ds as capi
# For more information, see the OGR C API source code:
# http://www.gdal.org/ogr/ogr__api_8h.html
#
# ... | [
[
1,
0,
0.0308,
0.0154,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.0462,
0.0154,
0,
0.66,
0.25,
771,
0,
1,
0,
0,
771,
0,
0
],
[
1,
0,
0.0615,
0.0154,
0,
0.... | [
"from ctypes import c_void_p",
"from django.contrib.gis.gdal.base import GDALBase",
"from django.contrib.gis.gdal.error import OGRException",
"from django.contrib.gis.gdal.prototypes import ds as capi",
"class Driver(GDALBase):\n \"Wraps an OGR Data Source Driver.\"\n\n # Case-insensitive aliases for ... |
"""
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)
... | [
[
8,
0,
0.0371,
0.0686,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0743,
0.0057,
0,
0.66,
0.25,
182,
0,
2,
0,
0,
182,
0,
0
],
[
1,
0,
0.08,
0.0057,
0,
0.66,
... | [
"\"\"\"\n The GDAL/OGR library uses an Envelope structure to hold the bounding\n box information for a geometry. The envelope (bounding box) contains\n two pairs of coordinates, one for the lower left coordinate and one\n for the upper right coordinate:\n\n +----------o Upper right; (max_... |
from ctypes import c_void_p
from types import NoneType
from django.contrib.gis.gdal.error import GDALException
class GDALBase(object):
"""
Base object for GDAL objects that has a pointer access property
that controls access to the underlying C pointer.
"""
# Initially the pointer is NULL.
_ptr ... | [
[
1,
0,
0.0286,
0.0286,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.0571,
0.0286,
0,
0.66,
0.3333,
209,
0,
1,
0,
0,
209,
0,
0
],
[
1,
0,
0.0857,
0.0286,
0,
... | [
"from ctypes import c_void_p",
"from types import NoneType",
"from django.contrib.gis.gdal.error import GDALException",
"class GDALBase(object):\n \"\"\"\n Base object for GDAL objects that has a pointer access property\n that controls access to the underlying C pointer.\n \"\"\"\n # Initially ... |
"""
This module houses ctypes interfaces for GDAL objects. The following GDAL
objects are supported:
CoordTransform: Used for coordinate transformations from one spatial
reference system to another.
Driver: Wraps an OGR data source driver.
DataSource: Wrapper for the OGR data source object, supports
OGR-... | [
[
8,
0,
0.3148,
0.6111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
7,
0,
0.7593,
0.1667,
0,
0.66,
0.25,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.7037,
0.0185,
1,
0.77,
... | [
"\"\"\"\n This module houses ctypes interfaces for GDAL objects. The following GDAL\n objects are supported:\n\n CoordTransform: Used for coordinate transformations from one spatial\n reference system to another.\n\n Driver: Wraps an OGR data source driver.",
"try:\n from django.contrib.gis.gdal.driver impor... |
"""
The Spatial Reference class, represensents 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,
AUTHORI... | [
[
8,
0,
0.043,
0.0831,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0861,
0.003,
0,
0.66,
0.1429,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.089,
0.003,
0,
0.66,
... | [
"\"\"\"\n The Spatial Reference class, represensents OGR Spatial Reference objects.\n\n Example:\n >>> from django.contrib.gis.gdal import SpatialReference\n >>> srs = SpatialReference('WGS84')\n >>> print srs\n GEOGCS[\"WGS 84\",",
"import re",
"from ctypes import byref, c_char_p, c_int, c_void_p",
"fr... |
from django.conf import settings
from django.contrib.admin import ModelAdmin
from django.contrib.gis.admin.widgets import OpenLayersWidget
from django.contrib.gis.gdal import OGRGeomType
from django.contrib.gis.db import models
class GeoModelAdmin(ModelAdmin):
"""
The administration options class for Geographi... | [
[
1,
0,
0.0081,
0.0081,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0161,
0.0081,
0,
0.66,
0.1429,
703,
0,
1,
0,
0,
703,
0,
0
],
[
1,
0,
0.0242,
0.0081,
0,
... | [
"from django.conf import settings",
"from django.contrib.admin import ModelAdmin",
"from django.contrib.gis.admin.widgets import OpenLayersWidget",
"from django.contrib.gis.gdal import OGRGeomType",
"from django.contrib.gis.db import models",
"class GeoModelAdmin(ModelAdmin):\n \"\"\"\n The administ... |
from django.conf import settings
from django.contrib.gis.gdal import OGRException
from django.contrib.gis.geos import GEOSGeometry, GEOSException
from django.forms.widgets import Textarea
from django.template import loader, Context
from django.utils import translation
# Creating a template context that contains Django... | [
[
1,
0,
0.0093,
0.0093,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0187,
0.0093,
0,
0.66,
0.1429,
793,
0,
1,
0,
0,
793,
0,
0
],
[
1,
0,
0.028,
0.0093,
0,
0... | [
"from django.conf import settings",
"from django.contrib.gis.gdal import OGRException",
"from django.contrib.gis.geos import GEOSGeometry, GEOSException",
"from django.forms.widgets import Textarea",
"from django.template import loader, Context",
"from django.utils import translation",
"geo_context = Co... |
# Getting the normal admin routines, classes, and `site` instance.
from django.contrib.admin import autodiscover, site, AdminSite, ModelAdmin, StackedInline, TabularInline, HORIZONTAL, VERTICAL
# Geographic admin options classes and widgets.
from django.contrib.gis.admin.options import GeoModelAdmin
from django.contri... | [
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0,
703,
0,
8,
0,
0,
703,
0,
0
],
[
1,
0,
0.4167,
0.0833,
0,
0.66,
0.3333,
833,
0,
1,
0,
0,
833,
0,
0
],
[
1,
0,
0.5,
0.0833,
0,
0.6... | [
"from django.contrib.admin import autodiscover, site, AdminSite, ModelAdmin, StackedInline, TabularInline, HORIZONTAL, VERTICAL",
"from django.contrib.gis.admin.options import GeoModelAdmin",
"from django.contrib.gis.admin.widgets import OpenLayersWidget",
"try:\n from django.contrib.gis.admin.options impo... |
from django.contrib.gis.geos.base import numpy
from django.contrib.gis.geos.coordseq import GEOSCoordSeq
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.point import Point
from django.contrib.gis.geos import prototypes as cap... | [
[
1,
0,
0.0066,
0.0066,
0,
0.66,
0,
386,
0,
1,
0,
0,
386,
0,
0
],
[
1,
0,
0.0132,
0.0066,
0,
0.66,
0.1429,
849,
0,
1,
0,
0,
849,
0,
0
],
[
1,
0,
0.0197,
0.0066,
0,
... | [
"from django.contrib.gis.geos.base import numpy",
"from django.contrib.gis.geos.coordseq import GEOSCoordSeq",
"from django.contrib.gis.geos.error import GEOSException",
"from django.contrib.gis.geos.geometry import GEOSGeometry",
"from django.contrib.gis.geos.point import Point",
"from django.contrib.gis... |
"""
This module houses the GEOS exceptions, specifically, GEOSException and
GEOSGeometryIndexError.
"""
class GEOSException(Exception):
"The base GEOS exception, indicates a GEOS-related error."
pass
class GEOSIndexError(GEOSException, KeyError):
"""
This exception is raised when an invalid index is... | [
[
8,
0,
0.125,
0.2,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.35,
0.15,
0,
0.66,
0.5,
290,
0,
0,
0,
0,
645,
0,
0
],
[
8,
1,
0.35,
0.05,
1,
0.97,
0,
0,... | [
"\"\"\"\n This module houses the GEOS exceptions, specifically, GEOSException and\n GEOSGeometryIndexError.\n\"\"\"",
"class GEOSException(Exception):\n \"The base GEOS exception, indicates a GEOS-related error.\"\n pass",
" \"The base GEOS exception, indicates a GEOS-related error.\"",
"class GEOSIn... |
"""
Module that holds classes for performing I/O operations on GEOS geometry
objects. Specifically, this has Python implementations of WKB/WKT
reader and writer classes.
"""
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.prototypes.io import _WKTReader, _WKBReader, WKBWriter, WK... | [
[
8,
0,
0.15,
0.25,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3,
0.05,
0,
0.66,
0.25,
843,
0,
1,
0,
0,
843,
0,
0
],
[
1,
0,
0.35,
0.05,
0,
0.66,
0.5,
... | [
"\"\"\"\nModule that holds classes for performing I/O operations on GEOS geometry\nobjects. Specifically, this has Python implementations of WKB/WKT\nreader and writer classes.\n\"\"\"",
"from django.contrib.gis.geos.geometry import GEOSGeometry",
"from django.contrib.gis.geos.prototypes.io import _WKTReader, ... |
"""
This module houses the Geometry Collection objects:
GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
"""
from ctypes import c_int, c_uint, byref
from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gi... | [
[
8,
0,
0.0203,
0.0325,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0407,
0.0081,
0,
0.66,
0.0769,
182,
0,
3,
0,
0,
182,
0,
0
],
[
1,
0,
0.0488,
0.0081,
0,
0.66... | [
"\"\"\"\n This module houses the Geometry Collection objects:\n GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon\n\"\"\"",
"from ctypes import c_int, c_uint, byref",
"from django.contrib.gis.geos.error import GEOSException, GEOSIndexError",
"from django.contrib.gis.geos.geometry import GEOSGe... |
from ctypes import c_char_p, c_int, c_size_t, c_ubyte, c_uint, POINTER
from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, PREPGEOM_PTR, GEOS_PREPARE
from django.contrib.gis.geos.prototypes.errcheck import \
check_geom, check_minus_one, check_sized_string, check_string, check_zero
from django.contrib.gis.... | [
[
1,
0,
0.0084,
0.0084,
0,
0.66,
0,
182,
0,
6,
0,
0,
182,
0,
0
],
[
1,
0,
0.0168,
0.0084,
0,
0.66,
0.0227,
64,
0,
4,
0,
0,
64,
0,
0
],
[
1,
0,
0.0294,
0.0168,
0,
0.... | [
"from ctypes import c_char_p, c_int, c_size_t, c_ubyte, c_uint, POINTER",
"from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, PREPGEOM_PTR, GEOS_PREPARE",
"from django.contrib.gis.geos.prototypes.errcheck import \\\n check_geom, check_minus_one, check_sized_string, check_string, check_zero",
"fr... |
import threading
from ctypes import byref, c_char_p, c_int, c_char, c_size_t, Structure, POINTER
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string, check_sized_string
from django.contrib... | [
[
1,
0,
0.0041,
0.0041,
0,
0.66,
0,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0083,
0.0041,
0,
0.66,
0.0154,
182,
0,
7,
0,
0,
182,
0,
0
],
[
1,
0,
0.0124,
0.0041,
0,
0.... | [
"import threading",
"from ctypes import byref, c_char_p, c_int, c_char, c_size_t, Structure, POINTER",
"from django.contrib.gis.geos.base import GEOSBase",
"from django.contrib.gis.geos.libgeos import GEOM_PTR",
"from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string, check_sized_s... |
"""
Error checking functions for GEOS ctypes prototype functions.
"""
import os
from ctypes import c_void_p, string_at, CDLL
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.libgeos import GEOS_VERSION
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
# Getting the... | [
[
8,
0,
0.0211,
0.0316,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0421,
0.0105,
0,
0.66,
0.0714,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0526,
0.0105,
0,
0.66... | [
"\"\"\"\n Error checking functions for GEOS ctypes prototype functions.\n\"\"\"",
"import os",
"from ctypes import c_void_p, string_at, CDLL",
"from django.contrib.gis.geos.error import GEOSException",
"from django.contrib.gis.geos.libgeos import GEOS_VERSION",
"from django.contrib.gis.geos.prototypes.thr... |
"""
This module houses the GEOS ctypes prototype functions for the
topological operations on geometries.
"""
__all__ = ['geos_boundary', 'geos_buffer', 'geos_centroid', 'geos_convexhull',
'geos_difference', 'geos_envelope', 'geos_intersection',
'geos_linemerge', 'geos_pointonsurface', 'geos_pre... | [
[
8,
0,
0.049,
0.0784,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1275,
0.0784,
0,
0.66,
0.04,
272,
0,
0,
0,
0,
0,
5,
0
],
[
1,
0,
0.1961,
0.0196,
0,
0.66,
... | [
"\"\"\"\n This module houses the GEOS ctypes prototype functions for the\n topological operations on geometries.\n\"\"\"",
"__all__ = ['geos_boundary', 'geos_buffer', 'geos_centroid', 'geos_convexhull',\n 'geos_difference', 'geos_envelope', 'geos_intersection', \n 'geos_linemerge', 'geos_point... |
import threading
from django.contrib.gis.geos.libgeos import lgeos, notice_h, error_h, CONTEXT_PTR
class GEOSContextHandle(object):
"""
Python object representing a GEOS context handle.
"""
def __init__(self):
# Initializing the context handler for this thread with
# the notice and erro... | [
[
1,
0,
0.0116,
0.0116,
0,
0.66,
0,
83,
0,
1,
0,
0,
83,
0,
0
],
[
1,
0,
0.0233,
0.0116,
0,
0.66,
0.2,
64,
0,
4,
0,
0,
64,
0,
0
],
[
3,
0,
0.1047,
0.1279,
0,
0.66,
... | [
"import threading",
"from django.contrib.gis.geos.libgeos import lgeos, notice_h, error_h, CONTEXT_PTR",
"class GEOSContextHandle(object):\n \"\"\"\n Python object representing a GEOS context handle.\n \"\"\"\n def __init__(self):\n # Initializing the context handler for this thread with\n ... |
from ctypes import c_char
from django.contrib.gis.geos.libgeos import GEOM_PTR, PREPGEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
# Prepared geometry constructor and destructors.
geos_prepare = GEOSFunc('GEOSPrepare')... | [
[
1,
0,
0.04,
0.04,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.08,
0.04,
0,
0.66,
0.0714,
64,
0,
2,
0,
0,
64,
0,
0
],
[
1,
0,
0.12,
0.04,
0,
0.66,
0.14... | [
"from ctypes import c_char",
"from django.contrib.gis.geos.libgeos import GEOM_PTR, PREPGEOM_PTR",
"from django.contrib.gis.geos.prototypes.errcheck import check_predicate",
"from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc",
"geos_prepare = GEOSFunc('GEOSPrepare')",
"geos_prepare.argtyp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.