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 |
|---|---|---|---|---|---|---|---|
"""
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).
"""
from django.contrib.gis import memoryview
from django.utils impor... | ajibawa-2023/Python-Code-Large/train/row_83172 | 29 | 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_83172:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0606, 0.1061, 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_83172:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83172:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83172:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83172:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Co... |
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_83173 | 64 | 121 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83173:ImportFrom_L1_C0", "label": "from django.db import connections", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0083, 0.0083, 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_83173:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83173:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83173:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83173:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
try:
from itertools import zip_longest
except ImportError:
from itertools import izip_longest as zip_longest
from django.utils.six.moves import zip
from django.db.backends.util import truncate_name, typecast_timestamp
from django.db.models.sql import compiler
from django.db.models.sql.constants import MULTI
f... | ajibawa-2023/Python-Code-Large/train/row_83174 | 158 | 299 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83174:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0084, 0.0134, 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_83174:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83174:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83174:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83174:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
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_83175 | 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_83175: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_83175:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83175:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83175:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83175: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
class GeoAggregate(Aggregate):
# Default SQL template for spatial aggregates.
sql_template = '%(function)s(%(field)s)'
# Conversion class, if necessary.
conversion_class = None
# Flags for ... | ajibawa-2023/Python-Code-Large/train/row_83176 | 30 | 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_83176:ImportFrom_L1_C0", "label": "from django.db.models.sql.aggregates import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0167, 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_83176:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83176:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83176:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83176:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.db.models.constants import LOOKUP_SEP
from django.db.models.fields import FieldDoesNotExist
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(Constraint):
... | ajibawa-2023/Python-Code-Large/train/row_83177 | 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_83177:ImportFrom_L1_C0", "label": "from django.db.models.constants import LOOKUP_SEP", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0112, 0.0112, 0, 0.66, 0.0, 469, 0, 1, 0, 0, 469, 0, 0], "semantic": {"name": "django.db.models.constan... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83177:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83177:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83177:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83177: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_83178 | 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_83178: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_83179 | 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_83179: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_83179:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83179:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83179:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83179: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_83180 | 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_83180: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_83181 | 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_83181: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_83181:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83181:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83181:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83181: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_83182 | 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_83182: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_83182:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83182:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83182:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83182:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.contrib.gis.db.models.sql.compiler import GeoSQLCompiler as BaseGeoSQLCompiler
from django.db.backends.mysql import compiler
SQLCompiler = compiler.SQLCompiler
class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):
def resolve_columns(self, row, fields=()):
"""
Integrate the cases hand... | ajibawa-2023/Python-Code-Large/train/row_83183 | 13 | 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_83183: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.0312, 0.0312, 0, 0.66, 0.0, 973, 0, 1, 0, 0, 973, 0, 0], "semantic": {"name": "d... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83183:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83183:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83183:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83183:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
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
from django.utils import six
class MySQLOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = 'djang... | ajibawa-2023/Python-Code-Large/train/row_83184 | 31 | 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_83184: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.0149, 0.0149, 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_83184:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83184:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83184:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83184:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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_83185 | 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_83185: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_83185:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83185:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83185:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83185: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_83186 | 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_83186: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_83186:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83186:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83186:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83186: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):
if not isinstance(other, WKTAdapter):
return... | ajibawa-2023/Python-Code-Large/train/row_83187 | 13 | 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_83187:ClassDef_L1_C0", "label": "WKTAdapter", "type": "class", "loc": [1, 19], "level": 0, "parent": null, "vector": [3, 0, 0.5263, 1.0, 0, 0.66, 0.0, 868, 0, 4, 0, 0, 186, 0, 1], "semantic": {"name": "WKTAdapter", "arg_names": [], "import_names": [], "rhs_call_name": "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83187:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83187:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83187:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83187: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
from django.utils import six
class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict):
"""
Sublcass that includes updates the `base_data_types_reverse` dict
f... | ajibawa-2023/Python-Code-Large/train/row_83188 | 25 | 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_83188:ImportFrom_L1_C0", "label": "from django.contrib.gis.gdal import OGRGeomType", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0192, 0.0192, 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_83188:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83188:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83188:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83188:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
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_83189 | 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_83189: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_83189:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83189:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83189:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83189: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_83190 | 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_83190: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_83190:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83190: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
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class GeometryColumns(models.Model):
"""
T... | ajibawa-2023/Python-Code-Large/train/row_83191 | 36 | 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_83191: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_83191:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83191:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83191:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83191:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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_83192 | 192 | 362 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83192:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0028, 0.0028, 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_83192:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83192:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83192:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83192:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import os
from django.conf import settings
from django.core.cache import get_cache
from django.core.cache.backends.db import BaseDatabaseCache
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.sqlite3.creation import DatabaseCreation
class SpatiaLiteCreation(DatabaseCreation):
def cr... | ajibawa-2023/Python-Code-Large/train/row_83193 | 54 | 130 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83193:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0077, 0.0077, 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_83193:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83193:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83193:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83193:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from ctypes.util import find_library
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.sqlite3.base import (
_sqlite_extract, _sqlite_date_trunc, _sqlite_regexp, _sqlite_format_dtdelta,
connection_created, Database, DatabaseWrapper as SQLiteDatabas... | ajibawa-2023/Python-Code-Large/train/row_83194 | 28 | 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_83194:ImportFrom_L1_C0", "label": "from ctypes.util import find_library", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0156, 0.0156, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "ctypes.util", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83194:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83194:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83194:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83194:If_L17_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_83195 | 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_83195: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_83195:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83195:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83195:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83195:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
"""
from __future__ import unicode_literals
from psycopg2 import Binary
from psycopg2.extensions import ISQLQuote
class PostGISAdapter(object):
def __init__(self, geom):
"Initializes on the geometry."
# Getting the WKB ... | ajibawa-2023/Python-Code-Large/train/row_83196 | 27 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83196:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0435, 0.0652, 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_83196:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83196:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83196:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83196:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
"""
The GeometryColumns and SpatialRefSys models for the PostGIS backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class GeometryColumns(models.Model):
"""
The ... | ajibawa-2023/Python-Code-Large/train/row_83197 | 38 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83197:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0294, 0.0441, 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_83197:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83197:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83197:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83197:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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_83198 | 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_83198: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_83198:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83198:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83198:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83198:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation
from django.utils.functional import cached_property
class PostGISCreation(DatabaseCreation):
geom_index_type = 'GIST'
geom_index_ops = 'GIST_GEO... | ajibawa-2023/Python-Code-Large/train/row_83199 | 50 | 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_83199:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0104, 0.0104, 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_83199:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83199:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83199:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83199:Assign_L9_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_83200 | 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_83200: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_83200:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83200:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83200:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83200:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
A collection of utility routines and classes used by the spatial
backends.
"""
class SpatialOperation(object):
"""
Base class for generating spatial SQL.
"""
sql_template = '%(geo_col)s %(operator)s %(geometry)s'
def __init__(self, function='', operator='', result='', **kwargs):
self.f... | ajibawa-2023/Python-Code-Large/train/row_83201 | 22 | 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_83201: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_83201:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83201:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83201:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83201:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""
Base/mixin classes for the spatial backend database operations and the
`SpatialRefSys` model the backend.
"""
import re
from django.contrib.gis import gdal
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
class BaseSpatialOperations(object):
"""
This module holds t... | ajibawa-2023/Python-Code-Large/train/row_83202 | 191 | 347 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83202:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0072, 0.0115, 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_83202:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83202:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83202:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83202:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import cx_Oracle
from django.db.backends.oracle.introspection import DatabaseIntrospection
class OracleIntrospection(DatabaseIntrospection):
# Associating any OBJECTVAR instances with GeometryField. Of course,
# this won't work right on Oracle objects that aren't MDSYS.SDO_GEOMETRY,
# but it is the only o... | ajibawa-2023/Python-Code-Large/train/row_83203 | 21 | 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_83203:Import_L1_C0", "label": "cx_Oracle import cx_Oracle", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0256, 0, 0.66, 0.0, 554, 0, 1, 0, 0, 554, 0, 0], "semantic": {"name": "cx_Oracle", "arg_names": [], "import_names": ["cx_O... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83203:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83203:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83203:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83203:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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):
pass
c... | ajibawa-2023/Python-Code-Large/train/row_83204 | 9 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83204: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.0455, 0.0455, 0, 0.66, 0.0, 973, 0, 1, 0, 0, 973, 0, 0], "semantic": {"name": "d... | [] |
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_83205 | 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_83205: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_83205:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83205: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_83206 | 36 | 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_83206:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0758, 0.1364, 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_83206:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83206:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83206:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83206:Assign_L17_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_83207 | 159 | 299 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83207:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0167, 0.0301, 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_83207:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83207:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83207:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83207:Assign_L23_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_83208 | 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_83208: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_83208:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83208:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83208:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83208: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_83209 | 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_83209: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_83209:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83209:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83209:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83209:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
# Quick tests for the markup templatetags (django.contrib.markup)
import re
import warnings
from django.template import Template, Context
from django import test
from django.utils import unittest
from django.utils.html import escape
try:
import textile
except ImportError:
textile = None
try:
import markd... | ajibawa-2023/Python-Code-Large/train/row_83210 | 62 | 108 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83210:Import_L2_C0", "label": "re import re", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0093, 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_83210:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83210:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83210:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83210:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""
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_83211 | 39 | 90 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83211:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0722, 0.1333, 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_83211:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83211:Try_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83211:Try_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83211:Import_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
class SessionManager(models.Manager):
def encode(self, session_dict):
"""
Returns the given session dictionary serialized and encoded as a string.
"""
return SessionStore().encode(session_dict)
... | ajibawa-2023/Python-Code-Large/train/row_83212 | 25 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83212:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0185, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83212:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83212:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83212:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83212:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from datetime import timedelta
import os
import shutil
import string
import tempfile
import warnings
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.sessi... | ajibawa-2023/Python-Code-Large/train/row_83213 | 343 | 574 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83213:ImportFrom_L1_C0", "label": "from datetime import timedelta", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0017, 0.0017, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83213:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83213:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83213:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83213:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Cod... |
import time
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
from django.utils.importlib import import_module
class SessionMiddleware(object):
def process_request(self, request):
engine = import_module(settings.SESSION_ENGINE)
... | ajibawa-2023/Python-Code-Large/train/row_83214 | 28 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83214:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0222, 0.0222, 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_83214:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83214:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83214:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83214:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from django.core.signing import JSONSerializer as BaseJSONSerializer
try:
from django.utils.six.moves import cPickle as pickle
except ImportError:
import pickle
class PickleSerializer(object):
"""
Simple wrapper around pickle to be used in signing.dumps and
signing.loads.
"""
def dumps(sel... | ajibawa-2023/Python-Code-Large/train/row_83215 | 11 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83215:ImportFrom_L1_C0", "label": "from django.core.signing import BaseJSONSerializer", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 460, 0, 1, 0, 0, 460, 0, 0], "semantic": {"name": "django.core.signing", "arg_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83215:Try_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83215:ImportFrom_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83215:Try_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83215:Import_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
from django.conf import settings
from django.core.management.base import NoArgsCommand
from django.utils.importlib import import_module
class Command(NoArgsCommand):
help = "Can be run as a cronjob or directly to clean out expired sessions (only with the database backend at the moment)."
def handle_noargs(se... | ajibawa-2023/Python-Code-Large/train/row_83216 | 10 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83216:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 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_83216:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83216:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83216:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83216:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.conf import settings
from django.core import signing
from django.contrib.sessions.backends.base import SessionBase
class SessionStore(SessionBase):
def load(self):
"""
We load the data from the key itself instead of fetching from
some external data store. Opposite of _get_ses... | ajibawa-2023/Python-Code-Large/train/row_83217 | 33 | 81 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83217:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0123, 0.0123, 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_83217:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83217:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83217:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83217:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-... |
import datetime
import errno
import os
import tempfile
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase, CreateError, VALID_KEY_CHARS
from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured
from django.utils import timezone
class SessionStore(SessionB... | ajibawa-2023/Python-Code-Large/train/row_83218 | 100 | 189 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83218:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0053, 0.0053, 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_83218:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83218:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83218:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83218:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
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 import timezone
class SessionStore(SessionBase):
"""
Implements database session store.
"""
def ... | ajibawa-2023/Python-Code-Large/train/row_83219 | 44 | 81 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83219: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.0123, 0.0123, 0, 0.66, 0.0, 907, 0, 2, 0, 0, 907, 0, 0], "semantic": {"name": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83219:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83219:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83219:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83219:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import unicode_literals
import base64
from datetime import datetime, timedelta
import string
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.utils.crypto import constant_time_compare
from django.utils.crypto import get_random_string
from django.utils... | ajibawa-2023/Python-Code-Large/train/row_83220 | 173 | 321 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83220:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0031, 0.0031, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83220:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83220:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83220:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83220:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Cached, database-backed sessions.
"""
from django.contrib.sessions.backends.db import SessionStore as DBStore
from django.core.cache import cache
from django.core.exceptions import SuspiciousOperation
from django.utils import timezone
KEY_PREFIX = "django.contrib.sessions.cached_db"
class SessionStore(DBStore):... | ajibawa-2023/Python-Code-Large/train/row_83221 | 44 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83221:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.026, 0.039, 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_83221:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83221:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83221:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83221:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import get_cache
from django.utils.six.moves import xrange
KEY_PREFIX = "django.contrib.sessions.cache"
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
... | ajibawa-2023/Python-Code-Large/train/row_83222 | 42 | 72 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83222:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0139, 0.0139, 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_83222:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83222:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83222:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83222:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from __future__ import unicode_literals
import datetime
try:
import pytz
except ImportError:
pytz = None
from django.conf import settings
from django.contrib.humanize.templatetags import humanize
from django.template import Template, Context, defaultfilters
from django.test import TestCase
from django.test.ut... | ajibawa-2023/Python-Code-Large/train/row_83223 | 97 | 226 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83223:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0044, 0.0044, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83223:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83223:Import_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83223:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83223:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
from __future__ import unicode_literals
import re
from datetime import date, datetime
from django import template
from django.conf import settings
from django.template import defaultfilters
from django.utils.encoding import force_text
from django.utils.formats import number_format
from django.utils.translation import ... | ajibawa-2023/Python-Code-Large/train/row_83224 | 108 | 229 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83224:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0044, 0.0044, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83224:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83224:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83224:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83224:Try_L21_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
# Empty models.py to allow for specifying databrowse as a test label.
| ajibawa-2023/Python-Code-Large/train/row_83225 | 0 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
from django.contrib import databrowse
from django.db import models
from django.test import TestCase
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class SomeModel(models.Model):
some_field = models.CharField(max_length=50)
def __str__(self):
return self.som... | ajibawa-2023/Python-Code-Large/train/row_83226 | 31 | 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_83226:ImportFrom_L1_C0", "label": "from django.contrib import databrowse", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0161, 0.0161, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "i... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83226:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83226:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83226:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83226:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf.urls import patterns
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),
(r'... | ajibawa-2023/Python-Code-Large/train/row_83227 | 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_83227:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 528, 0, 1, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names": [], "imp... | [] |
from __future__ import unicode_literals
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.html import format_html, format_html... | ajibawa-2023/Python-Code-Large/train/row_83228 | 70 | 147 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83228:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0068, 0.0068, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83228:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83228:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83228:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83228:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import unicode_literals
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.html import format_html, format_html... | ajibawa-2023/Python-Code-Large/train/row_83229 | 48 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83229:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.013, 0.013, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83229:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83229:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83229:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83229:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-... |
try:
from urllib.parse import urljoin
except ImportError: # Python 2
from urlparse import urljoin
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
class Object... | ajibawa-2023/Python-Code-Large/train/row_83230 | 14 | 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_83230:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.1389, 0.2222, 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_83230:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83230:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83230:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83230:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from __future__ import unicode_literals
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(Ex... | ajibawa-2023/Python-Code-Large/train/row_83231 | 74 | 147 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83231:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0068, 0.0068, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83231:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83231:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83231:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83231:Expr_L17_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_83232 | 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_83232: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_83232:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83232:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83232:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83232:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import warnings
from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site
warnings.warn("The Databrowse contrib app is deprecated", DeprecationWarning)
| ajibawa-2023/Python-Code-Large/train/row_83233 | 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_83233:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warnings"], "... | [] |
"""
These classes are light wrappers around Django's database API that provide
convenience functionality and permalink functions for the databrowse app.
"""
from __future__ import unicode_literals
from django.db import models
from django.utils import formats
from django.utils.text import capfirst
from django.utils.enc... | ajibawa-2023/Python-Code-Large/train/row_83234 | 149 | 214 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83234:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0117, 0.0187, 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_83234:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83234:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83234:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83234:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
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), 'lorem ipsum dolor sit amet consectetur... | ajibawa-2023/Python-Code-Large/train/row_83235 | 12 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83235:ImportFrom_L2_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0455, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83235:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83235:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83235:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83235:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Co... |
"""
Utility functions for generating "lorem ipsum" Latin text.
"""
from __future__ import unicode_literals
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 ... | ajibawa-2023/Python-Code-Large/train/row_83236 | 33 | 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_83236:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0194, 0.0291, 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_83236:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83236:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83236:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83236:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code... |
from __future__ import unicode_literals
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
... | ajibawa-2023/Python-Code-Large/train/row_83237 | 33 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83237:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0147, 0.0147, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83237:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83237:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83237:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83237:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_text, force_text
from django.utils.encoding import python_2_unicode_compatible
class ContentTypeManager(models.Manager):
# Cache to avoid re-looking up ContentType objects all over the plac... | ajibawa-2023/Python-Code-Large/train/row_83238 | 101 | 176 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83238:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0057, 0.0057, 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_83238:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83238:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83238:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83238:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from __future__ import unicode_literals
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.views import shortcut
from django.contrib.sites.models import Site, get_current_site
from django.http import HttpRequest, Http404
from django.test import Test... | ajibawa-2023/Python-Code-Large/train/row_83239 | 118 | 276 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83239:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83239:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83239:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83239:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83239:ClassDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
Classes allowing "generic" relations through ContentType and object-id fields.
"""
from __future__ import unicode_literals
from collections import defaultdict
from functools import partial
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import signals
f... | ajibawa-2023/Python-Code-Large/train/row_83240 | 274 | 501 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83240:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.004, 0.006, 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_83240:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83240:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83240:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83240:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from __future__ import unicode_literals
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
from django.utils.translation import ugettext as _
def shortcut(request, conte... | ajibawa-2023/Python-Code-Large/train/row_83241 | 38 | 82 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83241:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0122, 0.0122, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83241:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83241:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83241:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83241:Try_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.contrib.contenttypes.models import ContentType
from django.db import DEFAULT_DB_ALIAS, router
from django.db.models import get_apps, get_models, signals
from django.utils.encoding import smart_text
from django.utils import six
from django.utils.six.moves import input
def update_contenttypes(app, created_m... | ajibawa-2023/Python-Code-Large/train/row_83242 | 41 | 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_83242:ImportFrom_L1_C0", "label": "from django.contrib.contenttypes.models import ContentType", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0112, 0.0112, 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_83242:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83242:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83242:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83242:If_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
""" models.py (even empty) currently required by the runtests.py to enable unit tests """
| ajibawa-2023/Python-Code-Large/train/row_83243 | 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_83243: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": ... | [] |
from django import forms
class ManagementForm(forms.Form):
"""
``ManagementForm`` is used to keep track of the current wizard step.
"""
current_step = forms.CharField(widget=forms.HiddenInput)
| ajibawa-2023/Python-Code-Large/train/row_83244 | 4 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83244:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.1429, 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_83244:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83244:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83244:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83244:Assign_L7_C4"}] |
from django.contrib.formtools.wizard import storage
class SessionStorage(storage.BaseStorage):
def __init__(self, *args, **kwargs):
super(SessionStorage, self).__init__(*args, **kwargs)
if self.prefix not in self.request.session:
self.init_data()
def _get_data(self):
self... | ajibawa-2023/Python-Code-Large/train/row_83245 | 13 | 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_83245:ImportFrom_L1_C0", "label": "from django.contrib.formtools.wizard import storage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "django.contrib.formtoo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83245:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83245:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83245:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83245:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
import json
from django.core.exceptions import SuspiciousOperation
from django.core.signing import BadSignature
from django.contrib.formtools.wizard import storage
class CookieStorage(storage.BaseStorage):
encoder = json.JSONEncoder(separators=(',', ':'))
def __init__(self, *args, **kwargs):
super(... | ajibawa-2023/Python-Code-Large/train/row_83246 | 22 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83246:Import_L1_C0", "label": "json import json", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83246:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83246:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83246:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83246:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.core.exceptions import ImproperlyConfigured
class MissingStorageModule(ImproperlyConfigured):
pass
class MissingStorageClass(ImproperlyConfigured):
pass
class NoFileStorageConfigured(ImproperlyConfigured):
pass
| ajibawa-2023/Python-Code-Large/train/row_83247 | 4 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83247:ImportFrom_L1_C0", "label": "from django.core.exceptions import ImproperlyConfigured", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.1, 0, 0.66, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions",... | [] |
from django.core.files.uploadedfile import UploadedFile
from django.utils.datastructures import MultiValueDict
from django.utils.functional import lazy_property
from django.utils import six
from django.contrib.formtools.wizard.storage.exceptions import NoFileStorageConfigured
class BaseStorage(object):
step_key ... | ajibawa-2023/Python-Code-Large/train/row_83248 | 59 | 109 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83248:ImportFrom_L1_C0", "label": "from django.core.files.uploadedfile import UploadedFile", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0092, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.core.files.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83248:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83248:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83248:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83248:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.utils.importlib import import_module
from django.contrib.formtools.wizard.storage.base import BaseStorage
from django.contrib.formtools.wizard.storage.exceptions import (
MissingStorageModule, MissingStorageClass, NoFileStorageConfigured)
def get_storage(path, *args, **kwargs):
i = path.rfind('.'... | ajibawa-2023/Python-Code-Large/train/row_83249 | 11 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83249:ImportFrom_L1_C0", "label": "from django.utils.importlib import import_module", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 118, 0, 1, 0, 0, 118, 0, 0], "semantic": {"name": "django.utils.importlib", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83249:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83249:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83249:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83249:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import re
from django import forms
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.forms import formsets, ValidationError
from django.views.generic import TemplateView
from django.utils.datastructures import SortedDict
from django.utils.decorators import classonlymethod
f... | ajibawa-2023/Python-Code-Large/train/row_83250 | 309 | 706 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83250:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0014, 0.0014, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83250:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83250:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83250:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83250:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.contrib.formtools.wizard.legacy import FormWizard
| ajibawa-2023/Python-Code-Large/train/row_83251 | 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_83251:ImportFrom_L1_C0", "label": "from django.contrib.formtools.wizard.legacy import FormWizard", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 255, 0, 1, 0, 0, 255, 0, 0], "semantic": {"name": "django.contrib.for... | [] |
"""
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.
"""
from django.forms import HiddenInput
from django.http import Http404
from django.shortcuts import render_to_response
from django.templa... | ajibawa-2023/Python-Code-Large/train/row_83252 | 104 | 270 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83252:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0111, 0.0185, 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_83252:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83252:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83252:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83252:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django import forms
from django.contrib.formtools.wizard import FormWizard
from django.http import HttpResponse
class Page1(forms.Form):
name = forms.CharField(max_length=100)
thirsty = forms.NullBooleanField()
class Page2(forms.Form):
address1 = forms.CharField(max_length=100)
address2 = forms.C... | ajibawa-2023/Python-Code-Large/train/row_83253 | 33 | 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_83253:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0227, 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_83253:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83253:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83253:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83253:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from datetime import datetime
from django.http import HttpRequest
from django.conf import settings
from django.utils.importlib import import_module
from django.contrib.auth.models import User
def get_request():
request = HttpRequest()
engine = import_module(settings.SESSION_ENGINE)
request.session = eng... | ajibawa-2023/Python-Code-Large/train/row_83254 | 56 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83254:ImportFrom_L1_C0", "label": "from datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0115, 0.0115, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83254:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83254:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83254:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83254:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Co... |
import os
import tempfile
from django import forms
from django.contrib.auth.models import User
from django.core.files.storage import FileSystemStorage
from django.forms.formsets import formset_factory
from django.forms.models import modelformset_factory
from django.http import HttpResponse
from django.template import ... | ajibawa-2023/Python-Code-Large/train/row_83255 | 46 | 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_83255:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 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_83255:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83255:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83255:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83255:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import unicode_literals
import os
from django import forms
from django.test import TestCase
from django.test.client import RequestFactory
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.formto... | ajibawa-2023/Python-Code-Large/train/row_83256 | 221 | 406 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83256:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0025, 0.0025, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83256:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83256:ClassDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83256:ClassDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83256:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf.urls import patterns, url
from django.contrib.formtools.tests.wizard.wizardtests.forms import (
SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
urlpatterns = patterns('',
url(r'^wiz_session/$', SessionContactWizard.as_view(
[('form1', Page1),
('form2', P... | ajibawa-2023/Python-Code-Large/train/row_83257 | 3 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83257:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names":... | [] |
from __future__ import unicode_literals
from django import forms, http
from django.conf import settings
from django.db import models
from django.test import TestCase
from django.template.response import TemplateResponse
from django.utils.importlib import import_module
from django.contrib.auth.models import User
from... | ajibawa-2023/Python-Code-Large/train/row_83258 | 140 | 222 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83258:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0045, 0.0045, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83258:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83258:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83258:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83258:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Co... |
import json
from django.test import TestCase
from django.core import signing
from django.core.exceptions import SuspiciousOperation
from django.http import HttpResponse
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.formtools.wizard.storage.cookie import CookieStorage
from django.con... | ajibawa-2023/Python-Code-Large/train/row_83259 | 32 | 49 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83259:Import_L1_C0", "label": "json import json", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0204, 0, 0.66, 0.0, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83259:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83259:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83259:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83259:Return_L16_C8"}, {"f": "ajibawa-2023/Python-... |
from django.test import TestCase
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.formtools.tests.wizard.storage import TestStorage
from django.contrib.formtools.wizard.storage.session import SessionStorage
@skipIfCustomUser
class TestSessionStorage(TestStorage, TestCase):
def get... | ajibawa-2023/Python-Code-Large/train/row_83260 | 7 | 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_83260:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83260:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83260:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83260:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83260:Return_L11_C8"}] |
import os
import tempfile
from django import forms
from django.core.files.storage import FileSystemStorage
from django.forms.formsets import formset_factory
from django.http import HttpResponse
from django.template import Template, Context
from django.contrib.auth.models import User
from django.contrib.formtools.wiz... | ajibawa-2023/Python-Code-Large/train/row_83261 | 34 | 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_83261:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0192, 0.0192, 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_83261:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83261:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83261:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83261:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.http import QueryDict
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.formtools.wizard.views import (NamedUrlS... | ajibawa-2023/Python-Code-Large/train/row_83262 | 181 | 382 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83262:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83262:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83262:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83262:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83262:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django.conf.urls import patterns, url
from django.contrib.formtools.tests.wizard.namedwizardtests.forms import (
SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
def get_named_session_wizard():
return SessionContactWizard.as_view(
[('form1', Page1), ('form2', Page2), ('form3'... | ajibawa-2023/Python-Code-Large/train/row_83263 | 7 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83263:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83263:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83263:Return_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83263:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83263:Return_L13_C4"}] |
from django.test import TestCase
from django.contrib.formtools.wizard.storage import (get_storage,
MissingStorageModule,
MissingStorageClass)
from django.contrib.formtools.wizard.storage.base import BaseStorage
... | ajibawa-2023/Python-Code-Large/train/row_83264 | 10 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83264:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83264:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83264:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83264:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83264:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from django.contrib.formtools.tests.wizard.cookiestorage import TestCookieStorage
from django.contrib.formtools.tests.wizard.forms import FormTests, SessionFormTests, CookieFormTests
from django.contrib.formtools.tests.wizard.loadstorage import TestLoadStorage
from django.contrib.formtools.tests.wizard.namedwizardtests... | ajibawa-2023/Python-Code-Large/train/row_83265 | 6 | 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_83265:ImportFrom_L1_C0", "label": "from django.contrib.formtools.tests.wizard.cookiestorage import TestCookieStorage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 832, 0, 1, 0, 0, 832, 0, 0], "semantic": {"... | [] |
"""
This is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.
"""
from __future__ import absolute_import
from django.conf.urls import patterns, url
from django.contrib.formtools.tests import TestFormPreview, TestWizardClass
from django.contrib.formtools.tests.forms import (ContactWizard, Page1,... | ajibawa-2023/Python-Code-Large/train/row_83266 | 6 | 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_83266:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1053, 0.1579, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import os
import pickle
import re
import warnings
from django import http
from django.conf import settings
from django.contrib.formtools import preview, utils
from django.contrib.formtools.wizard import FormWizard
from django.test import ... | ajibawa-2023/Python-Code-Large/train/row_83267 | 217 | 441 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83267:ImportFrom_L2_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0045, 0.0023, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83267:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83267:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83267:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83267:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Formtools Preview application.
"""
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.utils.crypto import constant_time_compare
from django.contrib.formtools.utils import form_hmac
AUTO_ID = 'formtools_%s' # Each form here... | ajibawa-2023/Python-Code-Large/train/row_83268 | 70 | 148 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83268:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0135, 0.0203, 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_83268:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83268:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83268:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83268:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import unicode_literals
# Do not try cPickle here (see #18340)
import pickle
from django.utils.crypto import salted_hmac
from django.utils import six
def form_hmac(form):
"""
Calculates a security hash for the given Form instance.
"""
data = []
for bf in form:
# Get the v... | ajibawa-2023/Python-Code-Large/train/row_83269 | 17 | 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_83269:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0357, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83269:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83269:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83269:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83269:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.utils.http import http_date, parse_http_date_safe
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 replaced by an HttpNotModified.
... | ajibawa-2023/Python-Code-Large/train/row_83270 | 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_83270:ImportFrom_L1_C0", "label": "from django.utils.http import http_date, parse_http_date_safe", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0286, 0.0286, 0, 0.66, 0.0, 516, 0, 2, 0, 0, 516, 0, 0], "semantic": {"name": "django.utils... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83270:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83270:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83270:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83270:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"This is the locale selecting middleware that will look at accept headers"
from django.conf import settings
from django.core.urlresolvers import (is_valid_path, get_resolver,
LocaleRegexURLResolver)
from django.http import HttpResponseRedirect
from django.utils.cache import patch_... | ajibawa-2023/Python-Code-Large/train/row_83271 | 35 | 59 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83271:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0169, 0.0169, 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_83271:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83271:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83271:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83271:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.