code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
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... | ajibawa-2023/Python-Code-Large/train/row_84800 | 19 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84800:ImportFrom_L1_C0", "label": "from django.contrib.redirects.models import Redirect", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 0, 0.66, 0.0, 909, 0, 1, 0, 0, 909, 0, 0], "semantic": {"name": "django.contrib.redirect... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84800:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84800:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84800:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84800:If_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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... | ajibawa-2023/Python-Code-Large/train/row_84801 | 8 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84801:ImportFrom_L2_C0", "label": "from django.contrib import admin", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84801:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84801:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84801:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84801:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
# Empty models.py to allow for specifying admindocs as a test label.
| ajibawa-2023/Python-Code-Large/train/row_84802 | 0 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
from django.db import models
class CustomField(models.Field):
description = "A custom field type"
class DescriptionLackingField(models.Field):
pass
| ajibawa-2023/Python-Code-Large/train/row_84803 | 4 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84803:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.1429, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84803:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84803:Assign_L4_C4"}] |
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... | ajibawa-2023/Python-Code-Large/train/row_84804 | 13 | 30 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84804:Import_L1_C0", "label": "unittest import unittest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0333, 0.0333, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84804:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84804:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84804:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84804:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-C... |
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/$... | ajibawa-2023/Python-Code-Large/train/row_84805 | 3 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84805:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [] |
"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.... | ajibawa-2023/Python-Code-Large/train/row_84806 | 69 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84806:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0095, 0.0095, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84806:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84806:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84806:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84806:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
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
... | ajibawa-2023/Python-Code-Large/train/row_84808 | 50 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84808:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0105, 0.0105, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84808:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84808:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84808:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84808:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
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... | ajibawa-2023/Python-Code-Large/train/row_84809 | 37 | 56 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84809:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.0179, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84809:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84809:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84809:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84809:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
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... | ajibawa-2023/Python-Code-Large/train/row_84810 | 24 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84810:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84810:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84810:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84810:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84810:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
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) | ajibawa-2023/Python-Code-Large/train/row_84811 | 6 | 9 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84811:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84811:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84811:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84811:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84811:Assign_L7_C4"}] |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84812 | 12 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84812:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1176, 0.1765, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84812:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84812:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84812:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84812:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
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.... | ajibawa-2023/Python-Code-Large/train/row_84813 | 163 | 253 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84813:ImportFrom_L1_C0", "label": "from django.contrib.admin.filterspecs import FilterSpec", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.004, 0.004, 0, 0.66, 0.0, 229, 0, 1, 0, 0, 229, 0, 0], "semantic": {"name": "django.contrib.admin... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84813:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84813:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84813:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84813:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-... |
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... | ajibawa-2023/Python-Code-Large/train/row_84814 | 44 | 73 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84814:Import_L1_C0", "label": "base64 import base64", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0137, 0.0137, 0, 0.66, 0.0, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "base64", "arg_names": [], "import_names": ["base64"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84814:Try_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84814:ImportFrom_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84814:Try_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84814:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
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... | ajibawa-2023/Python-Code-Large/train/row_84815 | 42 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84815:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0185, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84815:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84815:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84815:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84815:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-... |
#!/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... | ajibawa-2023/Python-Code-Large/train/row_84816 | 33 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84816:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0426, 0.0213, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84816:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84816:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84816:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84816:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84817 | 105 | 179 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84817:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0223, 0.0391, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84817:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84817:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84817:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84817:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Cod... |
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'... | ajibawa-2023/Python-Code-Large/train/row_84818 | 23 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84818:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["te... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84818:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84818:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84818:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84818:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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... | ajibawa-2023/Python-Code-Large/train/row_84819 | 10 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84819:ImportFrom_L1_C0", "label": "from django.template import Library", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 213, 0, 1, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "im... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84819:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84819:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84819:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84819:Try_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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>"
... | ajibawa-2023/Python-Code-Large/train/row_84820 | 29 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84820:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["te... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84820:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84820:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84820:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84820:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code... |
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... | ajibawa-2023/Python-Code-Large/train/row_84821 | 169 | 308 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84821:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0032, 0.0032, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84821:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84821:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84821:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84821:If_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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... | ajibawa-2023/Python-Code-Large/train/row_84822 | 184 | 340 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84822:ImportFrom_L1_C0", "label": "from django.core.exceptions import ObjectDoesNotExist", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0029, 0.0029, 0, 0.66, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84822:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84822:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84822:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84822:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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... | ajibawa-2023/Python-Code-Large/train/row_84823 | 170 | 379 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84823:ImportFrom_L1_C0", "label": "from django.core.exceptions import ImproperlyConfigured", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 0, 0.66, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.except... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84823:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84823:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84823:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84823:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
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... | ajibawa-2023/Python-Code-Large/train/row_84824 | 236 | 344 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84824:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0029, 0.0029, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84824:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84824:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84824:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84824:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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... | ajibawa-2023/Python-Code-Large/train/row_84825 | 706 | 1,338 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84825:ImportFrom_L1_C0", "label": "from django import forms, template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0007, 0.0007, 0, 0.66, 0.0, 294, 0, 2, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84825:ClassDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84825:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84825:ClassDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84825:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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... | ajibawa-2023/Python-Code-Large/train/row_84826 | 253 | 534 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84826:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0019, 0.0019, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84826:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84826:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84826:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84826:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84827 | 215 | 303 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84827:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0066, 0.0099, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84827:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84827:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84827:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84827:ClassDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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... | ajibawa-2023/Python-Code-Large/train/row_84828 | 17 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84828:ImportFrom_L1_C0", "label": "from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0278, 0, 0.66, 0.0, 140, 0, 1, 0, 0, 140, 0, 0], "semantic": {"name": "django.contr... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84828:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84828:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84828:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84828:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84829 | 30 | 73 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84829:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0274, 0.0411, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84829:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84829:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84829:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84829:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code... |
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.... | ajibawa-2023/Python-Code-Large/train/row_84830 | 21 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84830:Import_L1_C0", "label": "cStringIO import cStringIO, zipfile", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 764, 0, 2, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84830:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84830:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84830:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84830:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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... | ajibawa-2023/Python-Code-Large/train/row_84831 | 4 | 9 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84831:ImportFrom_L1_C0", "label": "from django.db import connection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84831:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84831:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84831:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84831:Assign_L9_C4"}] |
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... | ajibawa-2023/Python-Code-Large/train/row_84832 | 25 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84832:ImportFrom_L1_C0", "label": "from django.core import urlresolvers", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0189, 0, 0.66, 0.0, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84832:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84832:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84832:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84832:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
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... | ajibawa-2023/Python-Code-Large/train/row_84833 | 35 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84833:ImportFrom_L1_C0", "label": "from django.core import urlresolvers", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84833:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84833:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84833:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84833:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
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... | ajibawa-2023/Python-Code-Large/train/row_84834 | 68 | 111 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84834:ImportFrom_L1_C0", "label": "from django.http import HttpResponse, Http404", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.009, 0.009, 0, 0.66, 0.0, 779, 0, 2, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84834:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84834:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84834:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84834:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code... |
# Geo-enabled Sitemap classes.
from django.contrib.gis.sitemaps.georss import GeoRSSSitemap
from django.contrib.gis.sitemaps.kml import KMLSitemap, KMZSitemap
| ajibawa-2023/Python-Code-Large/train/row_84835 | 2 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84835:ImportFrom_L2_C0", "label": "from django.contrib.gis.sitemaps.georss import GeoRSSSitemap", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.25, 0, 0.66, 0.0, 81, 0, 1, 0, 0, 81, 0, 0], "semantic": {"name": "django.contrib.gis.s... | [] |
from django.contrib.gis.geos import \
GEOSGeometry as Geometry, \
GEOSException as GeometryException
| ajibawa-2023/Python-Code-Large/train/row_84836 | 1 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84836:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos import Geometry, GeometryException", "type": "import", "loc": [1, 3], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 1.0, 0, 0.66, 0.0, 886, 0, 2, 0, 0, 886, 0, 0], "semantic": {"name": "django.contri... | [] |
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:
... | ajibawa-2023/Python-Code-Large/train/row_84837 | 3 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84837:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names"... | [] |
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... | ajibawa-2023/Python-Code-Large/train/row_84838 | 4 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84838:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [] |
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):
... | ajibawa-2023/Python-Code-Large/train/row_84839 | 70 | 161 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84839:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0062, 0.0062, 0, 0.66, 0.0, 886, 0, 4, 0, 0, 886, 0, 0], "semantic": {"name":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84839:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84839:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84839:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84839:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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 ... | ajibawa-2023/Python-Code-Large/train/row_84840 | 98 | 301 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84840:ImportFrom_L1_C0", "label": "from django.utils.safestring import mark_safe", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0033, 0.0033, 0, 0.66, 0.0, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "django.utils.safestring", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84840:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84840:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84840:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84840:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
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="... | ajibawa-2023/Python-Code-Large/train/row_84841 | 4 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84841:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 58], "level": 0, "parent": null, "vector": [8, 0, 0.4836, 0.9508, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
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 ... | ajibawa-2023/Python-Code-Large/train/row_84842 | 109 | 226 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84842:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0044, 0.0044, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84842:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84842:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84842:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84842:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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.
"""
... | ajibawa-2023/Python-Code-Large/train/row_84843 | 78 | 135 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84843:ImportFrom_L1_C0", "label": "from django.contrib.syndication.feeds import BaseFeed, FeedDoesNotExist", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 0, 0.66, 0.0, 211, 0, 2, 0, 0, 211, 0, 0], "semantic": {"name": "dj... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84843:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84843:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84843:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84843:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
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 =... | ajibawa-2023/Python-Code-Large/train/row_84844 | 29 | 55 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84844:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0364, 0.0545, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84844:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84844:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84844:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84844:If_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84845 | 169 | 361 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84845:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 40], "level": 0, "parent": null, "vector": [8, 0, 0.0568, 0.1108, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84845:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84845:Expr_L45_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84845:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84845:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84846 | 90 | 225 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84846:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0178, 0.0311, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84846:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84846:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84846:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84846:If_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
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_... | ajibawa-2023/Python-Code-Large/train/row_84847 | 31 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84847:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0566, 0.0943, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84847:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84847:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84847:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84847:If_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
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
... | ajibawa-2023/Python-Code-Large/train/row_84849 | 13 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84849:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.08, 0.12, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84849:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84849:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84849:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84849:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
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
... | ajibawa-2023/Python-Code-Large/train/row_84850 | 20 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84850:ImportFrom_L1_C0", "label": "from django.contrib.gis.gdal import SpatialReference", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.013, 0.013, 0, 0.66, 0.0, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84850:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84850:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84850:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84850:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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),
}
| ajibawa-2023/Python-Code-Large/train/row_84851 | 4 | 8 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84851:ImportFrom_L1_C0", "label": "from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 123, 0, 3, 0, 0, 123, 0, 0], "semantic": {"name":... | [] |
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
... | ajibawa-2023/Python-Code-Large/train/row_84852 | 40 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84852:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0222, 0.0222, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84852:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84852:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84852:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84852:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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,... | ajibawa-2023/Python-Code-Large/train/row_84853 | 431 | 735 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84853:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0014, 0.0014, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84853:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84853:ImportFrom_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84853:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84853:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-... |
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/... | ajibawa-2023/Python-Code-Large/train/row_84854 | 33 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84854:ImportFrom_L1_C0", "label": "from django.contrib.gis import feeds", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "django.contrib.gis", "arg_names": [],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84854:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84854:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84854:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84854:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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', ... | ajibawa-2023/Python-Code-Large/train/row_84855 | 4 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84855:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [] |
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... | ajibawa-2023/Python-Code-Large/train/row_84856 | 52 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84856:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0145, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84856:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84856:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84856:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84856:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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... | ajibawa-2023/Python-Code-Large/train/row_84857 | 120 | 231 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84857:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0043, 0.0043, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84857:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84857:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84857:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84857:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Co... |
# Create your views here.
| ajibawa-2023/Python-Code-Large/train/row_84858 | 0 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
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... | ajibawa-2023/Python-Code-Large/train/row_84859 | 50 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84859:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.02, 0.02, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84859:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84859:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84859:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84859:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
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... | ajibawa-2023/Python-Code-Large/train/row_84860 | 191 | 358 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84860:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0028, 0.0028, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84860:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84860:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84860:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84860:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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... | ajibawa-2023/Python-Code-Large/train/row_84861 | 20 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84861:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84861:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84861:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84861:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84861:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84862 | 53 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84862:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.023, 0.0345, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84862:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84862:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84862:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84862:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Co... |
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... | ajibawa-2023/Python-Code-Large/train/row_84863 | 39 | 66 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84863:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0152, 0.0152, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84863:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84863:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84863:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84863:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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... | ajibawa-2023/Python-Code-Large/train/row_84864 | 144 | 268 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84864:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0037, 0.0037, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84864:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84864:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84864:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84864:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Co... |
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)
... | ajibawa-2023/Python-Code-Large/train/row_84865 | 42 | 49 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84865:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0204, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84865:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84865:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84865:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84865:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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... | ajibawa-2023/Python-Code-Large/train/row_84866 | 162 | 284 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84866:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0035, 0.0035, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84866:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84866:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84866:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84866:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Co... |
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:
... | ajibawa-2023/Python-Code-Large/train/row_84867 | 22 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84867:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84867:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84867:Return_L5_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84867:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84867:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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, ... | ajibawa-2023/Python-Code-Large/train/row_84868 | 73 | 141 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84868:Import_L1_C0", "label": "unittest import unittest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0071, 0.0071, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84868:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84868:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84868:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84868:Return_L9_C4"}, {"f": "ajibawa-2023/Python-Co... |
# 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,
#... | ajibawa-2023/Python-Code-Large/train/row_84869 | 129 | 336 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84869:Expr_L29_C0", "label": "expression", "type": "expression", "loc": [29, 37], "level": 0, "parent": null, "vector": [8, 0, 0.0982, 0.0268, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84869:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84869:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84869:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84869:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Co... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84870 | 53 | 128 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84870:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 35], "level": 0, "parent": null, "vector": [8, 0, 0.1406, 0.2734, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84870:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84870:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84870:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84870:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84871 | 15 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84871:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0732, 0.122, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84871:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84871:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84871:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84871:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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/... | ajibawa-2023/Python-Code-Large/train/row_84872 | 94 | 178 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84872:ImportFrom_L1_C0", "label": "from ctypes import byref, c_int", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0056, 0.0056, 0, 0.66, 0.0, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84872:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84872:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84872:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84872:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_84873 | 108 | 212 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84873:ImportFrom_L2_C0", "label": "from ctypes import c_double, byref", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0094, 0.0047, 0, 0.66, 0.0, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84873:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84873:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84873:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84873:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-... |
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... | ajibawa-2023/Python-Code-Large/train/row_84874 | 73 | 106 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84874:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0094, 0.0094, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84874:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84874:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84874:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84874:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84875 | 74 | 127 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84875:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0197, 0.0315, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84875:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84875:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84875:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84875:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84876 | 52 | 71 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84876:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0423, 0.0704, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84877 | 69 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84877:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.021, 0.0336, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84877:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84877:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84877:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84877:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code... |
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... | ajibawa-2023/Python-Code-Large/train/row_84878 | 39 | 72 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84878:ImportFrom_L1_C0", "label": "from ctypes import c_char_p, c_int, c_void_p\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0139, 0.0139, 0, 0.66, 0.0, 182, 0, 4, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84878:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84878:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84878:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84878:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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 ... | ajibawa-2023/Python-Code-Large/train/row_84879 | 45 | 85 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84879:ImportFrom_L1_C0", "label": "from django.contrib.gis.gdal.error import OGRException", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0118, 0.0118, 0, 0.66, 0.0, 76, 0, 1, 0, 0, 76, 0, 0], "semantic": {"name": "django.contrib.gis.gd... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84879:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84879:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84879:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84879:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
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()... | ajibawa-2023/Python-Code-Large/train/row_84880 | 12 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84880:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.1, 0.16, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84880:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84880:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84880:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84880:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_84881 | 65 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84881:ImportFrom_L2_C0", "label": "from django.contrib.gis.gdal.base import GDALBase", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0182, 0.0091, 0, 0.66, 0.0, 771, 0, 1, 0, 0, 771, 0, 0], "semantic": {"name": "django.contrib.gis.gdal.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84881:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84881:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84881:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84881:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84882 | 397 | 737 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84882:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 40], "level": 0, "parent": null, "vector": [8, 0, 0.0278, 0.0543, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84882:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84882:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84882:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84882:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-... |
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... | ajibawa-2023/Python-Code-Large/train/row_84883 | 60 | 104 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84883:Import_L1_C0", "label": "os import os, re, sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0096, 0.0096, 0, 0.66, 0.0, 688, 0, 3, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re", "sys"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84883:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84883:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84883:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84883:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
# 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
#
# ... | ajibawa-2023/Python-Code-Large/train/row_84884 | 32 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84884:ImportFrom_L2_C0", "label": "from ctypes import c_void_p", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0308, 0.0154, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84884:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84884:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84884:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84884:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
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)
... | ajibawa-2023/Python-Code-Large/train/row_84885 | 84 | 175 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84885:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0371, 0.0686, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84885:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84885:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84885:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84885:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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 ... | ajibawa-2023/Python-Code-Large/train/row_84886 | 16 | 35 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84886:ImportFrom_L1_C0", "label": "from ctypes import c_void_p", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0286, 0.0286, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84886:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84886:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84886:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84886:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""
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-... | ajibawa-2023/Python-Code-Large/train/row_84887 | 13 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84887:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 33], "level": 0, "parent": null, "vector": [8, 0, 0.3148, 0.6111, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84887:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84887:ImportFrom_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84887:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84887:ImportFrom_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84888 | 171 | 337 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84888:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 28], "level": 0, "parent": null, "vector": [8, 0, 0.043, 0.0831, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84888:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84888:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84888:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84888:FunctionDef_L46_C4"}, {"f": "ajibawa-2023/Python-Code-... |
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... | ajibawa-2023/Python-Code-Large/train/row_84889 | 73 | 124 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84889:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0081, 0.0081, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84889:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84889:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84889:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84889:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
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... | ajibawa-2023/Python-Code-Large/train/row_84890 | 54 | 107 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84890:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0093, 0.0093, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84890:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84890:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84890:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84890:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_84891 | 7 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84891:ImportFrom_L2_C0", "label": "from django.contrib.admin import autodiscover, site, AdminSite\u2026", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0833, 0, 0.66, 0.0, 703, 0, 8, 0, 0, 703, 0, 0], "semantic": {"name": "djang... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84891:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84891:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84891:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84891:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
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... | ajibawa-2023/Python-Code-Large/train/row_84892 | 95 | 152 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84892:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos.base import numpy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0066, 0.0066, 0, 0.66, 0.0, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "django.contrib.gis.geos.bas... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84892:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84892:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84892:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84892:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84893 | 6 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84893:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.125, 0.2, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84893:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84893:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84893:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84893:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84894 | 11 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84894:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.15, 0.25, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84894:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84894:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84894:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84894:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Co... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84895 | 73 | 123 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84895:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0203, 0.0325, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84895:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84895:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84895:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84895:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Cod... |
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.... | ajibawa-2023/Python-Code-Large/train/row_84896 | 75 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84896:ImportFrom_L1_C0", "label": "from ctypes import c_char_p, c_int, c_size_t\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0084, 0.0084, 0, 0.66, 0.0, 182, 0, 6, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84896:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84896:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84896:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84896:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code... |
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... | ajibawa-2023/Python-Code-Large/train/row_84897 | 163 | 242 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84897:Import_L1_C0", "label": "threading import threading", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0041, 0.0041, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["thread... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84897:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84897:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84897:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84897:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Co... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84898 | 53 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84898:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0316, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84898:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84898:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84898:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84898:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_84899 | 37 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84899:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.049, 0.0784, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84899:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84899:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84899:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84899:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code... |
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... | ajibawa-2023/Python-Code-Large/train/row_84900 | 48 | 86 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84900:Import_L1_C0", "label": "threading import threading", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0116, 0.0116, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["thread... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84900:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84900:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84900:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84900:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
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')... | ajibawa-2023/Python-Code-Large/train/row_84901 | 19 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84901:ImportFrom_L1_C0", "label": "from ctypes import c_char", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.04, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_char"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84901:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84901:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84901:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84901:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.