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 ctypes import c_double, c_int, c_uint, POINTER
from django.contrib.gis.geos.libgeos import GEOM_PTR, CS_PTR
from django.contrib.gis.geos.prototypes.errcheck import last_arg_byref, GEOSException
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
## Error-checking routines specific to coordinate seq... | ajibawa-2023/Python-Code-Large/train/row_84902 | 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_84902: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_84902:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84902:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84902:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84902: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
from django.contrib.gis.geos.prototypes.errcheck import check_dbl
from django.contrib.gis.geos.... | ajibawa-2023/Python-Code-Large/train/row_84903 | 15 | 28 | 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_84903:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0893, 0.1429, 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_84903:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84903:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84903:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84903:Assign_L16_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_setordinate, c... | ajibawa-2023/Python-Code-Large/train/row_84904 | 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_84904: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.contrib.gis... | ajibawa-2023/Python-Code-Large/train/row_84905 | 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_84905: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_84905:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84905:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84905:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84905: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 ListMixin(obj... | ajibawa-2023/Python-Code-Large/train/row_84906 | 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_84906: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_84906:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84906:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84906:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84906: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, Structur... | ajibawa-2023/Python-Code-Large/train/row_84907 | 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_84907: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_84907:Try_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84907:ImportFrom_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84907:Try_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84907:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
GEOS Testing module.
"""
from unittest import TestSuite, TextTestRunner
import test_geos, test_io, test_geos_mutation, test_mutable_list
test_suites = [
test_geos.suite(),
test_io.suite(),
test_geos_mutation.suite(),
test_mutable_list.suite(),
]
def suite():
"Builds a test suite for the GE... | ajibawa-2023/Python-Code-Large/train/row_84908 | 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_84908: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_84908:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84908:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84908:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84908: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 prototyp... | ajibawa-2023/Python-Code-Large/train/row_84909 | 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_84909: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_84909:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84909:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84909:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84909: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 the co... | ajibawa-2023/Python-Code-Large/train/row_84910 | 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_84910: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_84910:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84910:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84910:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84910: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.error impo... | ajibawa-2023/Python-Code-Large/train/row_84911 | 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_84911: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_84911:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84911:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84911:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84911: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 ImportErro... | ajibawa-2023/Python-Code-Large/train/row_84912 | 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_84912: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_84912:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84912:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84912:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84912: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 ListMixin
#... | ajibawa-2023/Python-Code-Large/train/row_84913 | 319 | 661 | 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_84913:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0038, 0.0061, 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_84913:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84913:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84913:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84913: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=None):
... | ajibawa-2023/Python-Code-Large/train/row_84914 | 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_84914: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_84914:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84914:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84914:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84914: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 LineStrin... | ajibawa-2023/Python-Code-Large/train/row_84915 | 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_84915: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):
file_h = ... | ajibawa-2023/Python-Code-Large/train/row_84916 | 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_84916: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_84916:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84916:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84916:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84916: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_name, row... | ajibawa-2023/Python-Code-Large/train/row_84917 | 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_84917: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_84917:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84917:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84917:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84917: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 the follow... | ajibawa-2023/Python-Code-Large/train/row_84919 | 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_84919: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_84919:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84919:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84919:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84919: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 is the bas... | ajibawa-2023/Python-Code-Large/train/row_84920 | 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_84920: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_84920:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84920:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84920:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84920: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_84921 | 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_84921: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 been m... | ajibawa-2023/Python-Code-Large/train/row_84922 | 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_84922: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_84922:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84922:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84922:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84922:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
from django.db import connections
from django.db.models.query import QuerySet, Q, ValuesQuerySet, ValuesListQuerySet
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField, LineStringField
from django.contrib.gis.db.models.sql import... | ajibawa-2023/Python-Code-Large/train/row_84923 | 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_84923: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_84923:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84923:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84923:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84923: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, Geometry... | ajibawa-2023/Python-Code-Large/train/row_84924 | 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_84924: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_84924:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84924:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84924:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84924: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, klass, field... | ajibawa-2023/Python-Code-Large/train/row_84925 | 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_84925: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_84925:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84925:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84925:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84925: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.contri... | ajibawa-2023/Python-Code-Large/train/row_84926 | 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_84926: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_84926:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84926:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84926:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84926: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):
def ... | ajibawa-2023/Python-Code-Large/train/row_84927 | 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_84927: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_84927:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84927:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84927:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84927: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
class AreaFiel... | ajibawa-2023/Python-Code-Large/train/row_84928 | 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_84928: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_84928:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84928:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84928:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84928: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)'
# Conversion ... | ajibawa-2023/Python-Code-Large/train/row_84929 | 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_84929: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_84929:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84929:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84929:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84929: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 GeoConstraint(Con... | ajibawa-2023/Python-Code-Large/train/row_84930 | 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_84930: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_84930:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84930:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84930:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84930: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_84931 | 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_84931: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(Aggregate):
nam... | ajibawa-2023/Python-Code-Large/train/row_84932 | 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_84932: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_84932:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84932:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84932:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84932: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.gis.db.mod... | ajibawa-2023/Python-Code-Large/train/row_84933 | 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_84933: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 selected
... | ajibawa-2023/Python-Code-Large/train/row_84934 | 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_84934: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_84934:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84934:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84934:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84934: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.
d... | ajibawa-2023/Python-Code-Large/train/row_84935 | 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_84935: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_84935:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84935:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84935:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84935: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.sql.co... | ajibawa-2023/Python-Code-Large/train/row_84936 | 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_84936: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_84936:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84936:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84936:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84936: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_84937 | 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_84937: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_84937:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84937:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84937:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84937: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.mysq... | ajibawa-2023/Python-Code-Large/train/row_84938 | 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_84938: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_84938:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84938:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84938:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84938: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 == other.srid... | ajibawa-2023/Python-Code-Large/train/row_84939 | 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_84939: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_84939:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84939:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84939:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84939: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_84940 | 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_84940: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_84940:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84940:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84940:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84940: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_84941 | 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_84941: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_84941:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84941:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84941:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84941: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_84942 | 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_84942: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_84942:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84942: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.CharField(ma... | ajibawa-2023/Python-Code-Large/train/row_84943 | 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_84943: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_84943:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84943:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84943:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84943: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 import G... | ajibawa-2023/Python-Code-Large/train/row_84944 | 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_84944: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_84944:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84944:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84944:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84944: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=False):
... | ajibawa-2023/Python-Code-Large/train/row_84945 | 46 | 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_84945: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_84945:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84945:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84945:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84945: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
# intro... | ajibawa-2023/Python-Code-Large/train/row_84947 | 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_84947: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_84947:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84947:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84947:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84947: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 pickling ... | ajibawa-2023/Python-Code-Large/train/row_84948 | 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_84948: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_84948:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84948:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84948:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84948: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. 4.2.2.
... | ajibawa-2023/Python-Code-Large/train/row_84949 | 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_84949: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_84949:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84949:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84949:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84949: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.contrib.gi... | ajibawa-2023/Python-Code-Large/train/row_84950 | 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_84950: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_84950:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84950:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84950:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84950: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 SQL for ... | ajibawa-2023/Python-Code-Large/train/row_84951 | 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_84951: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_84951:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84951:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84951:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84951: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 PostGISIntrospection
f... | ajibawa-2023/Python-Code-Large/train/row_84952 | 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_84952: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_84952:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84952:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84952:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84952: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, basestring):
... | ajibawa-2023/Python-Code-Large/train/row_84953 | 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_84953: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_84953:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84953:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84953:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84953: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):
def pla... | ajibawa-2023/Python-Code-Large/train/row_84956 | 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_84956: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_84956:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84956:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84956:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84956: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_84957 | 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_84957: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_84957:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84957: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 the `SDO_... | ajibawa-2023/Python-Code-Large/train/row_84958 | 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_84958: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_84958:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84958:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84958:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84958: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 to use... | ajibawa-2023/Python-Code-Large/train/row_84959 | 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_84959: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_84959:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84959:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84959:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84959: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.models.field... | ajibawa-2023/Python-Code-Large/train/row_84960 | 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_84960: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_84960:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84960:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84960:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84960: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.backen... | ajibawa-2023/Python-Code-Large/train/row_84961 | 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_84961: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_84961:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84961:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84961:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84961: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 from
... | ajibawa-2023/Python-Code-Large/train/row_84963 | 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_84963: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_84963:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84963:Try_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84963:Try_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84963: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):
"""
Returns the gi... | ajibawa-2023/Python-Code-Large/train/row_84964 | 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_84964: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_84964:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84964:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84964:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84964:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Co... |
r"""
>>> from django.conf import settings
>>> from django.contrib.sessions.backends.db import SessionStore as DatabaseSession
>>> from django.contrib.sessions.backends.cache import SessionStore as CacheSession
>>> from django.contrib.sessions.backends.cached_db import SessionStore as CacheDBSession
>>> from django.con... | ajibawa-2023/Python-Code-Large/train/row_84965 | 4 | 399 | 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_84965:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 395], "level": 0, "parent": null, "vector": [8, 0, 0.4962, 0.99, 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_84965:If_L397_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84965:Import_L398_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84965:If_L397_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84965:Expr_L399_C4"}] |
import time
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
from django.utils.importlib import import_module
class SessionMiddleware(object):
def process_request(self, request):
engine = import_module(settings.SESSION_ENGINE)
... | ajibawa-2023/Python-Code-Large/train/row_84966 | 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_84966: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_84966:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84966:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84966:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84966: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 impor... | ajibawa-2023/Python-Code-Large/train/row_84968 | 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_84968: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_84968:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84968:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84968:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84968: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_constructor
# Us... | ajibawa-2023/Python-Code-Large/train/row_84969 | 162 | 286 | 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_84969:Import_L1_C0", "label": "base64 import base64", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0035, 0.0035, 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_84969:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84969:Import_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84969:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84969: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, session_key=None)... | ajibawa-2023/Python-Code-Large/train/row_84970 | 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_84970: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_84970:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84970:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84970:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84970:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import cache
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
def __init__(self, session_key=None):
self._cache = cache
super(SessionStore, self).__init__(session_key)
... | ajibawa-2023/Python-Code-Large/train/row_84971 | 36 | 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_84971:ImportFrom_L1_C0", "label": "from django.contrib.sessions.backends.base import SessionBase, CreateError", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.0179, 0, 0.66, 0.0, 907, 0, 2, 0, 0, 907, 0, 0], "semantic": {"name": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84971:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84971:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84971:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84971:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.utils.translation import ungettext, ugettext as _
from django.utils.encoding import force_unicode
from django import template
from django.template import defaultfilters
from datetime import date
import re
register = template.Library()
def ordinal(value):
"""
Converts an integer to its ordinal as a... | ajibawa-2023/Python-Code-Large/train/row_84972 | 71 | 102 | 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_84972:ImportFrom_L1_C0", "label": "from django.utils.translation import ungettext, _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0098, 0.0098, 0, 0.66, 0.0, 389, 0, 2, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84972:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84972:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84972:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84972:Try_L15_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.conf.urls.defaults import *
from django.contrib.databrowse import views
# Note: The views in this URLconf all require a 'models' argument,
# which is a list of model classes (*not* instances).
urlpatterns = patterns('',
#(r'^$', views.homepage),
#(r'^([^/]+)/([^/]+)/$', views.model_detail),
(... | ajibawa-2023/Python-Code-Large/train/row_84973 | 3 | 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_84973:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names... | [] |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import force_unicode
from dja... | ajibawa-2023/Python-Code-Large/train/row_84974 | 52 | 86 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84974:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0116, 0.0116, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84974:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84974:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84974:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84974:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import smart_str, force_unico... | ajibawa-2023/Python-Code-Large/train/row_84975 | 48 | 74 | 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_84975:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0135, 0.0135, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84975:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84975:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84975:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84975:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-... |
from django import http
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
import urlparse
class ObjectDetailPlugin(DatabrowsePlugin):
def model_view(self, request, model_databrowse, url):
... | ajibawa-2023/Python-Code-Large/train/row_84976 | 12 | 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_84976:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84976:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84976:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84976:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84976:If_L10_C8"}, {"f": "ajibawa-2023/Python-Code-La... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.shortcuts import render_to_response
from django.utils.safestring import mark_safe
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
class DatabrowsePlugi... | ajibawa-2023/Python-Code-Large/train/row_84977 | 77 | 149 | 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_84977:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0067, 0.0067, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84977:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84977:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84977:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84977:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Co... |
from django.http import Http404
from django.shortcuts import render_to_response
###########
# CHOICES #
###########
def choice_list(request, app_label, module_name, field_name, models):
m, f = lookup_field(app_label, module_name, field_name, models)
return render_to_response('databrowse/choice_list.html', {'m... | ajibawa-2023/Python-Code-Large/train/row_84978 | 11 | 19 | 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_84978:ImportFrom_L1_C0", "label": "from django.http import Http404", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84978:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84978:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84978:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84978:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site
| ajibawa-2023/Python-Code-Large/train/row_84979 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84979:ImportFrom_L1_C0", "label": "from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 231, 0, 4, 0, 0, 231, 0, 0], "s... | [] |
"""
These classes are light wrappers around Django's database API that provide
convenience functionality and permalink functions for the databrowse app.
"""
from django.db import models
from django.utils import formats
from django.utils.text import capfirst
from django.utils.encoding import smart_unicode, smart_str, i... | ajibawa-2023/Python-Code-Large/train/row_84980 | 150 | 215 | 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_84980:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0116, 0.0186, 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_84980:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84980:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84980:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84980:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-... |
# -*- coding: utf-8 -*-
import unittest
from django.contrib.webdesign.lorem_ipsum import *
from django.template import loader, Context
class WebdesignTest(unittest.TestCase):
def test_words(self):
self.assertEqual(words(7), u'lorem ipsum dolor sit amet consectetur adipisicing')
def test_paragraphs... | ajibawa-2023/Python-Code-Large/train/row_84981 | 11 | 21 | 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_84981:Import_L3_C0", "label": "unittest import unittest", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0476, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84981:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84981:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84981:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84981:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Cod... |
"""
Utility functions for generating "lorem ipsum" Latin text.
"""
import random
COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo con... | ajibawa-2023/Python-Code-Large/train/row_84982 | 32 | 101 | 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_84982:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0198, 0.0297, 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_84982:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84982:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84982:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84982:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.contrib.webdesign.lorem_ipsum import words, paragraphs
from django import template
register = template.Library()
class LoremNode(template.Node):
def __init__(self, count, method, common):
self.count, self.method, self.common = count, method, common
def render(self, context):
try:
... | ajibawa-2023/Python-Code-Large/train/row_84983 | 33 | 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_84983:ImportFrom_L1_C0", "label": "from django.contrib.webdesign.lorem_ipsum import words, paragraphs", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 0, 0.66, 0.0, 74, 0, 2, 0, 0, 74, 0, 0], "semantic": {"name": "django.co... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84983:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84983:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84983:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84983:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
class ContentTypeManager(models.Manager):
# Cache to avoid re-looking up ContentType objects all over the place.
# This cache is shared by all the get_for_* methods.
_cache ... | ajibawa-2023/Python-Code-Large/train/row_84984 | 60 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84984:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0095, 0.0095, 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_84984:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84984:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84984:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84984:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django import db
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.contenttypes.views import shortcut
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from django.test... | ajibawa-2023/Python-Code-Large/train/row_84985 | 43 | 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_84985:ImportFrom_L1_C0", "label": "from django import db", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0141, 0.0141, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["db"], "r... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84985:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84985:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84985:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84985:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Classes allowing "generic" relations through ContentType and object-id fields.
"""
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import signals
from django.db import models, router
from django.db.models.fields.related import RelatedField, Field, ManyTo... | ajibawa-2023/Python-Code-Large/train/row_84986 | 232 | 415 | 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_84986:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0048, 0.0072, 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_84986:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84986:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84986:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84986:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django import http
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site, get_current_site
from django.core.exceptions import ObjectDoesNotExist
def shortcut(request, content_type_id, object_id):
"Redirect to an object's page based on a content-type ID and an ... | ajibawa-2023/Python-Code-Large/train/row_84987 | 35 | 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_84987:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0141, 0.0141, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84987:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84987:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84987:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84987:Try_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.contrib.contenttypes.models import ContentType
from django.db.models import get_apps, get_models, signals
from django.utils.encoding import smart_unicode
def update_contenttypes(app, created_models, verbosity=2, **kwargs):
"""
Creates content types for models in the given app, removing any model
... | ajibawa-2023/Python-Code-Large/train/row_84988 | 37 | 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_84988:ImportFrom_L1_C0", "label": "from django.contrib.contenttypes.models import ContentType", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0167, 0, 0.66, 0.0, 469, 0, 1, 0, 0, 469, 0, 0], "semantic": {"name": "django.contrib.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84988:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84988:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84988:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84988:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
""" models.py (even empty) currently required by the runtests.py to enable unit tests """
| ajibawa-2023/Python-Code-Large/train/row_84989 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84989:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
import unittest
from django import forms
from django.conf import settings
from django.contrib.formtools import preview, wizard, utils
from django import http
from django.test import TestCase
success_string = "Done was called!"
class TestFormPreview(preview.FormPreview):
def done(self, request, cleaned_data):
... | ajibawa-2023/Python-Code-Large/train/row_84990 | 149 | 269 | 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_84990:Import_L1_C0", "label": "unittest import unittest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0037, 0.0037, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84990:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84990:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84990:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84990:Return_L13_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Formtools Preview application.
"""
import cPickle as pickle
from django.conf import settings
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.utils.hashcompat import md5_constructor
from django.contrib.formtools.utils im... | ajibawa-2023/Python-Code-Large/train/row_84991 | 60 | 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_84991:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0157, 0.0236, 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_84991:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84991:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84991:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84991:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.utils.hashcompat import md5_constructor
from django.forms import BooleanField
def security_hash(request, form, *args):
"""
Calculates a security hash for the given Form instance.
This crea... | ajibawa-2023/Python-Code-Large/train/row_84992 | 20 | 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_84992:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0641, 0.1026, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "sni... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84992:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84992:Import_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84992:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84992:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
"""
FormWizard class -- implements a multi-page form, validating between each
step and storing the form's state as HTML hidden fields so that no state is
stored on the server side.
"""
import cPickle as pickle
from django import forms
from django.conf import settings
from django.http import Http404
from django.shortc... | ajibawa-2023/Python-Code-Large/train/row_84993 | 101 | 265 | 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_84993:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0113, 0.0189, 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_84993:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84993:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84993:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84993:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django.core.exceptions import MiddlewareNotUsed
from django.utils.http import http_date
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has a ETag or
Last-Modified header, and the request has If-None-Match or
If-Modified-Since, the response is replac... | ajibawa-2023/Python-Code-Large/train/row_84994 | 22 | 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_84994:ImportFrom_L1_C0", "label": "from django.core.exceptions import MiddlewareNotUsed", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 0, 0.66, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exception... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84994:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84994:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84994:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84994:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"this is the locale selecting middleware that will look at accept headers"
from django.utils.cache import patch_vary_headers
from django.utils import translation
class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what translation object to install in the... | ajibawa-2023/Python-Code-Large/train/row_84995 | 15 | 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_84995:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.04, 0.04, 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_84995:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84995:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84995:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84995:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accordingly, so that cac... | ajibawa-2023/Python-Code-Large/train/row_84996 | 23 | 38 | 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_84996:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0263, 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_84996:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84996:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84996:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84996:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.conf import settings
from django import http
class XViewMiddleware(object):
"""
Adds an X-View header to internal HEAD requests -- used by the documentation system.
"""
def process_view(self, request, view_func, view_args, view_kwargs):
"""
If the request method is HEAD and ... | ajibawa-2023/Python-Code-Large/train/row_84997 | 10 | 19 | 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_84997:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 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_84997:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84997:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84997:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84997:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import itertools
import re
import random
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils.cache import patch_vary... | ajibawa-2023/Python-Code-Large/train/row_84998 | 117 | 277 | 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_84998:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0126, 0.0217, 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_84998:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84998:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84998:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84998:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
from django.db import transaction
class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_on_response activated - that way a save() doesn't do a direct
commit, the commit is done when a successful response is created. If an
exc... | ajibawa-2023/Python-Code-Large/train/row_85000 | 19 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85000:ImportFrom_L1_C0", "label": "from django.db import transaction", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 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_85000:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85000:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85000:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85000:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE_CLASSES = [
'django.middleware.cache.UpdateCa... | ajibawa-2023/Python-Code-Large/train/row_85001 | 68 | 160 | 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_85001:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 49], "level": 0, "parent": null, "vector": [8, 0, 0.1562, 0.3063, 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_85001:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85001:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85001:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85001:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import re
from django.template import Node, Variable, VariableNode, _render_value_in_context
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.utils import translation
from django.utils.encoding import force_unicode
register = Library()... | ajibawa-2023/Python-Code-Large/train/row_85002 | 142 | 274 | 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_85002:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 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_85002:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85002:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85002:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85002:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-... |
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
from django.utils.http import urlquote
from django.utils.hashcompat import md5_constructor
regi... | ajibawa-2023/Python-Code-Large/train/row_85003 | 33 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85003:ImportFrom_L1_C0", "label": "from django.template import Library, Node, TemplateSyntaxError\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 213, 0, 5, 0, 0, 213, 0, 0], "semantic": {"name": "djang... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85003:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85003:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85003:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85003:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-... |
# This module is DEPRECATED!
#
# You should no longer be using django.template_loader.
#
# Use django.template.loader instead.
from django.template.loader import *
| ajibawa-2023/Python-Code-Large/train/row_85004 | 1 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85004:ImportFrom_L7_C0", "label": "from django.template.loader import *", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.1429, 0, 0.66, 0.0, 970, 0, 1, 0, 0, 970, 0, 0], "semantic": {"name": "django.template.loader", "arg_names": []... | [] |
"""
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
from StringIO import StringIO
import decimal
import yaml
from django.db import models
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as... | ajibawa-2023/Python-Code-Large/train/row_85005 | 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_85005:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0536, 0.0893, 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_85005:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85005:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85005:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85005:Return_L17_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.utils import datetime_safe
from django.utils import simpl... | ajibawa-2023/Python-Code-Large/train/row_85006 | 40 | 62 | 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_85006:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0323, 0.0484, 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_85006:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85006:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85006:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85006:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
XML serializer.
"""
from django.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.encoding import smart_unicode
from xml.dom import pulldom
class Serializer(base.Serializer):
"""
... | ajibawa-2023/Python-Code-Large/train/row_85007 | 161 | 297 | 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_85007:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0067, 0.0101, 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_85007:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85007:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85007:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85007:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from django.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS
from dj... | ajibawa-2023/Python-Code-Large/train/row_85008 | 80 | 142 | 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_85008:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0352, 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_85008:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85008:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85008:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85008:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.