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.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_len... | ajibawa-2023/Python-Code-Large/train/row_98692 | 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_98692: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_98692:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98692:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98692:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os, unittest
from django.contrib.gis.geos import *
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, postgis, spatialite, no_mysql, no_oracle, no_spatialite
from django.... | ajibawa-2023/Python-Code-Large/train/row_98693 | 181 | 307 | 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_98693:Import_L1_C0", "label": "os import os, unittest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0033, 0.0033, 0, 0.66, 0.0, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "unittest"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98693:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98693:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98693:Expr_L17_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] == bac... | ajibawa-2023/Python-Code-Large/train/row_98694 | 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_98694: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_98694:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:Return_L5_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98694:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98694:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import sys
from django.conf import settings
from django.db.models import get_app
from django.test.simple import build_suite, DjangoTestSuiteRunner
from django.utils import unittest
def run_tests(*args, **kwargs):
from django.test.simple import run_tests as base_run_tests
return base_run_tests(*args... | ajibawa-2023/Python-Code-Large/train/row_98695 | 60 | 109 | 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_98695:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0092, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98695:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98695:Return_L11_C4"}, {"f": "ajibawa-2023/Python-... |
# 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 not... | ajibawa-2023/Python-Code-Large/train/row_98696 | 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_98696: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_98696:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98696:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98696: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
TIG... | ajibawa-2023/Python-Code-Large/train/row_98697 | 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_98697: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_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98697:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98697: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(OGRExc... | ajibawa-2023/Python-Code-Large/train/row_98698 | 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_98698: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_98698:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98698:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98698:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98698: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.o... | ajibawa-2023/Python-Code-Large/train/row_98699 | 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_98699: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_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98699:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98699: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.... | ajibawa-2023/Python-Code-Large/train/row_98700 | 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_98700: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_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98700:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98700: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... | ajibawa-2023/Python-Code-Large/train/row_98701 | 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_98701: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_98701:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98701:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98701: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 ... | ajibawa-2023/Python-Code-Large/train/row_98702 | 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_98702: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_98702:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98702:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98702: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
fr... | ajibawa-2023/Python-Code-Large/train/row_98703 | 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_98703: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, c... | ajibawa-2023/Python-Code-Large/train/row_98704 | 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_98704: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_98704:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98704:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98704: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 k... | ajibawa-2023/Python-Code-Large/train/row_98705 | 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_98705: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_98705:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98705:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98705:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98705: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',
... | ajibawa-2023/Python-Code-Large/train/row_98706 | 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_98706: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_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98706:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98706: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 django.utils.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(),
... | ajibawa-2023/Python-Code-Large/train/row_98707 | 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_98707: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_98707:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98707:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98707:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98707: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.contr... | ajibawa-2023/Python-Code-Large/train/row_98708 | 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_98708: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_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98708:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98708: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 "pytho... | ajibawa-2023/Python-Code-Large/train/row_98709 | 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_98709: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_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98709:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98709: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)... | ajibawa-2023/Python-Code-Large/train/row_98710 | 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_98710: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_98710:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98710:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98710: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.ht... | ajibawa-2023/Python-Code-Large/train/row_98711 | 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_98711: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_98711:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98711:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98711:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98711: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_98712 | 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_98712: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_98712:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98712:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98712: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.
... | ajibawa-2023/Python-Code-Large/train/row_98713 | 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_98713: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_98713:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98713:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98713:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98713: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, suppor... | ajibawa-2023/Python-Code-Large/train/row_98714 | 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_98714: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_98714:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98714:ImportFrom_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98714:Try_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98714: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,
... | ajibawa-2023/Python-Code-Large/train/row_98715 | 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_98715: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_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98715:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98715: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 G... | ajibawa-2023/Python-Code-Large/train/row_98716 | 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_98716: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_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98716:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98716: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... | ajibawa-2023/Python-Code-Large/train/row_98717 | 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_98717: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_98717:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98717:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98717:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98717: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.c... | ajibawa-2023/Python-Code-Large/train/row_98718 | 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_98718: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_98718:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98718:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98718:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98718: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 a... | ajibawa-2023/Python-Code-Large/train/row_98719 | 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_98719: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_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98719:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98719: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 inval... | ajibawa-2023/Python-Code-Large/train/row_98720 | 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_98720: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_98720:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98720:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98720:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98720: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, WKBWrit... | ajibawa-2023/Python-Code-Large/train/row_98721 | 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_98721: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_98721:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98721:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98721: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.con... | ajibawa-2023/Python-Code-Large/train/row_98722 | 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_98722: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_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98722:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98722: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.... | ajibawa-2023/Python-Code-Large/train/row_98723 | 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_98723: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_98723:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98723:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98723: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.co... | ajibawa-2023/Python-Code-Large/train/row_98724 | 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_98724: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_98724:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98724:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98724: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
# Ge... | ajibawa-2023/Python-Code-Large/train/row_98725 | 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_98725: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_98725:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98725:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98725: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', 'ge... | ajibawa-2023/Python-Code-Large/train/row_98726 | 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_98726: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_98726:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98726:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98726: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... | ajibawa-2023/Python-Code-Large/train/row_98727 | 50 | 90 | 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_98727:Import_L1_C0", "label": "threading import threading", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0111, 0.0111, 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_98727:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98727:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98727: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('GEOSPre... | ajibawa-2023/Python-Code-Large/train/row_98728 | 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_98728: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_98728:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98728:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98728:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Co... |
from ctypes import c_double, c_int, c_uint, POINTER
from django.contrib.gis.geos.libgeos import GEOM_PTR, CS_PTR
from django.contrib.gis.geos.prototypes.errcheck import last_arg_byref, GEOSException
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
## Error-checking routines specific to coordinat... | ajibawa-2023/Python-Code-Large/train/row_98729 | 53 | 83 | 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_98729:ImportFrom_L1_C0", "label": "from ctypes import c_double, c_int, c_uint\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.012, 0.012, 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_98729:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98729:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98729:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
This module is for the miscellaneous GEOS routines, particularly the
ones that return the area, distance, and length.
"""
from ctypes import c_int, c_double, POINTER
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE
from django.contrib.gis.geos.prototypes.errcheck import check_dbl, check_st... | ajibawa-2023/Python-Code-Large/train/row_98730 | 23 | 39 | 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_98730:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0641, 0.1026, 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_98730:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98730:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98730:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
This module contains all of the GEOS ctypes function prototypes. Each
prototype handles the interaction between the GEOS library and Python
via ctypes.
"""
# Coordinate sequence routines.
from django.contrib.gis.geos.prototypes.coordseq import create_cs, get_cs, \
cs_clone, cs_getordinate, cs_setord... | ajibawa-2023/Python-Code-Large/train/row_98731 | 6 | 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_98731:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1, 0.1667, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation... | [] |
"""
This module houses the GEOS ctypes prototype functions for the
unary and binary predicate operations on geometries.
"""
from ctypes import c_char, c_char_p, c_double
from django.contrib.gis.geos.libgeos import GEOM_PTR
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
from django.cont... | ajibawa-2023/Python-Code-Large/train/row_98732 | 34 | 44 | 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_98732:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0568, 0.0909, 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_98732:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98732:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98732:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code... |
# Copyright (c) 2008-2009 Aryeh Leib Taurog, all rights reserved.
# Released under the New BSD license.
"""
This module contains a base type which provides list-style mutations
without specific data storage methods.
See also http://www.aryehleib.com/MutableLists.html
Author: Aryeh Leib Taurog.
"""
class Lis... | ajibawa-2023/Python-Code-Large/train/row_98733 | 171 | 309 | 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_98733:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 10], "level": 0, "parent": null, "vector": [8, 0, 0.021, 0.0259, 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_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98733:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98733:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
This module houses the ctypes initialization procedures, as well
as the notice and error handler function callbacks (get called
when an error occurs in GEOS).
This module also houses GEOS Pointer utilities, including
get_pointer_arr(), and GEOM_PTR.
"""
import os, re, sys
from ctypes import c_char_p,... | ajibawa-2023/Python-Code-Large/train/row_98734 | 69 | 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_98734:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0319, 0.0567, 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_98734:Try_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:ImportFrom_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98734:Try_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98734:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
GEOS Testing module.
"""
from django.utils.unittest import TestSuite, TextTestRunner
import test_geos, test_io, test_geos_mutation, test_mutable_list
test_suites = [
test_geos.suite(),
test_io.suite(),
test_geos_mutation.suite(),
test_mutable_list.suite(),
]
def suite():
"Bui... | ajibawa-2023/Python-Code-Large/train/row_98735 | 14 | 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_98735: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_98735:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98735:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98735:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98735:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code... |
from ctypes import c_uint, byref
from django.contrib.gis.geos.error import GEOSIndexError
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR
from django.contrib.gis.geos.linestring import LinearRing
from django.contrib.gis.geos import pro... | ajibawa-2023/Python-Code-Large/train/row_98736 | 95 | 166 | 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_98736:ImportFrom_L1_C0", "label": "from ctypes import c_uint, byref", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.006, 0.006, 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_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98736:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98736:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.prototypes import prepared as capi
class PreparedGeometry(GEOSBase):
"""
A geometry that is prepared for performing certain operations.
At the moment this includes... | ajibawa-2023/Python-Code-Large/train/row_98737 | 20 | 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_98737:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos.base import GEOSBase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0333, 0.0333, 0, 0.66, 0.0, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "django.contrib.gis.geos.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98737:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98737:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""
This module houses the GEOSCoordSeq object, which is used internally
by GEOSGeometry to house the actual coordinates of the Point,
LineString, and LinearRing geometries.
"""
from ctypes import c_double, c_uint, byref
from django.contrib.gis.geos.base import GEOSBase, numpy
from django.contrib.gis.geos.err... | ajibawa-2023/Python-Code-Large/train/row_98738 | 103 | 156 | 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_98738:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0192, 0.0321, 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_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98738:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98738:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from ctypes import c_void_p
from types import NoneType
from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
# Trying to import GDAL libraries, if available. Have to place in
# try/except since this package may be used outside GeoDjango.
try:
from django.contrib.gis import gdal
except Im... | ajibawa-2023/Python-Code-Large/train/row_98739 | 23 | 52 | 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_98739:ImportFrom_L1_C0", "label": "from ctypes import c_void_p", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0192, 0.0192, 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_98739:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98739:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98739:ClassDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
"""
This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
inherit from this object.
"""
# Python, ctypes and types dependencies.
import re
from ctypes import addressof, byref, c_double, c_size_t
# super-class for mutable list behavior
from django.contrib.gis.geos.mutable_list import Lis... | ajibawa-2023/Python-Code-Large/train/row_98740 | 323 | 670 | 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_98740:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0037, 0.006, 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_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98740:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98740:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from ctypes import c_uint
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos import prototypes as capi
class Point(GEOSGeometry):
_minlength = 2
_maxlength = 3
def __init__(self, x, y=None, z=None, srid=No... | ajibawa-2023/Python-Code-Large/train/row_98741 | 89 | 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_98741:ImportFrom_L1_C0", "label": "from ctypes import c_uint", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["c_ui... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98741:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98741:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
The GeoDjango GEOS module. Please consult the GeoDjango documentation
for more details:
http://geodjango.org/docs/geos.html
"""
from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex
from django.contrib.gis.geos.point import Point
from django.contrib.gis.geos.linestring import Li... | ajibawa-2023/Python-Code-Large/train/row_98742 | 10 | 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_98742:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.2143, 0.3571, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex
def fromfile(file_h):
"""
Given a string file name, returns a GEOSGeometry. The file may contain WKB,
WKT, or HEX.
"""
# If given a file name, get a real handle.
if isinstance(file_h, basestring):
... | ajibawa-2023/Python-Code-Large/train/row_98743 | 12 | 23 | 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_98743:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 0, 0.66, 0.0, 843, 0, 3, 0, 0, 843, 0, 0], "semantic": {"na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98743:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98743:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from optparse import make_option
from django.core.management.base import CommandError
from django.core.management.commands.inspectdb import Command as InspectDBCommand
class Command(InspectDBCommand):
db_module = 'django.contrib.gis.db'
gis_tables = {}
def get_field_type(self, connection, table_... | ajibawa-2023/Python-Code-Large/train/row_98744 | 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_98744:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98744:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98744:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.core.management.base import BaseCommand, CommandError
class ArgsCommand(BaseCommand):
"""
Command class for commands that take multiple arguments.
"""
args = '<arg arg ...>'
def handle(self, *args, **options):
if not args:
raise CommandError('Must provide ... | ajibawa-2023/Python-Code-Large/train/row_98746 | 8 | 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_98746:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand, CommandError", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 931, 0, 2, 0, 0, 931, 0, 0], "semantic": {"name": "django.c... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98746:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98746:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98746:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django import forms
from django.utils.translation import ugettext_lazy as _
# While this couples the geographic forms to the GEOS library,
# it decouples from database (by not importing SpatialBackend).
from django.contrib.gis.geos import GEOSGeometry
class GeometryField(forms.Field):
"""
This i... | ajibawa-2023/Python-Code-Large/train/row_98747 | 27 | 67 | 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_98747:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 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_98747:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98747:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98747:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
from django.forms import *
from django.contrib.gis.forms.fields import GeometryField
| ajibawa-2023/Python-Code-Large/train/row_98748 | 2 | 2 | 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_98748:ImportFrom_L1_C0", "label": "from django.forms import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 666, 0, 1, 0, 0, 666, 0, 0], "semantic": {"name": "django.forms", "arg_names": [], "import_names": ["*"]... | [] |
from django.db import connection
if hasattr(connection.ops, 'spatial_version'):
from warnings import warn
warn('The `django.contrib.gis.db.backend` module was refactored and '
'renamed to `django.contrib.gis.db.backends` in 1.2. '
'All functionality of `SpatialBackend` '
'has... | ajibawa-2023/Python-Code-Large/train/row_98749 | 5 | 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_98749:ImportFrom_L1_C0", "label": "from django.db import connection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 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_98749:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98749:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98749:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98749:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_9... |
from django.db import connections
from django.db.models.query import QuerySet, Q, ValuesQuerySet, ValuesListQuerySet
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField, LineStringField
from django.contrib.gis.db.models.sql i... | ajibawa-2023/Python-Code-Large/train/row_98750 | 338 | 777 | 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_98750:ImportFrom_L1_C0", "label": "from django.db import connections", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0013, 0.0013, 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_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98750:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98750:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.db.models.fields import Field
from django.db.models.sql.expressions import SQLEvaluator
from django.utils.translation import ugettext_lazy as _
from django.contrib.gis import forms
from django.contrib.gis.db.models.proxy import GeometryProxy
from django.contrib.gis.geometry.backend import Geometry, Geo... | ajibawa-2023/Python-Code-Large/train/row_98751 | 135 | 294 | 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_98751:ImportFrom_L1_C0", "label": "from django.db.models.fields import Field", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0034, 0.0034, 0, 0.66, 0.0, 5, 0, 1, 0, 0, 5, 0, 0], "semantic": {"name": "django.db.models.fields", "arg_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98751:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98751:Try_L21_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""
The GeometryProxy object, allows for lazy-geometries. The proxy uses
Python descriptors for instantiating and setting Geometry objects
corresponding to geographic model fields.
Thanks to Robert Coup for providing this functionality (see #4322).
"""
class GeometryProxy(object):
def __init__(self, kla... | ajibawa-2023/Python-Code-Large/train/row_98752 | 27 | 64 | 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_98752:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0625, 0.1094, 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_98752:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98752:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98752:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from django.db import connections
from django.db.models.query import sql
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql import aggregates as gis_aggregates
from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField
from django.... | ajibawa-2023/Python-Code-Large/train/row_98753 | 62 | 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_98753:ImportFrom_L1_C0", "label": "from django.db import connections", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0084, 0.0084, 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_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98753:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98753:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from itertools import izip
from django.db.backends.util import truncate_name
from django.db.models.sql import compiler
from django.db.models.sql.constants import TABLE_NAME
from django.db.models.sql.query import get_proxied_model
SQLCompiler = compiler.SQLCompiler
class GeoSQLCompiler(compiler.SQLCompiler):
... | ajibawa-2023/Python-Code-Large/train/row_98754 | 143 | 278 | 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_98754:ImportFrom_L1_C0", "label": "from itertools import izip", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 0, 0.66, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "itertools", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98754:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98754:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98754:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Cod... |
"""
This module holds simple classes used by GeoQuery.convert_values
to convert geospatial values from the database.
"""
class BaseField(object):
empty_strings_allowed = True
def get_internal_type(self):
"Overloaded method so OracleQuery.convert_values doesn't balk."
return None
cla... | ajibawa-2023/Python-Code-Large/train/row_98755 | 16 | 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_98755:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0926, 0.1481, 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_98755:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98755:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98755:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.db.models.sql.aggregates import *
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.models.sql.conversion import GeomField
class GeoAggregate(Aggregate):
# Default SQL template for spatial aggregates.
sql_template = '%(function)s(%(field)s)'
# Con... | ajibawa-2023/Python-Code-Large/train/row_98756 | 31 | 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_98756:ImportFrom_L1_C0", "label": "from django.db.models.sql.aggregates import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0164, 0.0164, 0, 0.66, 0.0, 101, 0, 1, 0, 0, 101, 0, 0], "semantic": {"name": "django.db.models.sql.aggrega... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98756:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98756:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.db.models.fields import Field, FieldDoesNotExist
from django.db.models.sql.constants import LOOKUP_SEP
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.sql.where import Constraint, WhereNode
from django.contrib.gis.db.models.fields import GeometryField
class GeoConstrai... | ajibawa-2023/Python-Code-Large/train/row_98757 | 48 | 89 | 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_98757:ImportFrom_L1_C0", "label": "from django.db.models.fields import Field, FieldDoesNotExist", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0112, 0.0112, 0, 0.66, 0.0, 5, 0, 2, 0, 0, 5, 0, 0], "semantic": {"name": "django.db.models.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98757:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98757:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField
from django.contrib.gis.db.models.sql.query import GeoQuery
from django.contrib.gis.db.models.sql.where import GeoWhereNode
| ajibawa-2023/Python-Code-Large/train/row_98758 | 3 | 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_98758:ImportFrom_L1_C0", "label": "from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField, GeomField", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 100, 0, 3, 0, 0, 100, 0, 0], "sem... | [] |
from django.db.models import Aggregate
from django.contrib.gis.db.models.sql import GeomField
class Collect(Aggregate):
name = 'Collect'
class Extent(Aggregate):
name = 'Extent'
class Extent3D(Aggregate):
name = 'Extent3D'
class MakeLine(Aggregate):
name = 'MakeLine'
class Union(Aggr... | ajibawa-2023/Python-Code-Large/train/row_98759 | 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_98759:ImportFrom_L1_C0", "label": "from django.db.models import Aggregate", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 680, 0, 1, 0, 0, 680, 0, 0], "semantic": {"name": "django.db.models", "arg_names": [],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98759:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98759:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
# Want to get everything from the 'normal' models package.
from django.db.models import *
# Geographic aggregate functions
from django.contrib.gis.db.models.aggregates import *
# The GeoManager
from django.contrib.gis.db.models.manager import GeoManager
# The geographic-enabled fields.
from django.contrib.... | ajibawa-2023/Python-Code-Large/train/row_98760 | 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_98760:ImportFrom_L2_C0", "label": "from django.db.models import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.0, 680, 0, 1, 0, 0, 680, 0, 0], "semantic": {"name": "django.db.models", "arg_names": [], "import... | [] |
from django.db.models.manager import Manager
from django.contrib.gis.db.models.query import GeoQuerySet
class GeoManager(Manager):
"Overrides Manager to return Geographic QuerySets."
# This manager should be used for queries on related fields
# so that geometry columns on Oracle and MySQL are selec... | ajibawa-2023/Python-Code-Large/train/row_98761 | 67 | 103 | 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_98761:ImportFrom_L1_C0", "label": "from django.db.models.manager import Manager", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0097, 0.0097, 0, 0.66, 0.0, 59, 0, 1, 0, 0, 59, 0, 0], "semantic": {"name": "django.db.models.manager", "arg... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98761:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98761:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
from MySQLdb.constants import FIELD_TYPE
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.mysql.introspection import DatabaseIntrospection
class MySQLIntrospection(DatabaseIntrospection):
# Updating the data_types_reverse dictionary with the appropriate
# type for Geometry fields... | ajibawa-2023/Python-Code-Large/train/row_98762 | 16 | 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_98762:ImportFrom_L1_C0", "label": "from MySQLdb.constants import FIELD_TYPE", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 412, 0, 1, 0, 0, 412, 0, 0], "semantic": {"name": "MySQLdb.constants", "arg_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98762:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98762:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98762:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.db.backends.mysql.base import DatabaseOperations
from django.contrib.gis.db.backends.adapter import WKTAdapter
from django.contrib.gis.db.backends.base import BaseSpatialOperations
class MySQLOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = 'django.contrib.gis.db.models... | ajibawa-2023/Python-Code-Large/train/row_98763 | 30 | 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_98763:ImportFrom_L1_C0", "label": "from django.db.backends.mysql.base import DatabaseOperations", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0154, 0.0154, 0, 0.66, 0.0, 150, 0, 1, 0, 0, 150, 0, 0], "semantic": {"name": "django.db.bac... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98763:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98763:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.db.backends.mysql.creation import DatabaseCreation
class MySQLCreation(DatabaseCreation):
def sql_indexes_for_field(self, model, f, style):
from django.contrib.gis.db.models.fields import GeometryField
output = super(MySQLCreation, self).sql_indexes_for_field(model, f, style)
... | ajibawa-2023/Python-Code-Large/train/row_98764 | 11 | 18 | 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_98764:ImportFrom_L1_C0", "label": "from django.db.backends.mysql.creation import DatabaseCreation", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 326, 0, 1, 0, 0, 326, 0, 0], "semantic": {"name": "django.db.b... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98764:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98764:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98764:ImportFrom_L6_C8"}, {"f": "ajibawa-2023/Python-... |
from django.db.backends.mysql.base import *
from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper
from django.contrib.gis.db.backends.mysql.creation import MySQLCreation
from django.contrib.gis.db.backends.mysql.introspection import MySQLIntrospection
from django.contrib.gis.db.backends.... | ajibawa-2023/Python-Code-Large/train/row_98765 | 11 | 13 | 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_98765:ImportFrom_L1_C0", "label": "from django.db.backends.mysql.base import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 150, 0, 1, 0, 0, 150, 0, 0], "semantic": {"name": "django.db.backends.mysql.base"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98765:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98765:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98765:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-... |
class WKTAdapter(object):
"""
This provides an adaptor for Geometries sent to the
MySQL and Oracle database backends.
"""
def __init__(self, geom):
self.wkt = geom.wkt
self.srid = geom.srid
def __eq__(self, other):
return self.wkt == other.wkt and self.srid == ... | ajibawa-2023/Python-Code-Large/train/row_98766 | 11 | 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_98766:ClassDef_L1_C0", "label": "WKTAdapter", "type": "class", "loc": [1, 17], "level": 0, "parent": null, "vector": [3, 0, 0.5294, 1.0, 0, 0.66, 0.0, 868, 0, 4, 0, 0, 186, 0, 0], "semantic": {"name": "WKTAdapter", "arg_names": [], "import_names": [], "rhs_call_name": "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98766:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98766:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict
class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict):
"""
Sublcass that includes updates the `base_data_types_reverse` dict
for geometry field types... | ajibawa-2023/Python-Code-Large/train/row_98767 | 24 | 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_98767:ImportFrom_L1_C0", "label": "from django.contrib.gis.gdal import OGRGeomType", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 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_98767:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98767:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98767:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.db.backends.sqlite3.base import Database
from django.contrib.gis.db.backends.adapter import WKTAdapter
class SpatiaLiteAdapter(WKTAdapter):
"SQLite adaptor for geometry objects."
def __conform__(self, protocol):
if protocol is Database.PrepareProtocol:
return str(self)
| ajibawa-2023/Python-Code-Large/train/row_98768 | 7 | 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_98768:ImportFrom_L1_C0", "label": "from django.db.backends.sqlite3.base import Database", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 460, 0, 1, 0, 0, 460, 0, 0], "semantic": {"name": "django.db.backends.sqli... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98768:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98768:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98768:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98768:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.db.backends.sqlite3.client import DatabaseClient
class SpatiaLiteClient(DatabaseClient):
executable_name = 'spatialite'
| ajibawa-2023/Python-Code-Large/train/row_98769 | 3 | 5 | 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_98769:ImportFrom_L1_C0", "label": "from django.db.backends.sqlite3.client import DatabaseClient", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "django.db.backends.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98769:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98769:Assign_L4_C4"}] |
"""
The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from SpatiaLite.
"""
f_table_name = models.Ch... | ajibawa-2023/Python-Code-Large/train/row_98770 | 35 | 60 | 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_98770:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0333, 0.05, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98770:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98770:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
import re
from decimal import Decimal
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter
from django.contrib.gis.geometry.backend im... | ajibawa-2023/Python-Code-Large/train/row_98771 | 183 | 342 | 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_98771:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0029, 0.0029, 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_98771:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98771:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98771:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django.db.backends.sqlite3.creation import DatabaseCreation
class SpatiaLiteCreation(DatabaseCreation):
def create_test_db(self, verbosity=1, autoclobber=... | ajibawa-2023/Python-Code-Large/train/row_98772 | 45 | 96 | 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_98772:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0104, 0.0104, 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_98772:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98772:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98772:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-... |
from django.db.backends.postgresql_psycopg2.introspection import DatabaseIntrospection
from django.contrib.gis.gdal import OGRGeomType
class GeoIntrospectionError(Exception):
pass
class PostGISIntrospection(DatabaseIntrospection):
# Reverse dictionary for PostGIS geometry types not populated until
... | ajibawa-2023/Python-Code-Large/train/row_98774 | 46 | 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_98774:ImportFrom_L1_C0", "label": "from django.db.backends.postgresql_psycopg2.introspection import DatabaseIntrospection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0105, 0.0105, 0, 0.66, 0.0, 862, 0, 1, 0, 0, 862, 0, 0], "semantic... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98774:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98774:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
"""
from psycopg2 import Binary
from psycopg2.extensions import ISQLQuote
class PostGISAdapter(object):
def __init__(self, geom):
"Initializes on the geometry."
# Getting the WKB (in string form, to allow easy... | ajibawa-2023/Python-Code-Large/train/row_98775 | 20 | 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_98775:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0571, 0.0857, 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_98775:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98775:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98775:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-... |
"""
The GeometryColumns and SpatialRefSys models for the PostGIS backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from the PostGIS. See the PostGIS
documentation at Ch... | ajibawa-2023/Python-Code-Large/train/row_98776 | 37 | 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_98776:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0303, 0.0455, 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_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98776:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98776:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
import re
from decimal import Decimal
from django.conf import settings
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter
from django.con... | ajibawa-2023/Python-Code-Large/train/row_98777 | 290 | 588 | 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_98777:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0017, 0.0017, 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_98777:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98777:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98777:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf import settings
from django.db.backends.postgresql.creation import DatabaseCreation
class PostGISCreation(DatabaseCreation):
geom_index_type = 'GIST'
geom_index_opts = 'GIST_GEOMETRY_OPS'
def sql_indexes_for_field(self, model, f, style):
"Return any spatial index creation ... | ajibawa-2023/Python-Code-Large/train/row_98778 | 26 | 60 | 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_98778:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0167, 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_98778:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98778:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98778:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.db.backends.postgresql_psycopg2.base import *
from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper as Psycopg2DatabaseWrapper
from django.contrib.gis.db.backends.postgis.creation import PostGISCreation
from django.contrib.gis.db.backends.postgis.introspection import PostGISIntrospectio... | ajibawa-2023/Python-Code-Large/train/row_98779 | 11 | 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_98779:ImportFrom_L1_C0", "label": "from django.db.backends.postgresql_psycopg2.base import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 485, 0, 1, 0, 0, 485, 0, 0], "semantic": {"name": "django.db.backen... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98779:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98779:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98779:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
A collection of utility routines and classes used by the spatial
backends.
"""
def gqn(val):
"""
The geographic quote name function; used for quoting tables and
geometries (they use single rather than the double quotes of the
backend quotename function).
"""
if isinstance(val, ba... | ajibawa-2023/Python-Code-Large/train/row_98780 | 29 | 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_98780:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0446, 0.0714, 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_98780:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98780:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98780:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler
from django.db.backends.oracle import compiler
SQLCompiler = compiler.SQLCompiler
class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):
pass
class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler):
... | ajibawa-2023/Python-Code-Large/train/row_98783 | 21 | 44 | 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_98783:ImportFrom_L1_C0", "label": "from django.contrib.gis.db.models.sql.compiler import BaseGeoSQLCompiler", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0227, 0, 0.66, 0.0, 973, 0, 1, 0, 0, 973, 0, 0], "semantic": {"name": "d... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98783:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98783:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98783:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-... |
from cx_Oracle import CLOB
from django.contrib.gis.db.backends.adapter import WKTAdapter
class OracleSpatialAdapter(WKTAdapter):
input_size = CLOB
| ajibawa-2023/Python-Code-Large/train/row_98784 | 4 | 5 | 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_98784:ImportFrom_L1_C0", "label": "from cx_Oracle import CLOB", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 554, 0, 1, 0, 0, 554, 0, 0], "semantic": {"name": "cx_Oracle", "arg_names": [], "import_names": ["CLOB"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98784:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98784:Assign_L5_C4"}] |
"""
The GeometryColumns and SpatialRefSys models for the Oracle spatial
backend.
It should be noted that Oracle Spatial does not have database tables
named according to the OGC standard, so the closest analogs are used.
For example, the `USER_SDO_GEOM_METADATA` is used for the GeometryColumns
model and th... | ajibawa-2023/Python-Code-Large/train/row_98785 | 36 | 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_98785:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0769, 0.1385, 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_98785:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98785:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98785:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
This module contains the spatial lookup types, and the `get_geo_where_clause`
routine for Oracle Spatial.
Please note that WKT support is broken on the XE version, and thus
this backend will not work on such platforms. Specifically, XE lacks
support for an internal JVM, and Java libraries are required ... | ajibawa-2023/Python-Code-Large/train/row_98786 | 158 | 293 | 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_98786:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0171, 0.0307, 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_98786:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98786:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98786:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.db.backends.oracle.creation import DatabaseCreation
from django.db.backends.util import truncate_name
class OracleCreation(DatabaseCreation):
def sql_indexes_for_field(self, model, f, style):
"Return any spatial index creation SQL for the field."
from django.contrib.gis.db.model... | ajibawa-2023/Python-Code-Large/train/row_98787 | 16 | 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_98787:ImportFrom_L1_C0", "label": "from django.db.backends.oracle.creation import DatabaseCreation", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 513, 0, 1, 0, 0, 513, 0, 0], "semantic": {"name": "django.db.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98787:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98787:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98787:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.db.backends.oracle.base import *
from django.db.backends.oracle.base import DatabaseWrapper as OracleDatabaseWrapper
from django.contrib.gis.db.backends.oracle.creation import OracleCreation
from django.contrib.gis.db.backends.oracle.introspection import OracleIntrospection
from django.contrib.gis.db.ba... | ajibawa-2023/Python-Code-Large/train/row_98788 | 11 | 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_98788:ImportFrom_L1_C0", "label": "from django.db.backends.oracle.base import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 759, 0, 1, 0, 0, 759, 0, 0], "semantic": {"name": "django.db.backends.oracle.bas... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98788:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98788:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98788:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
Set of "markup" template filters for Django. These filters transform plain text
markup syntaxes to HTML; currently there is support for:
* Textile, which requires the PyTextile library available at
http://loopcore.com/python-textile/
* Markdown, which requires the Python-markdown library fro... | ajibawa-2023/Python-Code-Large/train/row_98790 | 42 | 91 | 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_98790:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0714, 0.1319, 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_98790:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98790:Try_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98790:Import_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
import base64
import cPickle as pickle
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.utils.hashcompat import md5_constructor
class SessionManager(models.Manager):
def encode(self, session_dict):
"""
Re... | ajibawa-2023/Python-Code-Large/train/row_98791 | 36 | 67 | 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_98791:Import_L1_C0", "label": "base64 import base64", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 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_98791:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98791:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98791:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Co... |
import base64
from datetime import datetime, timedelta
import pickle
import shutil
import tempfile
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DatabaseSession
from django.contrib.sessions.backends.cache import SessionStore as CacheSession
from django.contri... | ajibawa-2023/Python-Code-Large/train/row_98792 | 207 | 295 | 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_98792:Import_L1_C0", "label": "base64 import base64", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0034, 0.0034, 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_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98792:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98792:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Cod... |
import time
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
from django.utils.importlib import import_module
class SessionMiddleware(object):
def process_request(self, request):
engine = import_module(settings.SESSION_EN... | ajibawa-2023/Python-Code-Large/train/row_98793 | 27 | 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_98793:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98793:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98793:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98793:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Cod... |
import datetime
from django.conf import settings
from django.contrib.sessions.models import Session
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.exceptions import SuspiciousOperation
from django.db import IntegrityError, transaction, router
from django.utils.encoding... | ajibawa-2023/Python-Code-Large/train/row_98795 | 46 | 78 | 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_98795:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0128, 0.0128, 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_98795:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98795:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98795:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import base64
import os
import random
import sys
import time
from datetime import datetime, timedelta
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.utils.hashcompat import md5_cons... | ajibawa-2023/Python-Code-Large/train/row_98796 | 174 | 309 | 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_98796:Import_L1_C0", "label": "base64 import base64", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0032, 0.0032, 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_98796:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98796:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98796:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
"""
Cached, database-backed sessions.
"""
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DBStore
from django.core.cache import cache
class SessionStore(DBStore):
"""
Implements cached, database backed sessions.
"""
def __init__(self, sess... | ajibawa-2023/Python-Code-Large/train/row_98797 | 27 | 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_98797:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0476, 0.0714, 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_98797:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98797:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98797:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.